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



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

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



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

def line_item_id
  @line_item_id
end

#quantityInteger

Returns the current value of quantity.

Returns:

  • (Integer)

    the current value of quantity



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

def quantity
  @quantity
end

Instance Method Details

#from_hash(hash) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/onlinepayments/sdk/domain/line_item_detail.rb', line 29

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
end

#to_hHash

Returns:

  • (Hash)


21
22
23
24
25
26
27
# File 'lib/onlinepayments/sdk/domain/line_item_detail.rb', line 21

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
end