Class: Cadooz::Immutable::OrderPosition

Inherits:
Object
  • Object
show all
Includes:
Mixins
Defined in:
lib/cadooz/models/immutable/order_position.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mixins

#cadooz_class, #default_value_for_nil, #instance_variables_empty?, #serialize

Constructor Details

#initialize(open_struct) ⇒ OrderPosition

Returns a new instance of OrderPosition.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cadooz/models/immutable/order_position.rb', line 9

def initialize(open_struct)
  @amount = open_struct&.amount
  @attributes = open_struct&.attributes&.inject({}) { |hash, element| hash.merge(element.key.to_sym => element.value) }
  @cadooz_product_number = open_struct&.cadooz_product_number
  @currency = open_struct&.currency
  @delivery_address = open_struct&.delivery_address
  @external_reference_number = open_struct&.external_reference_number
  @greeting_card = open_struct&.greeting_card
  @value = open_struct&.value
  @voucher_address = open_struct&.voucher_address
  @voucher_address_editable = open_struct&.voucher_address_editable
  @voucher_address_preset = open_struct&.voucher_address_preset

  self.freeze
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def attributes
  @attributes
end

#cadooz_product_numberObject (readonly)

Returns the value of attribute cadooz_product_number.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def cadooz_product_number
  @cadooz_product_number
end

#currencyObject (readonly)

Returns the value of attribute currency.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def currency
  @currency
end

#delivery_addressObject (readonly)

Returns the value of attribute delivery_address.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def delivery_address
  @delivery_address
end

#external_reference_numberObject (readonly)

Returns the value of attribute external_reference_number.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def external_reference_number
  @external_reference_number
end

#greeting_cardObject (readonly)

Returns the value of attribute greeting_card.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def greeting_card
  @greeting_card
end

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def value
  @value
end

#voucher_addressObject (readonly)

Returns the value of attribute voucher_address.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def voucher_address
  @voucher_address
end

#voucher_address_editableObject (readonly)

Returns the value of attribute voucher_address_editable.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def voucher_address_editable
  @voucher_address_editable
end

#voucher_address_presetObject (readonly)

Returns the value of attribute voucher_address_preset.



4
5
6
# File 'lib/cadooz/models/immutable/order_position.rb', line 4

def voucher_address_preset
  @voucher_address_preset
end