Class: Worldline::Connect::SDK::V1::Domain::Order

Inherits:
Domain::DataObject show all
Defined in:
lib/worldline/connect/sdk/v1/domain/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Instance Attribute Details

#additional_inputWorldline::Connect::SDK::V1::Domain::AdditionalOrderInput

Returns the current value of additional_input.

Returns:



28
29
30
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 28

def additional_input
  @additional_input
end

#amount_of_moneyWorldline::Connect::SDK::V1::Domain::AmountOfMoney

Returns the current value of amount_of_money.

Returns:



28
29
30
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 28

def amount_of_money
  @amount_of_money
end

#customerWorldline::Connect::SDK::V1::Domain::Customer

Returns the current value of customer.

Returns:



28
29
30
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 28

def customer
  @customer
end

#itemsObject

Deprecated.

Use shoppingCart.items instead



28
29
30
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 28

def items
  @items
end

#referencesWorldline::Connect::SDK::V1::Domain::OrderReferences

Returns the current value of references.

Returns:



28
29
30
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 28

def references
  @references
end

#sellerObject

Deprecated.

Use Merchant.seller instead



28
29
30
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 28

def seller
  @seller
end

#shippingWorldline::Connect::SDK::V1::Domain::Shipping

Returns the current value of shipping.

Returns:



28
29
30
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 28

def shipping
  @shipping
end

#shopping_cartWorldline::Connect::SDK::V1::Domain::ShoppingCart

Returns the current value of shopping_cart.

Returns:



28
29
30
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 28

def shopping_cart
  @shopping_cart
end

Instance Method Details

#from_hash(hash) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 62

def from_hash(hash)
  super
  if hash.has_key? 'additionalInput'
    raise TypeError, "value '%s' is not a Hash" % [hash['additionalInput']] unless hash['additionalInput'].is_a? Hash
    @additional_input = Worldline::Connect::SDK::V1::Domain::AdditionalOrderInput.new_from_hash(hash['additionalInput'])
  end
  if hash.has_key? 'amountOfMoney'
    raise TypeError, "value '%s' is not a Hash" % [hash['amountOfMoney']] unless hash['amountOfMoney'].is_a? Hash
    @amount_of_money = Worldline::Connect::SDK::V1::Domain::AmountOfMoney.new_from_hash(hash['amountOfMoney'])
  end
  if hash.has_key? 'customer'
    raise TypeError, "value '%s' is not a Hash" % [hash['customer']] unless hash['customer'].is_a? Hash
    @customer = Worldline::Connect::SDK::V1::Domain::Customer.new_from_hash(hash['customer'])
  end
  if hash.has_key? 'items'
    raise TypeError, "value '%s' is not an Array" % [hash['items']] unless hash['items'].is_a? Array
    @items = []
    hash['items'].each do |e|
      @items << Worldline::Connect::SDK::V1::Domain::LineItem.new_from_hash(e)
    end
  end
  if hash.has_key? 'references'
    raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
    @references = Worldline::Connect::SDK::V1::Domain::OrderReferences.new_from_hash(hash['references'])
  end
  if hash.has_key? 'seller'
    raise TypeError, "value '%s' is not a Hash" % [hash['seller']] unless hash['seller'].is_a? Hash
    @seller = Worldline::Connect::SDK::V1::Domain::Seller.new_from_hash(hash['seller'])
  end
  if hash.has_key? 'shipping'
    raise TypeError, "value '%s' is not a Hash" % [hash['shipping']] unless hash['shipping'].is_a? Hash
    @shipping = Worldline::Connect::SDK::V1::Domain::Shipping.new_from_hash(hash['shipping'])
  end
  if hash.has_key? 'shoppingCart'
    raise TypeError, "value '%s' is not a Hash" % [hash['shoppingCart']] unless hash['shoppingCart'].is_a? Hash
    @shopping_cart = Worldline::Connect::SDK::V1::Domain::ShoppingCart.new_from_hash(hash['shoppingCart'])
  end
end

#to_hHash

Returns:

  • (Hash)


49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/worldline/connect/sdk/v1/domain/order.rb', line 49

def to_h
  hash = super
  hash['additionalInput'] = @additional_input.to_h unless @additional_input.nil?
  hash['amountOfMoney'] = @amount_of_money.to_h unless @amount_of_money.nil?
  hash['customer'] = @customer.to_h unless @customer.nil?
  hash['items'] = @items.collect{|val| val.to_h} unless @items.nil?
  hash['references'] = @references.to_h unless @references.nil?
  hash['seller'] = @seller.to_h unless @seller.nil?
  hash['shipping'] = @shipping.to_h unless @shipping.nil?
  hash['shoppingCart'] = @shopping_cart.to_h unless @shopping_cart.nil?
  hash
end