Sha256: 877634188cc9f16bf7b60a1a64569cba3c98fab71b6751303319d48fcaf5864d

Contents?: true

Size: 653 Bytes

Versions: 4

Compression:

Stored size: 653 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Ledgers
    module NetSuite
      class Type
        class DeserializerSubsidiaryType < LedgerSync::Type::Value
          def initialize(args = {})
            @subsidiary_class = args.fetch(:subsidiary_class)
          end

          private

          def cast_value(args = {})
            value = args.fetch(:value)

            return if value.nil?

            @subsidiary_class.new(
              ledger_id: value.fetch('id', nil)
            )
          end

          def valid_classes
            [
              Hash
            ]
          end
        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/netsuite/type/deserializer_subsidiary_type.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/netsuite/type/deserializer_subsidiary_type.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/netsuite/type/deserializer_subsidiary_type.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/netsuite/type/deserializer_subsidiary_type.rb