forked from stripe-ruby-mock/stripe-ruby-mock
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmock.rb
27 lines (23 loc) · 734 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
module StripeMock
module TestStrategies
class Mock < Base
def create_plan(params={})
Stripe::Plan.create create_plan_params(params)
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