Sha256: 650b14d4061226a675924094b0484c71baa5b024d7201ff635bc916b248961e4
Contents?: true
Size: 979 Bytes
Versions: 5
Compression:
Stored size: 979 Bytes
Contents
class StripeSku < StripeModelCallbacks::ApplicationRecord monetize :price_cents def self.stripe_class Stripe::SKU end def assign_from_stripe(object) check_object_is_stripe_class(object) assign_base_attributes(object) StripeModelCallbacks::AttributesAssignerService.execute!( model: self, stripe_model: object, attributes: %w[currency] ) end private def assign_base_attributes(object) assign_attributes( active: object.active == true, created: Time.zone.at(object.created), updated: Time.zone.at(object.updated), stripe_attributes: JSON.generate(object.attributes), inventory_quantity: object.inventory.quantity, inventory_type: object.inventory.type, inventory_value: object.inventory.value, livemode: object.livemode, metadata: JSON.generate(object.metadata), price: Money.new(object.price, object.currency), stripe_product_id: object.product ) end end
Version data entries
5 entries across 5 versions & 1 rubygems