Sha256: 6d7554bcaa7f8029eb91a402d00d01c6bc57dfeadfd7b94bb6c1d57c65fe116a
Contents?: true
Size: 876 Bytes
Versions: 1
Compression:
Stored size: 876 Bytes
Contents
module StripeLocal class Plan < ActiveRecord::Base include SyncPlans self.primary_key = :id has_many :subscriptions, inverse_of: :plan class<<self def create object if found = find_by( id: object[:id] ) found.update_attributes synced: true else super normalize object end end def normalize attrs attrs.each_with_object({}) do |(k,v),h| key = case k.to_sym when :livemode then h[:synced] = true and next when ->(x){ attribute_method? x } then k.to_sym else next end h[key] = v end end end #=!=#>>> # string :id # string :name # integer :amount # string :interval # integer :interval_count # integer :trial_period_days # string :currency # boolean :synced #=ยก=#>>> end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stripe_local-0.0.2 | app/models/stripe_local/plan.rb |