Module: StripeLocal::SyncPlans

Extended by:
ActiveSupport::Concern
Included in:
Plan
Defined in:
app/mixins/stripe_local/sync_plans.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#api_destroy(plan) ⇒ Object



34
35
36
# File 'app/mixins/stripe_local/sync_plans.rb', line 34

def api_destroy plan
  Plan.destroy
end

#synchronize_createObject



20
21
22
23
24
25
# File 'app/mixins/stripe_local/sync_plans.rb', line 20

def synchronize_create
  hash = self.attributes
  unless !!hash.delete( :synced )
    Stripe::Plan.create hash #TODO: handle asynchronously
  end
end

#synchronize_destroy(id) ⇒ Object



27
28
29
30
31
32
# File 'app/mixins/stripe_local/sync_plans.rb', line 27

def synchronize_destroy id
  begin
    Stripe::Plan.delete id
  rescue Stripe::Error
  end
end