class AuthorizeNet::ARB::Subscription

Models an ARB subscription.

Constants

UNLIMITED_OCCURRENCES

Use this constant for the value of total_occurrences to get a subscription with no end.

Attributes

amount[RW]
billing_address[RW]
credit_card[RW]
customer[RW]
description[RW]
invoice_number[RW]
length[RW]
name[RW]
shipping_address[RW]
start_date[RW]
subscription_id[RW]
total_occurrences[RW]
trial_amount[RW]
trial_occurrences[RW]
unit[RW]

Public Instance Methods

to_hash() click to toggle source
# File lib/authorize_net/arb/subscription.rb, line 49
def to_hash
  hash = {
    :subscription_name => @name,
    :subscription_length => @length,
    :subscription_unit => @unit,
    :subscription_start_date => @start_date,
    :subscription_total_occurrences => @total_occurrences,
    :subscription_trial_occurrences => @trial_occurrences,
    :subscription_amount => @amount,
    :subscription_trial_amount => @trial_amount,
    :invoice_num => @invoice_number,
    :description => @description,
    :subscription_id => @subscription_id
  }
  hash.merge!(@credit_card.to_hash) unless @credit_card.nil?
  hash.merge!(@billing_address.to_hash) unless @billing_address.nil?
  hash.merge!(@shipping_address.to_hash) unless @shipping_address.nil?
  hash.merge!(@customer.to_hash) unless @customer.nil?
  hash.delete_if {|k, v| v.nil?}
end