Sha256: b6c4ea6fb23fffab94bb5bd572ce09faae7cf20e40cb22adac90eb076116280a

Contents?: true

Size: 918 Bytes

Versions: 8

Compression:

Stored size: 918 Bytes

Contents

# frozen_string_literal: true

require_relative '../reference/serializer'
require_relative '../journal_entry_line_item/serializer'

module LedgerSync
  module Ledgers
    module NetSuite
      class JournalEntry
        class Serializer < NetSuite::Serializer
          attribute :memo

          attribute :trandate

          attribute :tranId

          references_one :currency,
                         serializer: Reference::Serializer, if: :currency_present?

          references_one :subsidiary,
                         serializer: Reference::Serializer

          references_many 'line.items',
                          resource_attribute: :line_items,
                          serializer: JournalEntryLineItem::Serializer

          def currency_present?(args = {})
            resource = args.fetch(:resource)

            resource.currency.present?
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ledger_sync-1.6.0 lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb
ledger_sync-1.5.2 lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb
ledger_sync-1.5.1 lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb
ledger_sync-1.5.0 lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb
ledger_sync-1.4.4 lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/netsuite/journal_entry/serializer.rb