Class: OnlinePayments::SDK::Domain::LineItem
- Inherits:
-
DataObject
- Object
- DataObject
- OnlinePayments::SDK::Domain::LineItem
- Defined in:
- lib/onlinepayments/sdk/domain/line_item.rb
Instance Attribute Summary collapse
-
#amount_of_money ⇒ OnlinePayments::SDK::Domain::AmountOfMoney
The current value of amount_of_money.
-
#invoice_data ⇒ OnlinePayments::SDK::Domain::LineItemInvoiceData
The current value of invoice_data.
-
#order_line_details ⇒ OnlinePayments::SDK::Domain::OrderLineDetails
The current value of order_line_details.
-
#other_details ⇒ OnlinePayments::SDK::Domain::OtherDetails
The current value of other_details.
Instance Method Summary collapse
Methods inherited from DataObject
Instance Attribute Details
#amount_of_money ⇒ OnlinePayments::SDK::Domain::AmountOfMoney
Returns the current value of amount_of_money.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 17 def amount_of_money @amount_of_money end |
#invoice_data ⇒ OnlinePayments::SDK::Domain::LineItemInvoiceData
Returns the current value of invoice_data.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 17 def invoice_data @invoice_data end |
#order_line_details ⇒ OnlinePayments::SDK::Domain::OrderLineDetails
Returns the current value of order_line_details.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 17 def order_line_details @order_line_details end |
#other_details ⇒ OnlinePayments::SDK::Domain::OtherDetails
Returns the current value of other_details.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 17 def other_details @other_details end |
Instance Method Details
#from_hash(hash) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 37 def from_hash(hash) super if hash.has_key? 'amountOfMoney' raise TypeError, "value '%s' is not a Hash" % [hash['amountOfMoney']] unless hash['amountOfMoney'].is_a? Hash @amount_of_money = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['amountOfMoney']) end if hash.has_key? 'invoiceData' raise TypeError, "value '%s' is not a Hash" % [hash['invoiceData']] unless hash['invoiceData'].is_a? Hash @invoice_data = OnlinePayments::SDK::Domain::LineItemInvoiceData.new_from_hash(hash['invoiceData']) end if hash.has_key? 'orderLineDetails' raise TypeError, "value '%s' is not a Hash" % [hash['orderLineDetails']] unless hash['orderLineDetails'].is_a? Hash @order_line_details = OnlinePayments::SDK::Domain::OrderLineDetails.new_from_hash(hash['orderLineDetails']) end if hash.has_key? 'otherDetails' raise TypeError, "value '%s' is not a Hash" % [hash['otherDetails']] unless hash['otherDetails'].is_a? Hash @other_details = OnlinePayments::SDK::Domain::OtherDetails.new_from_hash(hash['otherDetails']) end end |
#to_h ⇒ Hash
28 29 30 31 32 33 34 35 |
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 28 def to_h hash = super hash['amountOfMoney'] = @amount_of_money.to_h unless @amount_of_money.nil? hash['invoiceData'] = @invoice_data.to_h unless @invoice_data.nil? hash['orderLineDetails'] = @order_line_details.to_h unless @order_line_details.nil? hash['otherDetails'] = @other_details.to_h unless @other_details.nil? hash end |