Class: StripeLocal::PlanSync
- Inherits:
-
Object
- Object
- StripeLocal::PlanSync
- Defined in:
- app/callbacks/stripe_local/plan_sync.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.then_destroy(id) ⇒ Object
10 11 12 |
# File 'app/callbacks/stripe_local/plan_sync.rb', line 10 def then_destroy id Stripe::Plan.retrieve( id ).delete end |
.then_sync(from_hash) ⇒ Object
6 7 8 |
# File 'app/callbacks/stripe_local/plan_sync.rb', line 6 def then_sync from_hash Stripe::Plan.create from_hash end |
Instance Method Details
#after_create(plan) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/callbacks/stripe_local/plan_sync.rb', line 15 def after_create plan attributes = { id: plan.id, name: plan.name, amount: plan.amount, currency: 'usd', interval: plan.interval, interval_count: plan.interval_count, trial_period_days: 0 } PlanSync.delay.then_sync attributes end |
#after_destroy(plan) ⇒ Object
28 29 30 |
# File 'app/callbacks/stripe_local/plan_sync.rb', line 28 def after_destroy plan PlanSync.delay.then_destroy plan.id end |