Class: Paypal::Payment::Recurring
- Inherits:
-
Base
- Object
- Base
- Paypal::Payment::Recurring
- Defined in:
- lib/paypal/payment/recurring.rb
Defined Under Namespace
Classes: Activation, Billing, Summary
Instance Attribute Summary (collapse)
-
- (Object) activation
Returns the value of attribute activation.
-
- (Object) billing
Returns the value of attribute billing.
-
- (Object) regular_billing
Returns the value of attribute regular_billing.
-
- (Object) summary
Returns the value of attribute summary.
Instance Method Summary (collapse)
-
- (Recurring) initialize(attributes = {})
constructor
A new instance of Recurring.
- - (Boolean) numeric_attribute?(key)
- - (Object) to_params
Methods included from Util
#==, formatted_amount, to_numeric
Constructor Details
- (Recurring) initialize(attributes = {})
A new instance of Recurring
7 8 9 10 11 12 13 |
# File 'lib/paypal/payment/recurring.rb', line 7 def initialize(attributes = {}) super @activation = Activation.new attributes[:activation] if attributes[:activation] @billing = Billing.new attributes[:billing] if attributes[:billing] @regular_billing = Billing.new attributes[:regular_billing] if attributes[:regular_billing] @summary = Summary.new attributes[:summary] if attributes[:summary] end |
Instance Attribute Details
- (Object) activation
Returns the value of attribute activation
5 6 7 |
# File 'lib/paypal/payment/recurring.rb', line 5 def activation @activation end |
- (Object) billing
Returns the value of attribute billing
5 6 7 |
# File 'lib/paypal/payment/recurring.rb', line 5 def billing @billing end |
- (Object) regular_billing
Returns the value of attribute regular_billing
5 6 7 |
# File 'lib/paypal/payment/recurring.rb', line 5 def regular_billing @regular_billing end |
- (Object) summary
Returns the value of attribute summary
5 6 7 |
# File 'lib/paypal/payment/recurring.rb', line 5 def summary @summary end |
Instance Method Details
- (Boolean) numeric_attribute?(key)
38 39 40 |
# File 'lib/paypal/payment/recurring.rb', line 38 def numeric_attribute?(key) super || [:max_fails, :failed_count].include?(key) end |
- (Object) to_params
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/paypal/payment/recurring.rb', line 15 def to_params params = [ self.billing, self.activation ].compact.inject({}) do |params, attribute| params.merge! attribute.to_params end if self.start_date.is_a?(Time) self.start_date = self.start_date.to_s(:db) end params.merge!( :DESC => self.description, :MAXFAILEDPAYMENTS => self.max_fails, :AUTOBILLOUTAMT => self.auto_bill, :PROFILESTARTDATE => self.start_date, :SUBSCRIBERNAME => self.name, :PROFILEREFERENCE => self.reference ) params.delete_if do |k, v| v.blank? end end |