Class: StripeMock::TestStrategies::Live
- Inherits:
-
Base
- Object
- Base
- StripeMock::TestStrategies::Live
show all
- Defined in:
- lib/stripe_mock/test_strategies/live.rb
Instance Method Summary
collapse
Methods inherited from Base
#complete_checkout_session, #create_checkout_session, #create_checkout_session_params, #create_coupon_params, #create_coupon_percent_of_params, #create_plan_params, #create_price, #create_price_params, #create_product_params, #delete_all_coupons, #generate_bank_token, #generate_card_token, #list_plans, #list_products, #list_subscriptions, #prepare_card_error, #retrieve_product
Instance Method Details
#create_coupon(params = {}) ⇒ Object
33
34
35
36
|
# File 'lib/stripe_mock/test_strategies/live.rb', line 33
def create_coupon(params={})
delete_coupon create_coupon_params(params)[:id]
super
end
|
#create_plan(params = {}) ⇒ Object
20
21
22
23
24
|
# File 'lib/stripe_mock/test_strategies/live.rb', line 20
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
|
#create_product(params = {}) ⇒ Object
5
6
7
8
9
10
|
# File 'lib/stripe_mock/test_strategies/live.rb', line 5
def create_product(params={})
params = create_product_params(params)
raise "create_product requires an :id" if params[:id].nil?
delete_product(params[:id])
Stripe::Product.create params
end
|
#delete_coupon(id) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/stripe_mock/test_strategies/live.rb', line 38
def delete_coupon(id)
coupon = Stripe::Coupon.retrieve(id)
coupon.delete
rescue Stripe::StripeError
end
|
#delete_plan(plan_id) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/stripe_mock/test_strategies/live.rb', line 26
def delete_plan(plan_id)
plan = Stripe::Plan.retrieve(plan_id)
plan.delete
rescue Stripe::StripeError => e
end
|
#delete_product(product_id) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/stripe_mock/test_strategies/live.rb', line 12
def delete_product(product_id)
product = Stripe::Product.retrieve(product_id)
Stripe::Plan.list(product: product_id).each(&:delete) if product.type == 'service'
product.delete
rescue Stripe::StripeError => e
end
|
#upsert_stripe_object(object, attributes) ⇒ Object
45
46
47
|
# File 'lib/stripe_mock/test_strategies/live.rb', line 45
def upsert_stripe_object(object, attributes)
raise UnsupportedRequestError.new "Updating or inserting Stripe objects in Live mode not supported"
end
|