Sha256: 974fc9e77dec24c4b658623128c4c4b98a32a63cda814aa285bd43b76becb85f

Contents?: true

Size: 674 Bytes

Versions: 4

Compression:

Stored size: 674 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)

            super()
          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.6.0 lib/ledger_sync/ledgers/netsuite/type/deserializer_subsidiary_type.rb
ledger_sync-1.5.2 lib/ledger_sync/ledgers/netsuite/type/deserializer_subsidiary_type.rb
ledger_sync-1.5.1 lib/ledger_sync/ledgers/netsuite/type/deserializer_subsidiary_type.rb
ledger_sync-1.5.0 lib/ledger_sync/ledgers/netsuite/type/deserializer_subsidiary_type.rb