Class: OnlinePayments::SDK::Domain::LineItemDetail

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#discount_amountInteger

Returns the current value of discount_amount.

Returns:

  • (Integer)

    the current value of discount_amount



13
14
15
# File 'lib/onlinepayments/sdk/domain/line_item_detail.rb', line 13

def discount_amount
  @discount_amount
end

#line_item_idString

Returns the current value of line_item_id.

Returns:

  • (String)

    the current value of line_item_id



13
14
15
# File 'lib/onlinepayments/sdk/domain/line_item_detail.rb', line 13

def line_item_id
  @line_item_id
end

#quantityInteger

Returns the current value of quantity.

Returns:

  • (Integer)

    the current value of quantity



13
14
15
# File 'lib/onlinepayments/sdk/domain/line_item_detail.rb', line 13

def quantity
  @quantity
end

#tax_amountInteger

Returns the current value of tax_amount.

Returns:

  • (Integer)

    the current value of tax_amount



13
14
15
# File 'lib/onlinepayments/sdk/domain/line_item_detail.rb', line 13

def tax_amount
  @tax_amount
end

Instance Method Details

#from_hash(hash) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/onlinepayments/sdk/domain/line_item_detail.rb', line 33

def from_hash(hash)
  super
  if hash.has_key? 'discountAmount'
    @discount_amount = hash['discountAmount']
  end
  if hash.has_key? 'lineItemId'
    @line_item_id = hash['lineItemId']
  end
  if hash.has_key? 'quantity'
    @quantity = hash['quantity']
  end
  if hash.has_key? 'taxAmount'
    @tax_amount = hash['taxAmount']
  end
end

#to_hHash

Returns:

  • (Hash)


24
25
26
27
28
29
30
31
# File 'lib/onlinepayments/sdk/domain/line_item_detail.rb', line 24

def to_h
  hash = super
  hash['discountAmount'] = @discount_amount unless @discount_amount.nil?
  hash['lineItemId'] = @line_item_id unless @line_item_id.nil?
  hash['quantity'] = @quantity unless @quantity.nil?
  hash['taxAmount'] = @tax_amount unless @tax_amount.nil?
  hash
end