fake_stripe 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fake_stripe.rb +12 -24
- data/lib/fake_stripe/stub_app.rb +9 -0
- data/lib/fake_stripe/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08e95a4cddf4f2ad7dc6e8764c75cc7280f23f5b
|
4
|
+
data.tar.gz: 76e6d95ba8cf2acc1f854f1a14a4dbb0d688bb5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b096557043a584130d61e84960f868d32ce758f10624a1650b00720ea5cbf9de1367efc3d5cbbe55685b6e3d378b135eb44297b84de3bdf2bbacf06a221cac05
|
7
|
+
data.tar.gz: 876629c56a9314d49fc665b3bd1fda1292b88c68fcd9228494ed4aadbd015ded62219ddc98882e85f2bb87bcdcf232afc2c44b7f25778d0439520f0a55eff49e
|
data/lib/fake_stripe.rb
CHANGED
@@ -7,35 +7,23 @@ module FakeStripe
|
|
7
7
|
extend Configuration
|
8
8
|
|
9
9
|
VALID_CARD_NUMBER = '4242424242424242'
|
10
|
+
STRIPE_OBJECTS = %w{card charge coupon customer invoice invoiceitem plan
|
11
|
+
recipient refund subscription token transfer}.freeze
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def self.charge_count=(charge_count)
|
16
|
-
@@charge_count = charge_count
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.refund_count
|
20
|
-
@@refund_count
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.refund_count=(refund_count)
|
24
|
-
@@refund_count = refund_count
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.customer_count
|
28
|
-
@@customer_count
|
29
|
-
end
|
13
|
+
STRIPE_OBJECTS.each do |object|
|
14
|
+
define_singleton_method "#{object}_count" do
|
15
|
+
instance_variable_get("@#{object}_count")
|
16
|
+
end
|
30
17
|
|
31
|
-
|
32
|
-
|
18
|
+
define_singleton_method "#{object}_count=" do |count|
|
19
|
+
instance_variable_set("@#{object}_count", count)
|
20
|
+
end
|
33
21
|
end
|
34
22
|
|
35
23
|
def self.reset
|
36
|
-
|
37
|
-
|
38
|
-
|
24
|
+
STRIPE_OBJECTS.each do |object|
|
25
|
+
instance_variable_set("@#{object}_count", 0)
|
26
|
+
end
|
39
27
|
end
|
40
28
|
|
41
29
|
def self.stub_stripe
|
data/lib/fake_stripe/stub_app.rb
CHANGED
@@ -54,6 +54,7 @@ module FakeStripe
|
|
54
54
|
|
55
55
|
# Cards
|
56
56
|
post '/v1/customers/:customer_id/cards' do
|
57
|
+
FakeStripe.card_count += 1
|
57
58
|
json_response 200, fixture('create_card')
|
58
59
|
end
|
59
60
|
|
@@ -75,6 +76,7 @@ module FakeStripe
|
|
75
76
|
|
76
77
|
# Subscriptions
|
77
78
|
post '/v1/customers/:customer_id/subscriptions' do
|
79
|
+
FakeStripe.subscription_count += 1
|
78
80
|
json_response 200, fixture('create_subscription')
|
79
81
|
end
|
80
82
|
|
@@ -96,6 +98,7 @@ module FakeStripe
|
|
96
98
|
|
97
99
|
# Plans
|
98
100
|
post '/v1/plans' do
|
101
|
+
FakeStripe.plan_count += 1
|
99
102
|
json_response 200, fixture('create_plan')
|
100
103
|
end
|
101
104
|
|
@@ -117,6 +120,7 @@ module FakeStripe
|
|
117
120
|
|
118
121
|
# Coupons
|
119
122
|
post '/v1/coupons' do
|
123
|
+
FakeStripe.coupon_count += 1
|
120
124
|
json_response 200, fixture('create_coupon')
|
121
125
|
end
|
122
126
|
|
@@ -151,6 +155,7 @@ module FakeStripe
|
|
151
155
|
end
|
152
156
|
|
153
157
|
post '/v1/invoices' do
|
158
|
+
FakeStripe.invoice_count += 1
|
154
159
|
json_response 200, fixture('create_invoice')
|
155
160
|
end
|
156
161
|
|
@@ -172,6 +177,7 @@ module FakeStripe
|
|
172
177
|
|
173
178
|
# Invoice Items
|
174
179
|
post '/v1/invoiceitems' do
|
180
|
+
FakeStripe.invoiceitem_count += 1
|
175
181
|
json_response 200, fixture('create_invoiceitem')
|
176
182
|
end
|
177
183
|
|
@@ -202,6 +208,7 @@ module FakeStripe
|
|
202
208
|
|
203
209
|
# Transfers
|
204
210
|
post '/v1/transfers' do
|
211
|
+
FakeStripe.transfer_count += 1
|
205
212
|
json_response 200, fixture('create_transfer')
|
206
213
|
end
|
207
214
|
|
@@ -223,6 +230,7 @@ module FakeStripe
|
|
223
230
|
|
224
231
|
# Recipients
|
225
232
|
post '/v1/recipients' do
|
233
|
+
FakeStripe.recipient_count += 1
|
226
234
|
json_response 200, fixture('create_recipient')
|
227
235
|
end
|
228
236
|
|
@@ -284,6 +292,7 @@ module FakeStripe
|
|
284
292
|
|
285
293
|
# Tokens
|
286
294
|
post '/v1/tokens' do
|
295
|
+
FakeStripe.token_count += 1
|
287
296
|
json_response 200, fixture('create_token')
|
288
297
|
end
|
289
298
|
|
data/lib/fake_stripe/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harlow Ward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
version: '0'
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.
|
207
|
+
rubygems_version: 2.4.5
|
208
208
|
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: A fake Stripe server.
|