Class: OnlinePayments::SDK::Domain::LineItem

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/line_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#amount_of_moneyOnlinePayments::SDK::Domain::AmountOfMoney

Returns the current value of amount_of_money.

Returns:



17
18
19
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 17

def amount_of_money
  @amount_of_money
end

#invoice_dataOnlinePayments::SDK::Domain::LineItemInvoiceData

Returns the current value of invoice_data.

Returns:



17
18
19
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 17

def invoice_data
  @invoice_data
end

#order_line_detailsOnlinePayments::SDK::Domain::OrderLineDetails

Returns the current value of order_line_details.

Returns:



17
18
19
# File 'lib/onlinepayments/sdk/domain/line_item.rb', line 17

def order_line_details
  @order_line_details
end

#other_detailsOnlinePayments::SDK::Domain::OtherDetails

Returns the current value of other_details.

Returns:



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_hHash

Returns:

  • (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