Class: RubyPsigate::RecurringCharge
- Inherits:
-
Object
- Object
- RubyPsigate::RecurringCharge
- Includes:
- HashVariables
- Defined in:
- lib/ruby_psigate/recurring_charge.rb
Overview
This class encapsulates the recurring charge elements for use in the Account Class
Instance Attribute Summary collapse
-
#endtime ⇒ Object
Returns the value of attribute endtime.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#processtype ⇒ Object
Returns the value of attribute processtype.
-
#rbcid ⇒ Object
Returns the value of attribute rbcid.
-
#rbname ⇒ Object
Returns the value of attribute rbname.
-
#rbtrigger ⇒ Object
Returns the value of attribute rbtrigger.
-
#starttime ⇒ Object
Returns the value of attribute starttime.
-
#status ⇒ Object
Returns the value of attribute status.
-
#storeid ⇒ Object
Returns the value of attribute storeid.
Instance Method Summary collapse
- #<<(item) ⇒ Object
-
#initialize(attributes = {}) ⇒ RecurringCharge
constructor
A new instance of RecurringCharge.
- #items ⇒ Object
- #to_hash ⇒ Object
Methods included from HashVariables
Constructor Details
#initialize(attributes = {}) ⇒ RecurringCharge
Returns a new instance of RecurringCharge.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 13 def initialize(attributes = {}) @storeid = attributes[:storeid] @rbcid = attributes[:rbcid] @rbname = attributes[:rbname] @interval = attributes[:interval] @rbtrigger = attributes[:rbtrigger] @status = attributes[:status] @starttime = attributes[:starttime] @endtime = attributes[:endtime] @processtype = attributes[:processtype] @items = [] end |
Instance Attribute Details
#endtime ⇒ Object
Returns the value of attribute endtime.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def endtime @endtime end |
#interval ⇒ Object
Returns the value of attribute interval.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def interval @interval end |
#processtype ⇒ Object
Returns the value of attribute processtype.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def processtype @processtype end |
#rbcid ⇒ Object
Returns the value of attribute rbcid.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def rbcid @rbcid end |
#rbname ⇒ Object
Returns the value of attribute rbname.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def rbname @rbname end |
#rbtrigger ⇒ Object
Returns the value of attribute rbtrigger.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def rbtrigger @rbtrigger end |
#starttime ⇒ Object
Returns the value of attribute starttime.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def starttime @starttime end |
#status ⇒ Object
Returns the value of attribute status.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def status @status end |
#storeid ⇒ Object
Returns the value of attribute storeid.
11 12 13 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 11 def storeid @storeid end |
Instance Method Details
#<<(item) ⇒ Object
39 40 41 42 43 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 39 def << (item) raise InvalidRecurringItem unless item.is_a?(RecurringItem) @items << item return self end |
#items ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 45 def items holder = [] @items.each do |item| holder << item.to_hash end holder end |
#to_hash ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby_psigate/recurring_charge.rb', line 26 def to_hash @return_hash = super unless items.count == 0 @return_hash[:ItemInfo] = [] items.each do |item| @return_hash[:ItemInfo] << item.to_hash end end @return_hash = @return_hash.delete_if { |key, value| value.nil? } # Delete empty hash values @return_hash end |