Class: Ashmont::SubscribedCustomer
- Extended by:
- Forwardable
- Defined in:
- lib/ashmont/subscribed_customer.rb
Constant Summary collapse
- CUSTOMER_ATTRIBUTES =
[:cardholder_name, :email, :number, :expiration_month, :expiration_year, :cvv, :street_address, :extended_address, :locality, :region, :postal_code, :country_name]
Constants inherited from Customer
Customer::ADDRESS_ATTRIBUTES, Customer::BILLING_ATTRIBUTES, Customer::CREDIT_CARD_ATTRIBUTES
Instance Attribute Summary
Attributes inherited from Customer
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(customer, subscription) ⇒ SubscribedCustomer
constructor
A new instance of SubscribedCustomer.
- #save(attributes) ⇒ Object
- #subscription_token ⇒ Object
Methods inherited from Customer
#billing_email, #cardholder_name, #confirm, #country_name, #credit_card, #credit_cards, #delete, #expiration_month, #expiration_year, #extended_address, #has_billing_info?, #last_4, #locality, #payment_method_token, #paypal_account, #paypal_accounts, #postal_code, #primary_payment_account, #primary_payment_method, #region, #street_address
Constructor Details
#initialize(customer, subscription) ⇒ SubscribedCustomer
Returns a new instance of SubscribedCustomer.
13 14 15 16 17 |
# File 'lib/ashmont/subscribed_customer.rb', line 13 def initialize(customer, subscription) super(customer) @customer = customer @subscription = subscription end |
Instance Method Details
#errors ⇒ Object
30 31 32 |
# File 'lib/ashmont/subscribed_customer.rb', line 30 def errors super.to_hash.merge(@subscription.errors.to_hash) end |
#save(attributes) ⇒ Object
26 27 28 |
# File 'lib/ashmont/subscribed_customer.rb', line 26 def save(attributes) apply_customer_changes(attributes) && ensure_subscription_active && apply_subscription_changes(attributes) end |
#subscription_token ⇒ Object
22 23 24 |
# File 'lib/ashmont/subscribed_customer.rb', line 22 def subscription_token @subscription.token end |