class StripeMock::TestStrategies::Live

Public Instance Methods

create_coupon(params={}) click to toggle source
# File lib/stripe_mock/test_strategies/live.rb, line 20
def create_coupon(params={})
  delete_coupon create_coupon_params(params)[:id]
  super
end
create_plan(params={}) click to toggle source
# File lib/stripe_mock/test_strategies/live.rb, line 5
def create_plan(params={})
  raise "create_plan requires an :id" if params[:id].nil?
  delete_plan(params[:id])
  Stripe::Plan.create create_plan_params(params)
end
delete_coupon(id) click to toggle source
# File lib/stripe_mock/test_strategies/live.rb, line 25
def delete_coupon(id)
  begin
    coupon = Stripe::Coupon.retrieve(id)
    coupon.delete
  rescue Stripe::StripeError
    # do nothing
  end
end
delete_plan(plan_id) click to toggle source
# File lib/stripe_mock/test_strategies/live.rb, line 11
def delete_plan(plan_id)
  begin
    plan = Stripe::Plan.retrieve(plan_id)
    plan.delete
  rescue Stripe::StripeError => e
    # Do nothing; we just want to make sure this plan ceases to exists
  end
end
upsert_stripe_object(object, attributes) click to toggle source
# File lib/stripe_mock/test_strategies/live.rb, line 34
def upsert_stripe_object(object, attributes)
  raise UnsupportedRequestError.new "Updating or inserting Stripe objects in Live mode not supported"
end