Class: Mousetrap::Subscription
- Defined in:
- lib/mousetrap/subscription.rb
Instance Attribute Summary collapse
-
#billing_first_name ⇒ Object
Attributes we send to the API.
-
#billing_last_name ⇒ Object
Attributes we send to the API.
-
#billing_zip_code ⇒ Object
Attributes we send to the API.
-
#canceled_at ⇒ Object
readonly
Attributes that come from the API.
-
#created_at ⇒ Object
readonly
Attributes that come from the API.
-
#credit_card_expiration_date ⇒ Object
readonly
Attributes that come from the API.
-
#credit_card_expiration_month ⇒ Object
Attributes we send to the API.
-
#credit_card_expiration_year ⇒ Object
Attributes we send to the API.
-
#credit_card_last_four_digits ⇒ Object
readonly
Attributes that come from the API.
-
#credit_card_number ⇒ Object
Attributes we send to the API.
-
#credit_card_type ⇒ Object
readonly
Attributes that come from the API.
-
#customer_code ⇒ Object
Attributes we send to the API.
-
#id ⇒ Object
readonly
Attributes that come from the API.
-
#plan_code ⇒ Object
Attributes we send to the API.
Instance Method Summary collapse
-
#attributes ⇒ Object
TODO: not sure if .all or .[] will work.
- #attributes_for_api ⇒ Object
- #destroy ⇒ Object
- #save ⇒ Object
Methods inherited from Resource
[], create, delete, destroy_all, exists?, #exists?, #initialize, #new?, new_from_api
Constructor Details
This class inherits a constructor from Mousetrap::Resource
Instance Attribute Details
#billing_first_name ⇒ Object
Attributes we send to the API.
4 5 6 |
# File 'lib/mousetrap/subscription.rb', line 4 def billing_first_name @billing_first_name end |
#billing_last_name ⇒ Object
Attributes we send to the API.
4 5 6 |
# File 'lib/mousetrap/subscription.rb', line 4 def billing_last_name @billing_last_name end |
#billing_zip_code ⇒ Object
Attributes we send to the API.
4 5 6 |
# File 'lib/mousetrap/subscription.rb', line 4 def billing_zip_code @billing_zip_code end |
#canceled_at ⇒ Object
Attributes that come from the API.
16 17 18 |
# File 'lib/mousetrap/subscription.rb', line 16 def canceled_at @canceled_at end |
#created_at ⇒ Object
Attributes that come from the API.
16 17 18 |
# File 'lib/mousetrap/subscription.rb', line 16 def created_at @created_at end |
#credit_card_expiration_date ⇒ Object
Attributes that come from the API.
16 17 18 |
# File 'lib/mousetrap/subscription.rb', line 16 def credit_card_expiration_date @credit_card_expiration_date end |
#credit_card_expiration_month ⇒ Object
Attributes we send to the API.
4 5 6 |
# File 'lib/mousetrap/subscription.rb', line 4 def credit_card_expiration_month @credit_card_expiration_month end |
#credit_card_expiration_year ⇒ Object
Attributes we send to the API.
4 5 6 |
# File 'lib/mousetrap/subscription.rb', line 4 def credit_card_expiration_year @credit_card_expiration_year end |
#credit_card_last_four_digits ⇒ Object
Attributes that come from the API.
16 17 18 |
# File 'lib/mousetrap/subscription.rb', line 16 def credit_card_last_four_digits @credit_card_last_four_digits end |
#credit_card_number ⇒ Object
Attributes we send to the API.
4 5 6 |
# File 'lib/mousetrap/subscription.rb', line 4 def credit_card_number @credit_card_number end |
#credit_card_type ⇒ Object
Attributes that come from the API.
16 17 18 |
# File 'lib/mousetrap/subscription.rb', line 16 def credit_card_type @credit_card_type end |
#customer_code ⇒ Object
Attributes we send to the API.
4 5 6 |
# File 'lib/mousetrap/subscription.rb', line 4 def customer_code @customer_code end |
#id ⇒ Object
Attributes that come from the API.
16 17 18 |
# File 'lib/mousetrap/subscription.rb', line 16 def id @id end |
#plan_code ⇒ Object
Attributes we send to the API.
4 5 6 |
# File 'lib/mousetrap/subscription.rb', line 4 def plan_code @plan_code end |
Instance Method Details
#attributes ⇒ Object
TODO: not sure if .all or .[] will work
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/mousetrap/subscription.rb', line 26 def attributes { :id => id, :plan_code => plan_code, :billing_first_name => billing_first_name, :billing_last_name => billing_last_name, :credit_card_number => credit_card_number, :credit_card_expiration_month => credit_card_expiration_month, :credit_card_expiration_year => credit_card_expiration_year, :billing_zip_code => billing_zip_code, } end |
#attributes_for_api ⇒ Object
39 40 41 |
# File 'lib/mousetrap/subscription.rb', line 39 def attributes_for_api self.class.attributes_for_api(attributes) end |
#destroy ⇒ Object
43 44 45 |
# File 'lib/mousetrap/subscription.rb', line 43 def destroy raise NotImplementedError, API_UNSUPPORTED end |
#save ⇒ Object
47 48 49 50 |
# File 'lib/mousetrap/subscription.rb', line 47 def save mutated_attributes = attributes_for_api(attributes) self.class.put_resource('customers', 'edit-subscription', customer_code, mutated_attributes) end |