Sha256: 6a4b31bf28492217d97fa5c729397af80ddf29cb9127382c22f593588960c679
Contents?: true
Size: 726 Bytes
Versions: 5
Compression:
Stored size: 726 Bytes
Contents
class StripeCoupon < StripeModelCallbacks::ApplicationRecord has_many :stripe_discounts, primary_key: "stripe_id" monetize :amount_off_cents, allow_nil: true def self.stripe_class Stripe::Coupon end 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 end
Version data entries
5 entries across 5 versions & 1 rubygems