Class: StripePrice
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
4
5
6
|
# File 'lib/stripe_model_callbacks/models/stripe_price.rb', line 4
def self.stripe_class
Stripe::Price
end
|
Instance Method Details
#assign_from_stripe(object) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/stripe_model_callbacks/models/stripe_price.rb', line 8
def assign_from_stripe(object)
check_object_is_stripe_class(object)
assign_attributes(
stripe_id: object.id,
stripe_product_id: object.product,
recurring_aggregate_usage: object.recurring&.aggregate_usage,
recurring_interval: object.recurring&.interval,
recurring_interval_count: object.recurring&.interval_count,
recurring_usage_type: object.recurring&.usage_type,
transform_quantity_divide_by: object.transform_quantity&.divide_by,
transform_quantity_round: object.transform_quantity&.round
)
StripeModelCallbacks::AttributesAssignerService.execute!(
model: self, stripe_model: object,
attributes: %w[
active billing_scheme created currency lookup_key metadata nickname tiers_mode unit_amount
]
)
end
|