mustwin-stripe-ruby-mock 1.8.4.10 → 1.8.5.00

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,13 +10,4 @@ module StripeMock
10
10
  end
11
11
  end
12
12
 
13
- def self.generate_recipient_token(recipient_params)
14
- if @state == 'local'
15
- instance.generate_recipient_token(recipient_params)
16
- elsif @state == 'remote'
17
- client.generate_recipient_token(recipient_params)
18
- else
19
- raise UnstartedStateError
20
- end
21
- end
22
13
  end
@@ -0,0 +1,13 @@
1
+ module StripeMock
2
+
3
+ def self.generate_recipient_token(recipient_params)
4
+ if @state == 'local'
5
+ instance.generate_recipient_token(recipient_params)
6
+ elsif @state == 'remote'
7
+ client.generate_recipient_token(recipient_params)
8
+ else
9
+ raise UnstartedStateError
10
+ end
11
+ end
12
+
13
+ end
@@ -21,11 +21,12 @@ module StripeMock
21
21
  include StripeMock::RequestHandlers::Plans
22
22
 
23
23
 
24
- attr_reader :charges, :customers, :plans, :error_queue
24
+ attr_reader :charges, :customers, :plans, :error_queue, :recipients
25
25
  attr_accessor :debug, :strict
26
26
 
27
27
  def initialize
28
28
  @customers = {}
29
+ @recipients = {}
29
30
  @charges = {}
30
31
  @plans = {}
31
32
  @recipient_tokens = {}
@@ -6,6 +6,8 @@ module StripeMock
6
6
  klass.add_handler 'post /v1/charges', :new_charge
7
7
  klass.add_handler 'get /v1/charges/(.*)', :get_charge
8
8
  klass.add_handler 'post /v1/charges/(.*)/capture', :capture_charge
9
+ klass.add_handler 'post /v1/recipients', :new_recipient
10
+ klass.add_handler 'get /v1/recipients/(.*)', :get_recipient
9
11
  end
10
12
 
11
13
  def new_charge(route, method_url, params, headers)
@@ -28,6 +30,16 @@ module StripeMock
28
30
  charge
29
31
  end
30
32
 
33
+ def new_recipient(route, method_url, params, headers)
34
+ id = new_id('rp')
35
+ recipients[id] = Data.mock_recipient(params.merge :id => id)
36
+ end
37
+
38
+ def get_recipient(route, method_url, params, headers)
39
+ route =~ method_url
40
+ assert_existance :recipient, $1, recipients[$1]
41
+ recipients[$1] ||= Data.mock_recipient(:id => $1)
42
+ end
31
43
  end
32
44
  end
33
45
  end
@@ -1,4 +1,4 @@
1
1
  module StripeMock
2
2
  # stripe-ruby-mock version
3
- VERSION = "1.8.4.10"
3
+ VERSION = "1.8.5.00"
4
4
  end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples 'Recipient Token Mocking' do
4
+
5
+ it "generates and reads a recipient token" do
6
+ recipient_token = StripeMock.generate_recipient_token(
7
+ :bank_account => {
8
+ :country => "US",
9
+ :routing_number => "110000000",
10
+ :account_number => "000123456789",
11
+ })
12
+ name = "Fred Flinstone",
13
+ rec = Stripe::Recipient.create({
14
+ name: name,
15
+ type: "individual",
16
+ email: 'blah@domain.co',
17
+ bank_account: recipient_token
18
+ })
19
+ acct = rec['active_account']
20
+ expect(acct['last4']).to eq("6789")
21
+ expect(rec['name']).to eq(name)
22
+ end
23
+
24
+ end
25
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustwin-stripe-ruby-mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4.10
4
+ version: 1.8.5.00
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-05 00:00:00.000000000 Z
12
+ date: 2013-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: stripe
@@ -129,6 +129,7 @@ files:
129
129
  - lib/stripe_mock/api/debug.rb
130
130
  - lib/stripe_mock/api/errors.rb
131
131
  - lib/stripe_mock/api/instance.rb
132
+ - lib/stripe_mock/api/recipient_token.rb
132
133
  - lib/stripe_mock/api/server.rb
133
134
  - lib/stripe_mock/api/strict.rb
134
135
  - lib/stripe_mock/api/webhooks.rb
@@ -196,6 +197,7 @@ files:
196
197
  - spec/shared_stripe_examples/error_mock_examples.rb
197
198
  - spec/shared_stripe_examples/invoice_item_examples.rb
198
199
  - spec/shared_stripe_examples/plan_examples.rb
200
+ - spec/shared_stripe_examples/recipient_examples.rb
199
201
  - spec/spec_helper.rb
200
202
  - spec/stripe_mock_spec.rb
201
203
  - spec/support/stripe_examples.rb
@@ -217,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
219
  version: '0'
218
220
  segments:
219
221
  - 0
220
- hash: 3377205038151854316
222
+ hash: 2845156528502310754
221
223
  required_rubygems_version: !ruby/object:Gem::Requirement
222
224
  none: false
223
225
  requirements:
@@ -226,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
228
  version: '0'
227
229
  segments:
228
230
  - 0
229
- hash: 3377205038151854316
231
+ hash: 2845156528502310754
230
232
  requirements: []
231
233
  rubyforge_project:
232
234
  rubygems_version: 1.8.24
@@ -246,6 +248,7 @@ test_files:
246
248
  - spec/shared_stripe_examples/error_mock_examples.rb
247
249
  - spec/shared_stripe_examples/invoice_item_examples.rb
248
250
  - spec/shared_stripe_examples/plan_examples.rb
251
+ - spec/shared_stripe_examples/recipient_examples.rb
249
252
  - spec/spec_helper.rb
250
253
  - spec/stripe_mock_spec.rb
251
254
  - spec/support/stripe_examples.rb