Class: StripeCustomer
Instance Attribute Summary
#stripe_object
Class Method Summary
collapse
Instance Method Summary
collapse
check_object_is_stripe_class, #check_object_is_stripe_class, create_from_stripe!, create_on_stripe!, #destroy_on_stripe, #destroy_on_stripe!, #reload!, #reload_from_stripe!, #to_stripe, #update_on_stripe, #update_on_stripe!
Class Method Details
.stripe_class ⇒ Object
11
12
13
|
# File 'lib/stripe_model_callbacks/models/stripe_customer.rb', line 11
def self.stripe_class
Stripe::Customer
end
|
Instance Method Details
#assign_from_stripe(object) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/stripe_model_callbacks/models/stripe_customer.rb', line 15
def assign_from_stripe(object)
check_object_is_stripe_class(object)
if object.respond_to?(:account_balance)
self.balance = object.account_balance
elsif object.respond_to?(:balance)
self.balance = object.balance
else
Rails.logger.error "Couldn't figure out where to get the customers balance from"
end
StripeModelCallbacks::AttributesAssignerService.execute!(
model: self, stripe_model: object,
attributes: %w[
currency created default_source delinquent description discount email
id livemode metadata
]
)
end
|