Class: Paypal::Payment::Recurring
- Defined in:
- lib/paypal/payment/recurring.rb
Defined Under Namespace
Classes: Activation, Billing, Summary
Constant Summary collapse
- MANDATORY_PARAMETERS =
[:DESC, :PROFILESTARTDATE, :BILLINGPERIOD, :BILLINGFREQUENCY, :AMT, :CURRENCYCODE].freeze
Instance Attribute Summary collapse
-
#activation ⇒ Object
Returns the value of attribute activation.
-
#billing ⇒ Object
Returns the value of attribute billing.
-
#regular_billing ⇒ Object
Returns the value of attribute regular_billing.
-
#summary ⇒ Object
Returns the value of attribute summary.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Recurring
constructor
A new instance of Recurring.
- #numeric_attribute?(key) ⇒ Boolean
- #to_params ⇒ Object
Methods included from Util
#==, formatted_amount, to_numeric
Constructor Details
#initialize(attributes = {}) ⇒ Recurring
Returns a new instance of Recurring.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/paypal/payment/recurring.rb', line 9 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] @raw_parameters = attributes[:raw].presence || {} @parameters = build_parameters_hash # can not make this happen as profile object is used both in cretion, response verification and status checks, which vary in available parameters # makes sure key params have been passed one way or the other # missing_mandatory_parameters = MANDATORY_PARAMETERS.map{|param| @parameters[param].present? ? nil : param}.compact # raise ArgumentError.new("Missing mandatory parameters #{missing_mandatory_parameters.to_s}") if missing_mandatory_parameters.any? end |
Instance Attribute Details
#activation ⇒ Object
Returns the value of attribute activation.
5 6 7 |
# File 'lib/paypal/payment/recurring.rb', line 5 def activation @activation end |
#billing ⇒ Object
Returns the value of attribute billing.
5 6 7 |
# File 'lib/paypal/payment/recurring.rb', line 5 def billing @billing end |
#regular_billing ⇒ Object
Returns the value of attribute regular_billing.
5 6 7 |
# File 'lib/paypal/payment/recurring.rb', line 5 def regular_billing @regular_billing end |
#summary ⇒ Object
Returns the value of attribute summary.
5 6 7 |
# File 'lib/paypal/payment/recurring.rb', line 5 def summary @summary end |
Instance Method Details
#numeric_attribute?(key) ⇒ Boolean
28 29 30 |
# File 'lib/paypal/payment/recurring.rb', line 28 def numeric_attribute?(key) super || [:max_fails, :failed_count].include?(key) end |
#to_params ⇒ Object
24 25 26 |
# File 'lib/paypal/payment/recurring.rb', line 24 def to_params return @parameters end |