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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7b987c214a1ff6edd50c5b79ba6adb060ccfb3c
4
- data.tar.gz: 1f279550aa2d4c885c6487528645d396579229db
3
+ metadata.gz: 08e95a4cddf4f2ad7dc6e8764c75cc7280f23f5b
4
+ data.tar.gz: 76e6d95ba8cf2acc1f854f1a14a4dbb0d688bb5b
5
5
  SHA512:
6
- metadata.gz: 3f3653167729c7bc6ef172843c53f9ce0567b3bc71e13503e6632f650b97e8fd1d95c17154ea1e88b3ee81dc15a3e4a69c0cab8912948f0f18f4fee6ad53e78d
7
- data.tar.gz: d0ab0d0b5dbbf08bdc8e50309e7144991c4e6faf716cc583d44698dec2fbddd5ef9c8e491de60c9d541c56c168b4a8e97606d7adb03fd50cfb215ab499dad1cb
6
+ metadata.gz: b096557043a584130d61e84960f868d32ce758f10624a1650b00720ea5cbf9de1367efc3d5cbbe55685b6e3d378b135eb44297b84de3bdf2bbacf06a221cac05
7
+ data.tar.gz: 876629c56a9314d49fc665b3bd1fda1292b88c68fcd9228494ed4aadbd015ded62219ddc98882e85f2bb87bcdcf232afc2c44b7f25778d0439520f0a55eff49e
@@ -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
- def self.charge_count
12
- @@charge_count
13
- end
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
- def self.customer_count=(customer_count)
32
- @@customer_count = customer_count
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
- @@charge_count = 0
37
- @@customer_count = 0
38
- @@refund_count = 0
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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module FakeStripe
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
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.8
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: 2014-12-10 00:00:00.000000000 Z
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.2.2
207
+ rubygems_version: 2.4.5
208
208
  signing_key:
209
209
  specification_version: 4
210
210
  summary: A fake Stripe server.