gocardless_pro 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/gocardless_pro/resources/bank_details_lookup.rb +3 -0
- data/lib/gocardless_pro/resources/creditor.rb +4 -1
- data/lib/gocardless_pro/resources/creditor_bank_account.rb +12 -9
- data/lib/gocardless_pro/resources/customer_bank_account.rb +4 -1
- data/lib/gocardless_pro/resources/event.rb +4 -1
- data/lib/gocardless_pro/resources/mandate.rb +4 -1
- data/lib/gocardless_pro/resources/mandate_pdf.rb +1 -1
- data/lib/gocardless_pro/resources/payment.rb +8 -5
- data/lib/gocardless_pro/resources/payout.rb +8 -4
- data/lib/gocardless_pro/resources/redirect_flow.rb +8 -1
- data/lib/gocardless_pro/resources/refund.rb +4 -1
- data/lib/gocardless_pro/resources/subscription.rb +4 -1
- data/lib/gocardless_pro/services/payouts_service.rb +1 -1
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/resources/bank_details_lookup_spec.rb +16 -1
- data/spec/resources/creditor_bank_account_spec.rb +13 -1
- data/spec/resources/creditor_spec.rb +13 -1
- data/spec/resources/customer_bank_account_spec.rb +13 -1
- data/spec/resources/customer_spec.rb +8 -1
- data/spec/resources/event_spec.rb +13 -1
- data/spec/resources/mandate_pdf_spec.rb +8 -1
- data/spec/resources/mandate_spec.rb +13 -1
- data/spec/resources/payment_spec.rb +13 -1
- data/spec/resources/payout_spec.rb +13 -1
- data/spec/resources/redirect_flow_spec.rb +21 -1
- data/spec/resources/refund_spec.rb +13 -1
- data/spec/resources/subscription_spec.rb +13 -1
- data/spec/services/bank_details_lookups_service_spec.rb +8 -4
- data/spec/services/creditor_bank_accounts_service_spec.rb +25 -21
- data/spec/services/creditors_service_spec.rb +24 -19
- data/spec/services/customer_bank_accounts_service_spec.rb +28 -23
- data/spec/services/customers_service_spec.rb +24 -19
- data/spec/services/events_service_spec.rb +17 -13
- data/spec/services/mandate_pdfs_service_spec.rb +5 -4
- data/spec/services/mandates_service_spec.rb +32 -27
- data/spec/services/payments_service_spec.rb +32 -27
- data/spec/services/payouts_service_spec.rb +17 -13
- data/spec/services/redirect_flows_service_spec.rb +19 -15
- data/spec/services/refunds_service_spec.rb +24 -19
- data/spec/services/subscriptions_service_spec.rb +28 -23
- metadata +3 -3
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -30,10 +31,10 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
30
31
|
end
|
31
32
|
|
32
33
|
before do
|
33
|
-
stub_request(:post,
|
34
|
+
stub_request(:post, %r(.*api.gocardless.com/redirect_flows)).
|
34
35
|
with(
|
35
36
|
body: {
|
36
|
-
redirect_flows
|
37
|
+
"redirect_flows" => {
|
37
38
|
|
38
39
|
"created_at" => "created_at-input",
|
39
40
|
"description" => "description-input",
|
@@ -48,7 +49,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
48
49
|
).
|
49
50
|
to_return(
|
50
51
|
body: {
|
51
|
-
redirect_flows
|
52
|
+
"redirect_flows" => {
|
52
53
|
|
53
54
|
"created_at" => "created_at-input",
|
54
55
|
"description" => "description-input",
|
@@ -73,7 +74,7 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
73
74
|
let(:new_resource) { {} }
|
74
75
|
|
75
76
|
before do
|
76
|
-
stub_request(:post,
|
77
|
+
stub_request(:post, %r(.*api.gocardless.com/redirect_flows)).to_return(
|
77
78
|
body: {
|
78
79
|
error: {
|
79
80
|
type: 'validation_failed',
|
@@ -105,11 +106,12 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
105
106
|
|
106
107
|
context "passing in a custom header" do
|
107
108
|
let!(:stub) do
|
108
|
-
|
109
|
-
|
110
|
-
.
|
109
|
+
stub_url = "/redirect_flows/:identity".gsub(':identity', id)
|
110
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
111
|
+
with(headers: { 'Foo' => 'Bar' }).
|
112
|
+
to_return(
|
111
113
|
body: {
|
112
|
-
redirect_flows
|
114
|
+
"redirect_flows" => {
|
113
115
|
|
114
116
|
"created_at" => "created_at-input",
|
115
117
|
"description" => "description-input",
|
@@ -139,9 +141,10 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
139
141
|
|
140
142
|
context "when there is a redirect_flow to return" do
|
141
143
|
before do
|
142
|
-
|
144
|
+
stub_url = "/redirect_flows/:identity".gsub(':identity', id)
|
145
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
143
146
|
body: {
|
144
|
-
redirect_flows
|
147
|
+
"redirect_flows" => {
|
145
148
|
|
146
149
|
"created_at" => "created_at-input",
|
147
150
|
"description" => "description-input",
|
@@ -164,7 +167,8 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
164
167
|
|
165
168
|
context "when nothing is returned" do
|
166
169
|
before do
|
167
|
-
|
170
|
+
stub_url = "/redirect_flows/:identity".gsub(':identity', id)
|
171
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
168
172
|
body: "",
|
169
173
|
headers: { 'Content-Type' => 'application/json' }
|
170
174
|
)
|
@@ -191,9 +195,9 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
191
195
|
let!(:stub) do
|
192
196
|
# /redirect_flows/%v/actions/complete
|
193
197
|
stub_url = "/redirect_flows/:identity/actions/complete".gsub(':identity', resource_id)
|
194
|
-
stub_request(:post,
|
198
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).to_return(
|
195
199
|
body: {
|
196
|
-
redirect_flows
|
200
|
+
"redirect_flows" => {
|
197
201
|
|
198
202
|
"created_at" => "created_at-input",
|
199
203
|
"description" => "description-input",
|
@@ -226,13 +230,13 @@ describe GoCardlessPro::Services::RedirectFlowsService do
|
|
226
230
|
let!(:stub) do
|
227
231
|
# /redirect_flows/%v/actions/complete
|
228
232
|
stub_url = "/redirect_flows/:identity/actions/complete".gsub(':identity', resource_id)
|
229
|
-
stub_request(:post,
|
233
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).
|
230
234
|
with(
|
231
235
|
body: { foo: 'bar' },
|
232
236
|
headers: { 'Foo' => 'Bar' }
|
233
237
|
).to_return(
|
234
238
|
body: {
|
235
|
-
redirect_flows
|
239
|
+
"redirect_flows" => {
|
236
240
|
|
237
241
|
"created_at" => "created_at-input",
|
238
242
|
"description" => "description-input",
|
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::RefundsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -28,10 +29,10 @@ describe GoCardlessPro::Services::RefundsService do
|
|
28
29
|
end
|
29
30
|
|
30
31
|
before do
|
31
|
-
stub_request(:post,
|
32
|
+
stub_request(:post, %r(.*api.gocardless.com/refunds)).
|
32
33
|
with(
|
33
34
|
body: {
|
34
|
-
refunds
|
35
|
+
"refunds" => {
|
35
36
|
|
36
37
|
"amount" => "amount-input",
|
37
38
|
"created_at" => "created_at-input",
|
@@ -44,7 +45,7 @@ describe GoCardlessPro::Services::RefundsService do
|
|
44
45
|
).
|
45
46
|
to_return(
|
46
47
|
body: {
|
47
|
-
refunds
|
48
|
+
"refunds" => {
|
48
49
|
|
49
50
|
"amount" => "amount-input",
|
50
51
|
"created_at" => "created_at-input",
|
@@ -67,7 +68,7 @@ describe GoCardlessPro::Services::RefundsService do
|
|
67
68
|
let(:new_resource) { {} }
|
68
69
|
|
69
70
|
before do
|
70
|
-
stub_request(:post,
|
71
|
+
stub_request(:post, %r(.*api.gocardless.com/refunds)).to_return(
|
71
72
|
body: {
|
72
73
|
error: {
|
73
74
|
type: 'validation_failed',
|
@@ -97,9 +98,9 @@ describe GoCardlessPro::Services::RefundsService do
|
|
97
98
|
subject(:get_list_response) { client.refunds.list }
|
98
99
|
|
99
100
|
before do
|
100
|
-
stub_request(:get,
|
101
|
+
stub_request(:get, %r(.*api.gocardless.com/refunds)).to_return(
|
101
102
|
body: {
|
102
|
-
refunds
|
103
|
+
"refunds" => [{
|
103
104
|
|
104
105
|
"amount" => "amount-input",
|
105
106
|
"created_at" => "created_at-input",
|
@@ -158,9 +159,9 @@ describe GoCardlessPro::Services::RefundsService do
|
|
158
159
|
|
159
160
|
describe "#all" do
|
160
161
|
let!(:first_response_stub) do
|
161
|
-
stub_request(:get,
|
162
|
+
stub_request(:get, %r(.*api.gocardless.com/refunds$)).to_return(
|
162
163
|
body: {
|
163
|
-
refunds
|
164
|
+
"refunds" => [{
|
164
165
|
|
165
166
|
"amount" => "amount-input",
|
166
167
|
"created_at" => "created_at-input",
|
@@ -179,9 +180,9 @@ describe GoCardlessPro::Services::RefundsService do
|
|
179
180
|
end
|
180
181
|
|
181
182
|
let!(:second_response_stub) do
|
182
|
-
stub_request(:get,
|
183
|
+
stub_request(:get, %r(.*api.gocardless.com/refunds\?after=AB345)).to_return(
|
183
184
|
body: {
|
184
|
-
refunds
|
185
|
+
"refunds" => [{
|
185
186
|
|
186
187
|
"amount" => "amount-input",
|
187
188
|
"created_at" => "created_at-input",
|
@@ -218,11 +219,12 @@ describe GoCardlessPro::Services::RefundsService do
|
|
218
219
|
|
219
220
|
context "passing in a custom header" do
|
220
221
|
let!(:stub) do
|
221
|
-
|
222
|
-
|
223
|
-
.
|
222
|
+
stub_url = "/refunds/:identity".gsub(':identity', id)
|
223
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
224
|
+
with(headers: { 'Foo' => 'Bar' }).
|
225
|
+
to_return(
|
224
226
|
body: {
|
225
|
-
refunds
|
227
|
+
"refunds" => {
|
226
228
|
|
227
229
|
"amount" => "amount-input",
|
228
230
|
"created_at" => "created_at-input",
|
@@ -250,9 +252,10 @@ describe GoCardlessPro::Services::RefundsService do
|
|
250
252
|
|
251
253
|
context "when there is a refund to return" do
|
252
254
|
before do
|
253
|
-
|
255
|
+
stub_url = "/refunds/:identity".gsub(':identity', id)
|
256
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
254
257
|
body: {
|
255
|
-
refunds
|
258
|
+
"refunds" => {
|
256
259
|
|
257
260
|
"amount" => "amount-input",
|
258
261
|
"created_at" => "created_at-input",
|
@@ -273,7 +276,8 @@ describe GoCardlessPro::Services::RefundsService do
|
|
273
276
|
|
274
277
|
context "when nothing is returned" do
|
275
278
|
before do
|
276
|
-
|
279
|
+
stub_url = "/refunds/:identity".gsub(':identity', id)
|
280
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
277
281
|
body: "",
|
278
282
|
headers: { 'Content-Type' => 'application/json' }
|
279
283
|
)
|
@@ -298,9 +302,10 @@ describe GoCardlessPro::Services::RefundsService do
|
|
298
302
|
let(:update_params) { { "hello" => "world" } }
|
299
303
|
|
300
304
|
let!(:stub) do
|
301
|
-
|
305
|
+
stub_url = "/refunds/:identity".gsub(':identity', id)
|
306
|
+
stub_request(:put, %r(.*api.gocardless.com#{stub_url})).to_return(
|
302
307
|
body: {
|
303
|
-
refunds
|
308
|
+
"refunds" => {
|
304
309
|
|
305
310
|
"amount" => "amount-input",
|
306
311
|
"created_at" => "created_at-input",
|
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -39,10 +40,10 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
39
40
|
end
|
40
41
|
|
41
42
|
before do
|
42
|
-
stub_request(:post,
|
43
|
+
stub_request(:post, %r(.*api.gocardless.com/subscriptions)).
|
43
44
|
with(
|
44
45
|
body: {
|
45
|
-
subscriptions
|
46
|
+
"subscriptions" => {
|
46
47
|
|
47
48
|
"amount" => "amount-input",
|
48
49
|
"count" => "count-input",
|
@@ -66,7 +67,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
66
67
|
).
|
67
68
|
to_return(
|
68
69
|
body: {
|
69
|
-
subscriptions
|
70
|
+
"subscriptions" => {
|
70
71
|
|
71
72
|
"amount" => "amount-input",
|
72
73
|
"count" => "count-input",
|
@@ -100,7 +101,7 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
100
101
|
let(:new_resource) { {} }
|
101
102
|
|
102
103
|
before do
|
103
|
-
stub_request(:post,
|
104
|
+
stub_request(:post, %r(.*api.gocardless.com/subscriptions)).to_return(
|
104
105
|
body: {
|
105
106
|
error: {
|
106
107
|
type: 'validation_failed',
|
@@ -130,9 +131,9 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
130
131
|
subject(:get_list_response) { client.subscriptions.list }
|
131
132
|
|
132
133
|
before do
|
133
|
-
stub_request(:get,
|
134
|
+
stub_request(:get, %r(.*api.gocardless.com/subscriptions)).to_return(
|
134
135
|
body: {
|
135
|
-
subscriptions
|
136
|
+
"subscriptions" => [{
|
136
137
|
|
137
138
|
"amount" => "amount-input",
|
138
139
|
"count" => "count-input",
|
@@ -246,9 +247,9 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
246
247
|
|
247
248
|
describe "#all" do
|
248
249
|
let!(:first_response_stub) do
|
249
|
-
stub_request(:get,
|
250
|
+
stub_request(:get, %r(.*api.gocardless.com/subscriptions$)).to_return(
|
250
251
|
body: {
|
251
|
-
subscriptions
|
252
|
+
"subscriptions" => [{
|
252
253
|
|
253
254
|
"amount" => "amount-input",
|
254
255
|
"count" => "count-input",
|
@@ -278,9 +279,9 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
278
279
|
end
|
279
280
|
|
280
281
|
let!(:second_response_stub) do
|
281
|
-
stub_request(:get,
|
282
|
+
stub_request(:get, %r(.*api.gocardless.com/subscriptions\?after=AB345)).to_return(
|
282
283
|
body: {
|
283
|
-
subscriptions
|
284
|
+
"subscriptions" => [{
|
284
285
|
|
285
286
|
"amount" => "amount-input",
|
286
287
|
"count" => "count-input",
|
@@ -328,11 +329,12 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
328
329
|
|
329
330
|
context "passing in a custom header" do
|
330
331
|
let!(:stub) do
|
331
|
-
|
332
|
-
|
333
|
-
.
|
332
|
+
stub_url = "/subscriptions/:identity".gsub(':identity', id)
|
333
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
334
|
+
with(headers: { 'Foo' => 'Bar' }).
|
335
|
+
to_return(
|
334
336
|
body: {
|
335
|
-
subscriptions
|
337
|
+
"subscriptions" => {
|
336
338
|
|
337
339
|
"amount" => "amount-input",
|
338
340
|
"count" => "count-input",
|
@@ -371,9 +373,10 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
371
373
|
|
372
374
|
context "when there is a subscription to return" do
|
373
375
|
before do
|
374
|
-
|
376
|
+
stub_url = "/subscriptions/:identity".gsub(':identity', id)
|
377
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
375
378
|
body: {
|
376
|
-
subscriptions
|
379
|
+
"subscriptions" => {
|
377
380
|
|
378
381
|
"amount" => "amount-input",
|
379
382
|
"count" => "count-input",
|
@@ -405,7 +408,8 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
405
408
|
|
406
409
|
context "when nothing is returned" do
|
407
410
|
before do
|
408
|
-
|
411
|
+
stub_url = "/subscriptions/:identity".gsub(':identity', id)
|
412
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
409
413
|
body: "",
|
410
414
|
headers: { 'Content-Type' => 'application/json' }
|
411
415
|
)
|
@@ -430,9 +434,10 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
430
434
|
let(:update_params) { { "hello" => "world" } }
|
431
435
|
|
432
436
|
let!(:stub) do
|
433
|
-
|
437
|
+
stub_url = "/subscriptions/:identity".gsub(':identity', id)
|
438
|
+
stub_request(:put, %r(.*api.gocardless.com#{stub_url})).to_return(
|
434
439
|
body: {
|
435
|
-
subscriptions
|
440
|
+
"subscriptions" => {
|
436
441
|
|
437
442
|
"amount" => "amount-input",
|
438
443
|
"count" => "count-input",
|
@@ -478,9 +483,9 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
478
483
|
let!(:stub) do
|
479
484
|
# /subscriptions/%v/actions/cancel
|
480
485
|
stub_url = "/subscriptions/:identity/actions/cancel".gsub(':identity', resource_id)
|
481
|
-
stub_request(:post,
|
486
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).to_return(
|
482
487
|
body: {
|
483
|
-
subscriptions
|
488
|
+
"subscriptions" => {
|
484
489
|
|
485
490
|
"amount" => "amount-input",
|
486
491
|
"count" => "count-input",
|
@@ -522,13 +527,13 @@ describe GoCardlessPro::Services::SubscriptionsService do
|
|
522
527
|
let!(:stub) do
|
523
528
|
# /subscriptions/%v/actions/cancel
|
524
529
|
stub_url = "/subscriptions/:identity/actions/cancel".gsub(':identity', resource_id)
|
525
|
-
stub_request(:post,
|
530
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).
|
526
531
|
with(
|
527
532
|
body: { foo: 'bar' },
|
528
533
|
headers: { 'Foo' => 'Bar' }
|
529
534
|
).to_return(
|
530
535
|
body: {
|
531
|
-
subscriptions
|
536
|
+
"subscriptions" => {
|
532
537
|
|
533
538
|
"amount" => "amount-input",
|
534
539
|
"count" => "count-input",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gocardless_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
195
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.4.
|
196
|
+
rubygems_version: 2.4.1
|
197
197
|
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: A gem for calling the GoCardless Pro API
|