Class: RubyPsigate::RecurringItem

Inherits:
Object
  • Object
show all
Includes:
HashVariables
Defined in:
lib/ruby_psigate/recurring_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashVariables

included

Constructor Details

#initialize(attributes = {}) ⇒ RecurringItem

Returns a new instance of RecurringItem.



10
11
12
13
14
15
16
17
# File 'lib/ruby_psigate/recurring_item.rb', line 10

def initialize(attributes = {})
  @product_id = attributes[:product_id]
  @description = attributes[:description]
  @quantity = attributes[:quantity]
  @price = attributes[:price]
  @tax1 = attributes[:tax1]
  @tax2 = attributes[:tax2]
end

Instance Attribute Details

#costObject

Returns the value of attribute cost.



7
8
9
# File 'lib/ruby_psigate/recurring_item.rb', line 7

def cost
  @cost
end

#descriptionObject

Returns the value of attribute description.



7
8
9
# File 'lib/ruby_psigate/recurring_item.rb', line 7

def description
  @description
end

#priceObject

Returns the value of attribute price.



7
8
9
# File 'lib/ruby_psigate/recurring_item.rb', line 7

def price
  @price
end

#product_idObject Also known as: productid

Returns the value of attribute product_id.



7
8
9
# File 'lib/ruby_psigate/recurring_item.rb', line 7

def product_id
  @product_id
end

#quantityObject

Returns the value of attribute quantity.



7
8
9
# File 'lib/ruby_psigate/recurring_item.rb', line 7

def quantity
  @quantity
end

#tax1Object

Returns the value of attribute tax1.



7
8
9
# File 'lib/ruby_psigate/recurring_item.rb', line 7

def tax1
  @tax1
end

#tax2Object

Returns the value of attribute tax2.



7
8
9
# File 'lib/ruby_psigate/recurring_item.rb', line 7

def tax2
  @tax2
end

Instance Method Details

#to_hashObject



19
20
21
22
23
# File 'lib/ruby_psigate/recurring_item.rb', line 19

def to_hash
  result = super
  result = result.delete_if { |key, value| value.nil? }  # Delete empty hash values
  result
end