Sha256: ac89550cf67036d3af73a14d18dc479b132f00fa237c542ac7f0c87d23a7d686

Contents?: true

Size: 1004 Bytes

Versions: 4

Compression:

Stored size: 1004 Bytes

Contents

# frozen_string_literal: true

require_relative '../reference/serializer'

module LedgerSync
  module Ledgers
    module QuickBooksOnline
      class DepositLineDetail
        class Serializer < QuickBooksOnline::Serializer
          references_one 'AccountRef',
                         resource_attribute: :Account,
                         serializer: Reference::Serializer

          references_one 'ClassRef',
                         resource_attribute: :Class,
                         serializer: Reference::Serializer

          attribute '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
        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/serializer.rb
ledger_sync-1.5.2 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_detail/serializer.rb
ledger_sync-1.5.1 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_detail/serializer.rb
ledger_sync-1.5.0 lib/ledger_sync/ledgers/quickbooks_online/deposit_line_detail/serializer.rb