Class: LedgerSync::QuickBooksOnline::Serialization::Type::MappingType

Inherits:
Type::Value
  • Object
show all
Defined in:
lib/ledger_sync/ledgers/quickbooks_online/serialziation/type/mapping_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Type::ValueMixin

#assert_valid, #cast, included, #valid?

Constructor Details

#initialize(args = {}) ⇒ MappingType

Returns a new instance of MappingType.



10
11
12
# File 'lib/ledger_sync/ledgers/quickbooks_online/serialziation/type/mapping_type.rb', line 10

def initialize(args = {})
  @mapping = args.fetch(:mapping)
end

Instance Attribute Details

#mappingObject (readonly)

Returns the value of attribute mapping.



8
9
10
# File 'lib/ledger_sync/ledgers/quickbooks_online/serialziation/type/mapping_type.rb', line 8

def mapping
  @mapping
end

Instance Method Details

#cast_value(args = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/ledger_sync/ledgers/quickbooks_online/serialziation/type/mapping_type.rb', line 14

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

  return if value.nil?

  mapping.fetch(:value)
end