Class: Saaz::Customer

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
StripeObject
Defined in:
app/models/saaz/customer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_descriptionObject

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_tokenObject

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_stringObject



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_subscriptionObject



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_stripeObject



14
15
16
# File 'app/models/saaz/customer.rb', line 14

def to_stripe
  @stripe_instance ||= to_stripe_uncached
end

#to_stripe_uncachedObject



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