Sha256: 8ebe07c023527d390bcd96570bf639410245bc5e569c330db549aa93dffcc570

Contents?: true

Size: 666 Bytes

Versions: 4

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

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

            super()
          end

          private

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

            return if value.nil?

            @customer_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_customer_type.rb
ledger_sync-1.5.2 lib/ledger_sync/ledgers/netsuite/type/deserializer_customer_type.rb
ledger_sync-1.5.1 lib/ledger_sync/ledgers/netsuite/type/deserializer_customer_type.rb
ledger_sync-1.5.0 lib/ledger_sync/ledgers/netsuite/type/deserializer_customer_type.rb