Class: Cadooz::Immutable::Order

Inherits:
Object
  • Object
show all
Includes:
Mixins
Defined in:
lib/cadooz/models/immutable/order.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) ⇒ Order

Returns a new instance of Order.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cadooz/models/immutable/order.rb', line 10

def initialize(open_struct)
  @client = open_struct&.client
  @commission = open_struct&.commission
  @cost_owner = open_struct&.cost_owner
  @cost_unit = open_struct&.cost_unit
  @credit_or_number = open_struct&.credit_or_number
  @customer_reference_number = open_struct&.customer_reference_number
  @delivery_address = Cadooz::Immutable::Address.new(open_struct&.delivery_address)
  @generation_profile = open_struct&.generation_profile
  @greeting_card = Cadooz::Immutable::GreetingCard.new(open_struct&.greeting_card)
  @invoice_address = Cadooz::Immutable::Address.new(open_struct&.invoice_address)
  @invoice_information = Array(open_struct&.invoice_information)&.each_with_object([]) { |i, arr| arr << Cadooz::Immutable::InvoiceInformation.new(i) }
  @language = open_struct&.language
  @order_attributes = open_struct&.order_attributes&.inject({}) { |hash, element| hash.merge(element.key.to_sym => element.value) }
  @order_description = open_struct&.order_description
  @order_positions = Array(open_struct&.order_positions)&.each_with_object([]) { |o, arr| arr << Cadooz::Immutable::OrderPosition.new(o) }
  @payment_informations = open_struct&.payment_informations
  @queue = open_struct&.queue
  @send_mail = open_struct&.send_mail
  @test = open_struct&.test
  @website = open_struct&.website

  self.freeze
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

#commissionObject (readonly)

Returns the value of attribute commission.



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

def commission
  @commission
end

#cost_ownerObject (readonly)

Returns the value of attribute cost_owner.



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

def cost_owner
  @cost_owner
end

#cost_unitObject (readonly)

Returns the value of attribute cost_unit.



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

def cost_unit
  @cost_unit
end

#credit_or_numberObject (readonly)

Returns the value of attribute credit_or_number.



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

def credit_or_number
  @credit_or_number
end

#customer_reference_numberObject (readonly)

Returns the value of attribute customer_reference_number.



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

def customer_reference_number
  @customer_reference_number
end

#delivery_addressObject (readonly)

Returns the value of attribute delivery_address.



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

def delivery_address
  @delivery_address
end

#generation_profileObject (readonly)

Returns the value of attribute generation_profile.



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

def generation_profile
  @generation_profile
end

#greeting_cardObject (readonly)

Returns the value of attribute greeting_card.



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

def greeting_card
  @greeting_card
end

#invoice_addressObject (readonly)

Returns the value of attribute invoice_address.



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

def invoice_address
  @invoice_address
end

#invoice_informationObject (readonly)

Returns the value of attribute invoice_information.



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

def invoice_information
  @invoice_information
end

#languageObject (readonly)

Returns the value of attribute language.



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

def language
  @language
end

#order_attributesObject (readonly)

Returns the value of attribute order_attributes.



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

def order_attributes
  @order_attributes
end

#order_descriptionObject (readonly)

Returns the value of attribute order_description.



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

def order_description
  @order_description
end

#order_positionsObject (readonly)

Returns the value of attribute order_positions.



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

def order_positions
  @order_positions
end

#payment_informationsObject (readonly)

Returns the value of attribute payment_informations.



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

def payment_informations
  @payment_informations
end

#queueObject (readonly)

Returns the value of attribute queue.



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

def queue
  @queue
end

#send_mailObject (readonly)

Returns the value of attribute send_mail.



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

def send_mail
  @send_mail
end

#testObject (readonly)

Returns the value of attribute test.



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

def test
  @test
end

#websiteObject (readonly)

Returns the value of attribute website.



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

def website
  @website
end