Sha256: 74d36e0a91c1ee404224c432bf79801d64246bd89b967c63f76e339db5a9cc9c

Contents?: true

Size: 493 Bytes

Versions: 5

Compression:

Stored size: 493 Bytes

Contents

# frozen_string_literal: true

require_relative 'subsidiary'

module LedgerSync
  class Customer < LedgerSync::Resource
    attribute :email, type: Type::String
    attribute :name, type: Type::String
    attribute :phone_number, type: Type::String

    references_one :subsidiary, to: Subsidiary

    def first_name
      return '' if name.blank?

      name.split(' ').first
    end

    def last_name
      return '' if name.blank?

      name.split(' ')[1..-1].join(' ')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ledger_sync-1.3.5 lib/ledger_sync/resources/customer.rb
ledger_sync-1.3.4 lib/ledger_sync/resources/customer.rb
ledger_sync-1.3.3 lib/ledger_sync/resources/customer.rb
ledger_sync-1.3.2 lib/ledger_sync/resources/customer.rb
ledger_sync-1.3.1 lib/ledger_sync/resources/customer.rb