10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/stripe_model_callbacks/models/stripe_coupon.rb', line 10
def assign_from_stripe(object)
check_object_is_stripe_class(object)
assign_attributes(
amount_off: object.amount_off ? Money.new(object.amount_off, object.currency) : nil,
stripe_valid: object.valid
)
StripeModelCallbacks::AttributesAssignerService.execute!(
model: self, stripe_model: object,
attributes: %w[
currency created duration duration_in_months id livemode max_redemptions metadata
percent_off redeem_by times_redeemed
]
)
end
|