Sha256: 00cd1e181154bb0f0732b28fc0b0ac9350d8edfbb852e5105b7e17def01fb5ac

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

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

          attribute('DetailType') { 'DepositLineDetail' }

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

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

          attribute('DepositLineDetail.Entity') do |args = {}|
            resource = args.fetch(:resource)

            if resource.entity.present?
              {
                'name' => resource.entity.name,
                'value' => resource.entity.ledger_id,
                'type' => Client.ledger_resource_type_for(
                  resource_class: resource.entity.class
                ).classify
              }
            end
          end

          amount 'Amount',
                 resource_attribute: :amount

          attribute 'Description',
                    resource_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/serializer.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/serializer.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/serializer.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_item/serializer.rb