forked from stripe-ruby-mock/stripe-ruby-mock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock.rb
31 lines (27 loc) · 904 Bytes
/
mock.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module StripeMock
module TestStrategies
class Mock < Base
def delete_product(product_id)
if StripeMock.state == 'remote'
StripeMock.client.destroy_resource('products', product_id)
elsif StripeMock.state == 'local'
StripeMock.instance.products.delete(product_id)
end
end
def delete_plan(plan_id)
if StripeMock.state == 'remote'
StripeMock.client.destroy_resource('plans', plan_id)
elsif StripeMock.state == 'local'
StripeMock.instance.plans.delete(plan_id)
end
end
def upsert_stripe_object(object, attributes = {})
if StripeMock.state == 'remote'
StripeMock.client.upsert_stripe_object(object, attributes)
elsif StripeMock.state == 'local'
StripeMock.instance.upsert_stripe_object(object, attributes)
end
end
end
end
end