Sha256: d52cc4328947fa81aaaa29103ca214d7756c1423d90e995de1fef5d74c537055

Contents?: true

Size: 919 Bytes

Versions: 4

Compression:

Stored size: 919 Bytes

Contents

# frozen_string_literal: true

require_relative '../reference/deserializer'

module LedgerSync
  module Ledgers
    module QuickBooksOnline
      class DepositLineDetail
        class Deserializer < QuickBooksOnline::Deserializer
          references_one :Account,
                         hash_attribute: 'AccountRef',
                         deserializer: Reference::Deserializer

          references_one :Class,
                         hash_attribute: 'ClassRef',
                         deserializer: Reference::Deserializer

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ledger_sync-1.6.0 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_detail/deserializer.rb
ledger_sync-1.5.2 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_detail/deserializer.rb
ledger_sync-1.5.1 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_detail/deserializer.rb
ledger_sync-1.5.0 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_detail/deserializer.rb