class Paypal::Payment::Recurring

Attributes

activation[RW]
billing[RW]
regular_billing[RW]
summary[RW]

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method Paypal::Base::new
# 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

Public Instance Methods

numeric_attribute?(key) click to toggle source
Calls superclass method
# File lib/paypal/payment/recurring.rb, line 38
def numeric_attribute?(key)
  super || [:max_fails, :failed_count].include?(key)
end
to_params() click to toggle source
# 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