Class: Saaz::Customer
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Saaz::Customer
- Includes:
- StripeObject
- Defined in:
- app/models/saaz/customer.rb
Instance Attribute Summary collapse
-
#stripe_description ⇒ Object
Returns the value of attribute stripe_description.
-
#stripe_token ⇒ Object
Returns the value of attribute stripe_token.
Instance Method Summary collapse
- #default_card_string ⇒ Object
- #set_customers_on_subscription ⇒ Object
- #to_stripe ⇒ Object
- #to_stripe_uncached ⇒ Object
Methods included from StripeObject
#delegate_all_to_stripe, #delegate_getter, #delegate_setter, #delegate_to_stripe, #method_missing, #stripe_dirty, #update_stripe
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Saaz::StripeObject
Instance Attribute Details
#stripe_description ⇒ Object
Returns the value of attribute stripe_description.
4 5 6 |
# File 'app/models/saaz/customer.rb', line 4 def stripe_description @stripe_description end |
#stripe_token ⇒ Object
Returns the value of attribute stripe_token.
4 5 6 |
# File 'app/models/saaz/customer.rb', line 4 def stripe_token @stripe_token end |
Instance Method Details
#default_card_string ⇒ Object
30 31 32 33 |
# File 'app/models/saaz/customer.rb', line 30 def default_card_string card = self.cards.retrieve(self.default_card) "#{card.brand} ending in #{card.last4}" end |
#set_customers_on_subscription ⇒ Object
24 25 26 27 28 |
# File 'app/models/saaz/customer.rb', line 24 def set_customers_on_subscription subscriptions.each do |sub| sub.customer = self.becomes(Saaz::Customer) end end |
#to_stripe ⇒ Object
14 15 16 |
# File 'app/models/saaz/customer.rb', line 14 def to_stripe @stripe_instance ||= to_stripe_uncached end |
#to_stripe_uncached ⇒ Object
18 19 20 21 22 |
# File 'app/models/saaz/customer.rb', line 18 def to_stripe_uncached retval = Stripe::Customer.retrieve(stripe_id) delegate_all_to_stripe(retval) retval end |