Sha256: 0c02e82938afaa7883a8ef676b04ef65b1bfd4799db133558e3379e4ea9933b8

Contents?: true

Size: 986 Bytes

Versions: 4

Compression:

Stored size: 986 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Ledgers
    module QuickBooksOnline
      class DepositLineItem
        class Deserializer < QuickBooksOnline::Deserializer
          id

          attribute 'account.ledger_id',
                    hash_attribute: 'DepositLineDetail.AccountRef.value'

          attribute 'ledger_class.ledger_id',
                    hash_attribute: 'DepositLineDetail.ClassRef.value'

          attribute(:entity) do |args = {}|
            hash = args.fetch(:hash)
            value = hash.fetch('DepositLineDetail.Entity', nil)

            unless value.nil?
              Client.ledger_resource_for(
                type: value['type']
              ).new(
                ledger_id: value['value']
              )
            end
          end

          amount :amount,
                 hash_attribute: 'Amount'

          attribute :description,
                    hash_attribute: 'Description'
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ledger_sync-1.4.4 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/deserializer.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/deserializer.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/deserializer.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/deserializer.rb