Sha256: 35ed73b15c21bf03656bb43464e937d4f4873d3b21b001a76e93efaa61af7135
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
# frozen_string_literal: true require_relative '../expense_line_item/deserializer' require_relative '../currency/deserializer' module LedgerSync module Ledgers module QuickBooksOnline class Expense class Deserializer < QuickBooksOnline::Deserializer id references_one :currency, hash_attribute: :CurrencyRef, deserializer: Currency::Deserializer mapping :payment_type, hash_attribute: 'PaymentType', hash: Expense::PAYMENT_TYPES.invert date :transaction_date, hash_attribute: 'TxnDate' attribute :memo, hash_attribute: 'PrivateNote' attribute :exchange_rate, hash_attribute: 'ExchangeRate' attribute(:entity) do |args = {}| hash = args.fetch(:hash) value = hash['EntityRef'] unless value.nil? Client.resource_from_ledger_type( type: value['type'] ).new( ledger_id: value['value'] ) end end attribute :reference_number, hash_attribute: 'DocNumber' attribute 'account.ledger_id', hash_attribute: 'AccountRef.value' attribute 'department.ledger_id', hash_attribute: 'DepartmentRef.value' references_many :line_items, hash_attribute: 'Line', deserializer: ExpenseLineItem::Deserializer end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-1.4.4 | lib/ledger_sync/ledgers/quickbooks_online/expense/deserializer.rb |