Class: AuthorizeNet::ARB::Subscription

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/authorize_net/arb/subscription.rb

Overview

Models an ARB subscription.

Defined Under Namespace

Modules: IntervalUnits, Status

Constant Summary collapse

UNLIMITED_OCCURRENCES =

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

9999

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Model

#initialize, #to_a

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def amount
  @amount
end

#billing_addressObject

Returns the value of attribute billing_address.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def billing_address
  @billing_address
end

#credit_cardObject

Returns the value of attribute credit_card.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def credit_card
  @credit_card
end

#customerObject

Returns the value of attribute customer.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def customer
  @customer
end

#descriptionObject

Returns the value of attribute description.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def description
  @description
end

#invoice_numberObject

Returns the value of attribute invoice_number.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def invoice_number
  @invoice_number
end

#lengthObject

Returns the value of attribute length.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def length
  @length
end

#nameObject

Returns the value of attribute name.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def name
  @name
end

#shipping_addressObject

Returns the value of attribute shipping_address.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def shipping_address
  @shipping_address
end

#start_dateObject

Returns the value of attribute start_date.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def start_date
  @start_date
end

#subscription_idObject

Returns the value of attribute subscription_id.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def subscription_id
  @subscription_id
end

#total_occurrencesObject

Returns the value of attribute total_occurrences.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def total_occurrences
  @total_occurrences
end

#trial_amountObject

Returns the value of attribute trial_amount.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def trial_amount
  @trial_amount
end

#trial_occurrencesObject

Returns the value of attribute trial_occurrences.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def trial_occurrences
  @trial_occurrences
end

#unitObject

Returns the value of attribute unit.



26
27
28
# File 'lib/authorize_net/arb/subscription.rb', line 26

def unit
  @unit
end

Instance Method Details

#to_hashObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 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