gocardless_pro 1.0.0 → 1.0.1
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.
- 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::CreditorsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -33,10 +34,10 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
33
34
|
end
|
34
35
|
|
35
36
|
before do
|
36
|
-
stub_request(:post,
|
37
|
+
stub_request(:post, %r(.*api.gocardless.com/creditors)).
|
37
38
|
with(
|
38
39
|
body: {
|
39
|
-
creditors
|
40
|
+
"creditors" => {
|
40
41
|
|
41
42
|
"address_line1" => "address_line1-input",
|
42
43
|
"address_line2" => "address_line2-input",
|
@@ -54,7 +55,7 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
54
55
|
).
|
55
56
|
to_return(
|
56
57
|
body: {
|
57
|
-
creditors
|
58
|
+
"creditors" => {
|
58
59
|
|
59
60
|
"address_line1" => "address_line1-input",
|
60
61
|
"address_line2" => "address_line2-input",
|
@@ -82,7 +83,7 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
82
83
|
let(:new_resource) { {} }
|
83
84
|
|
84
85
|
before do
|
85
|
-
stub_request(:post,
|
86
|
+
stub_request(:post, %r(.*api.gocardless.com/creditors)).to_return(
|
86
87
|
body: {
|
87
88
|
error: {
|
88
89
|
type: 'validation_failed',
|
@@ -112,9 +113,9 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
112
113
|
subject(:get_list_response) { client.creditors.list }
|
113
114
|
|
114
115
|
before do
|
115
|
-
stub_request(:get,
|
116
|
+
stub_request(:get, %r(.*api.gocardless.com/creditors)).to_return(
|
116
117
|
body: {
|
117
|
-
creditors
|
118
|
+
"creditors" => [{
|
118
119
|
|
119
120
|
"address_line1" => "address_line1-input",
|
120
121
|
"address_line2" => "address_line2-input",
|
@@ -198,9 +199,9 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
198
199
|
|
199
200
|
describe "#all" do
|
200
201
|
let!(:first_response_stub) do
|
201
|
-
stub_request(:get,
|
202
|
+
stub_request(:get, %r(.*api.gocardless.com/creditors$)).to_return(
|
202
203
|
body: {
|
203
|
-
creditors
|
204
|
+
"creditors" => [{
|
204
205
|
|
205
206
|
"address_line1" => "address_line1-input",
|
206
207
|
"address_line2" => "address_line2-input",
|
@@ -224,9 +225,9 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
224
225
|
end
|
225
226
|
|
226
227
|
let!(:second_response_stub) do
|
227
|
-
stub_request(:get,
|
228
|
+
stub_request(:get, %r(.*api.gocardless.com/creditors\?after=AB345)).to_return(
|
228
229
|
body: {
|
229
|
-
creditors
|
230
|
+
"creditors" => [{
|
230
231
|
|
231
232
|
"address_line1" => "address_line1-input",
|
232
233
|
"address_line2" => "address_line2-input",
|
@@ -268,11 +269,12 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
268
269
|
|
269
270
|
context "passing in a custom header" do
|
270
271
|
let!(:stub) do
|
271
|
-
|
272
|
-
|
273
|
-
.
|
272
|
+
stub_url = "/creditors/:identity".gsub(':identity', id)
|
273
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
274
|
+
with(headers: { 'Foo' => 'Bar' }).
|
275
|
+
to_return(
|
274
276
|
body: {
|
275
|
-
creditors
|
277
|
+
"creditors" => {
|
276
278
|
|
277
279
|
"address_line1" => "address_line1-input",
|
278
280
|
"address_line2" => "address_line2-input",
|
@@ -305,9 +307,10 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
305
307
|
|
306
308
|
context "when there is a creditor to return" do
|
307
309
|
before do
|
308
|
-
|
310
|
+
stub_url = "/creditors/:identity".gsub(':identity', id)
|
311
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
309
312
|
body: {
|
310
|
-
creditors
|
313
|
+
"creditors" => {
|
311
314
|
|
312
315
|
"address_line1" => "address_line1-input",
|
313
316
|
"address_line2" => "address_line2-input",
|
@@ -333,7 +336,8 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
333
336
|
|
334
337
|
context "when nothing is returned" do
|
335
338
|
before do
|
336
|
-
|
339
|
+
stub_url = "/creditors/:identity".gsub(':identity', id)
|
340
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
337
341
|
body: "",
|
338
342
|
headers: { 'Content-Type' => 'application/json' }
|
339
343
|
)
|
@@ -358,9 +362,10 @@ describe GoCardlessPro::Services::CreditorsService do
|
|
358
362
|
let(:update_params) { { "hello" => "world" } }
|
359
363
|
|
360
364
|
let!(:stub) do
|
361
|
-
|
365
|
+
stub_url = "/creditors/:identity".gsub(':identity', id)
|
366
|
+
stub_request(:put, %r(.*api.gocardless.com#{stub_url})).to_return(
|
362
367
|
body: {
|
363
|
-
creditors
|
368
|
+
"creditors" => {
|
364
369
|
|
365
370
|
"address_line1" => "address_line1-input",
|
366
371
|
"address_line2" => "address_line2-input",
|
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -32,10 +33,10 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
32
33
|
end
|
33
34
|
|
34
35
|
before do
|
35
|
-
stub_request(:post,
|
36
|
+
stub_request(:post, %r(.*api.gocardless.com/customer_bank_accounts)).
|
36
37
|
with(
|
37
38
|
body: {
|
38
|
-
customer_bank_accounts
|
39
|
+
"customer_bank_accounts" => {
|
39
40
|
|
40
41
|
"account_holder_name" => "account_holder_name-input",
|
41
42
|
"account_number_ending" => "account_number_ending-input",
|
@@ -52,7 +53,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
52
53
|
).
|
53
54
|
to_return(
|
54
55
|
body: {
|
55
|
-
customer_bank_accounts
|
56
|
+
"customer_bank_accounts" => {
|
56
57
|
|
57
58
|
"account_holder_name" => "account_holder_name-input",
|
58
59
|
"account_number_ending" => "account_number_ending-input",
|
@@ -79,7 +80,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
79
80
|
let(:new_resource) { {} }
|
80
81
|
|
81
82
|
before do
|
82
|
-
stub_request(:post,
|
83
|
+
stub_request(:post, %r(.*api.gocardless.com/customer_bank_accounts)).to_return(
|
83
84
|
body: {
|
84
85
|
error: {
|
85
86
|
type: 'validation_failed',
|
@@ -109,9 +110,9 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
109
110
|
subject(:get_list_response) { client.customer_bank_accounts.list }
|
110
111
|
|
111
112
|
before do
|
112
|
-
stub_request(:get,
|
113
|
+
stub_request(:get, %r(.*api.gocardless.com/customer_bank_accounts)).to_return(
|
113
114
|
body: {
|
114
|
-
customer_bank_accounts
|
115
|
+
"customer_bank_accounts" => [{
|
115
116
|
|
116
117
|
"account_holder_name" => "account_holder_name-input",
|
117
118
|
"account_number_ending" => "account_number_ending-input",
|
@@ -190,9 +191,9 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
190
191
|
|
191
192
|
describe "#all" do
|
192
193
|
let!(:first_response_stub) do
|
193
|
-
stub_request(:get,
|
194
|
+
stub_request(:get, %r(.*api.gocardless.com/customer_bank_accounts$)).to_return(
|
194
195
|
body: {
|
195
|
-
customer_bank_accounts
|
196
|
+
"customer_bank_accounts" => [{
|
196
197
|
|
197
198
|
"account_holder_name" => "account_holder_name-input",
|
198
199
|
"account_number_ending" => "account_number_ending-input",
|
@@ -215,9 +216,9 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
215
216
|
end
|
216
217
|
|
217
218
|
let!(:second_response_stub) do
|
218
|
-
stub_request(:get,
|
219
|
+
stub_request(:get, %r(.*api.gocardless.com/customer_bank_accounts\?after=AB345)).to_return(
|
219
220
|
body: {
|
220
|
-
customer_bank_accounts
|
221
|
+
"customer_bank_accounts" => [{
|
221
222
|
|
222
223
|
"account_holder_name" => "account_holder_name-input",
|
223
224
|
"account_number_ending" => "account_number_ending-input",
|
@@ -258,11 +259,12 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
258
259
|
|
259
260
|
context "passing in a custom header" do
|
260
261
|
let!(:stub) do
|
261
|
-
|
262
|
-
|
263
|
-
.
|
262
|
+
stub_url = "/customer_bank_accounts/:identity".gsub(':identity', id)
|
263
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
264
|
+
with(headers: { 'Foo' => 'Bar' }).
|
265
|
+
to_return(
|
264
266
|
body: {
|
265
|
-
customer_bank_accounts
|
267
|
+
"customer_bank_accounts" => {
|
266
268
|
|
267
269
|
"account_holder_name" => "account_holder_name-input",
|
268
270
|
"account_number_ending" => "account_number_ending-input",
|
@@ -294,9 +296,10 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
294
296
|
|
295
297
|
context "when there is a customer_bank_account to return" do
|
296
298
|
before do
|
297
|
-
|
299
|
+
stub_url = "/customer_bank_accounts/:identity".gsub(':identity', id)
|
300
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
298
301
|
body: {
|
299
|
-
customer_bank_accounts
|
302
|
+
"customer_bank_accounts" => {
|
300
303
|
|
301
304
|
"account_holder_name" => "account_holder_name-input",
|
302
305
|
"account_number_ending" => "account_number_ending-input",
|
@@ -321,7 +324,8 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
321
324
|
|
322
325
|
context "when nothing is returned" do
|
323
326
|
before do
|
324
|
-
|
327
|
+
stub_url = "/customer_bank_accounts/:identity".gsub(':identity', id)
|
328
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
325
329
|
body: "",
|
326
330
|
headers: { 'Content-Type' => 'application/json' }
|
327
331
|
)
|
@@ -346,9 +350,10 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
346
350
|
let(:update_params) { { "hello" => "world" } }
|
347
351
|
|
348
352
|
let!(:stub) do
|
349
|
-
|
353
|
+
stub_url = "/customer_bank_accounts/:identity".gsub(':identity', id)
|
354
|
+
stub_request(:put, %r(.*api.gocardless.com#{stub_url})).to_return(
|
350
355
|
body: {
|
351
|
-
customer_bank_accounts
|
356
|
+
"customer_bank_accounts" => {
|
352
357
|
|
353
358
|
"account_holder_name" => "account_holder_name-input",
|
354
359
|
"account_number_ending" => "account_number_ending-input",
|
@@ -387,9 +392,9 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
387
392
|
let!(:stub) do
|
388
393
|
# /customer_bank_accounts/%v/actions/disable
|
389
394
|
stub_url = "/customer_bank_accounts/:identity/actions/disable".gsub(':identity', resource_id)
|
390
|
-
stub_request(:post,
|
395
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).to_return(
|
391
396
|
body: {
|
392
|
-
customer_bank_accounts
|
397
|
+
"customer_bank_accounts" => {
|
393
398
|
|
394
399
|
"account_holder_name" => "account_holder_name-input",
|
395
400
|
"account_number_ending" => "account_number_ending-input",
|
@@ -424,13 +429,13 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
424
429
|
let!(:stub) do
|
425
430
|
# /customer_bank_accounts/%v/actions/disable
|
426
431
|
stub_url = "/customer_bank_accounts/:identity/actions/disable".gsub(':identity', resource_id)
|
427
|
-
stub_request(:post,
|
432
|
+
stub_request(:post, %r(.*api.gocardless.com#{stub_url})).
|
428
433
|
with(
|
429
434
|
body: { foo: 'bar' },
|
430
435
|
headers: { 'Foo' => 'Bar' }
|
431
436
|
).to_return(
|
432
437
|
body: {
|
433
|
-
customer_bank_accounts
|
438
|
+
"customer_bank_accounts" => {
|
434
439
|
|
435
440
|
"account_holder_name" => "account_holder_name-input",
|
436
441
|
"account_number_ending" => "account_number_ending-input",
|
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::CustomersService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -36,10 +37,10 @@ describe GoCardlessPro::Services::CustomersService do
|
|
36
37
|
end
|
37
38
|
|
38
39
|
before do
|
39
|
-
stub_request(:post,
|
40
|
+
stub_request(:post, %r(.*api.gocardless.com/customers)).
|
40
41
|
with(
|
41
42
|
body: {
|
42
|
-
customers
|
43
|
+
"customers" => {
|
43
44
|
|
44
45
|
"address_line1" => "address_line1-input",
|
45
46
|
"address_line2" => "address_line2-input",
|
@@ -60,7 +61,7 @@ describe GoCardlessPro::Services::CustomersService do
|
|
60
61
|
).
|
61
62
|
to_return(
|
62
63
|
body: {
|
63
|
-
customers
|
64
|
+
"customers" => {
|
64
65
|
|
65
66
|
"address_line1" => "address_line1-input",
|
66
67
|
"address_line2" => "address_line2-input",
|
@@ -91,7 +92,7 @@ describe GoCardlessPro::Services::CustomersService do
|
|
91
92
|
let(:new_resource) { {} }
|
92
93
|
|
93
94
|
before do
|
94
|
-
stub_request(:post,
|
95
|
+
stub_request(:post, %r(.*api.gocardless.com/customers)).to_return(
|
95
96
|
body: {
|
96
97
|
error: {
|
97
98
|
type: 'validation_failed',
|
@@ -121,9 +122,9 @@ describe GoCardlessPro::Services::CustomersService do
|
|
121
122
|
subject(:get_list_response) { client.customers.list }
|
122
123
|
|
123
124
|
before do
|
124
|
-
stub_request(:get,
|
125
|
+
stub_request(:get, %r(.*api.gocardless.com/customers)).to_return(
|
125
126
|
body: {
|
126
|
-
customers
|
127
|
+
"customers" => [{
|
127
128
|
|
128
129
|
"address_line1" => "address_line1-input",
|
129
130
|
"address_line2" => "address_line2-input",
|
@@ -224,9 +225,9 @@ describe GoCardlessPro::Services::CustomersService do
|
|
224
225
|
|
225
226
|
describe "#all" do
|
226
227
|
let!(:first_response_stub) do
|
227
|
-
stub_request(:get,
|
228
|
+
stub_request(:get, %r(.*api.gocardless.com/customers$)).to_return(
|
228
229
|
body: {
|
229
|
-
customers
|
230
|
+
"customers" => [{
|
230
231
|
|
231
232
|
"address_line1" => "address_line1-input",
|
232
233
|
"address_line2" => "address_line2-input",
|
@@ -253,9 +254,9 @@ describe GoCardlessPro::Services::CustomersService do
|
|
253
254
|
end
|
254
255
|
|
255
256
|
let!(:second_response_stub) do
|
256
|
-
stub_request(:get,
|
257
|
+
stub_request(:get, %r(.*api.gocardless.com/customers\?after=AB345)).to_return(
|
257
258
|
body: {
|
258
|
-
customers
|
259
|
+
"customers" => [{
|
259
260
|
|
260
261
|
"address_line1" => "address_line1-input",
|
261
262
|
"address_line2" => "address_line2-input",
|
@@ -300,11 +301,12 @@ describe GoCardlessPro::Services::CustomersService do
|
|
300
301
|
|
301
302
|
context "passing in a custom header" do
|
302
303
|
let!(:stub) do
|
303
|
-
|
304
|
-
|
305
|
-
.
|
304
|
+
stub_url = "/customers/:identity".gsub(':identity', id)
|
305
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
306
|
+
with(headers: { 'Foo' => 'Bar' }).
|
307
|
+
to_return(
|
306
308
|
body: {
|
307
|
-
customers
|
309
|
+
"customers" => {
|
308
310
|
|
309
311
|
"address_line1" => "address_line1-input",
|
310
312
|
"address_line2" => "address_line2-input",
|
@@ -340,9 +342,10 @@ describe GoCardlessPro::Services::CustomersService do
|
|
340
342
|
|
341
343
|
context "when there is a customer to return" do
|
342
344
|
before do
|
343
|
-
|
345
|
+
stub_url = "/customers/:identity".gsub(':identity', id)
|
346
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
344
347
|
body: {
|
345
|
-
customers
|
348
|
+
"customers" => {
|
346
349
|
|
347
350
|
"address_line1" => "address_line1-input",
|
348
351
|
"address_line2" => "address_line2-input",
|
@@ -371,7 +374,8 @@ describe GoCardlessPro::Services::CustomersService do
|
|
371
374
|
|
372
375
|
context "when nothing is returned" do
|
373
376
|
before do
|
374
|
-
|
377
|
+
stub_url = "/customers/:identity".gsub(':identity', id)
|
378
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
375
379
|
body: "",
|
376
380
|
headers: { 'Content-Type' => 'application/json' }
|
377
381
|
)
|
@@ -396,9 +400,10 @@ describe GoCardlessPro::Services::CustomersService do
|
|
396
400
|
let(:update_params) { { "hello" => "world" } }
|
397
401
|
|
398
402
|
let!(:stub) do
|
399
|
-
|
403
|
+
stub_url = "/customers/:identity".gsub(':identity', id)
|
404
|
+
stub_request(:put, %r(.*api.gocardless.com#{stub_url})).to_return(
|
400
405
|
body: {
|
401
|
-
customers
|
406
|
+
"customers" => {
|
402
407
|
|
403
408
|
"address_line1" => "address_line1-input",
|
404
409
|
"address_line2" => "address_line2-input",
|
@@ -9,6 +9,7 @@ describe GoCardlessPro::Services::EventsService do
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -17,9 +18,9 @@ describe GoCardlessPro::Services::EventsService do
|
|
17
18
|
subject(:get_list_response) { client.events.list }
|
18
19
|
|
19
20
|
before do
|
20
|
-
stub_request(:get,
|
21
|
+
stub_request(:get, %r(.*api.gocardless.com/events)).to_return(
|
21
22
|
body: {
|
22
|
-
events
|
23
|
+
"events" => [{
|
23
24
|
|
24
25
|
"action" => "action-input",
|
25
26
|
"created_at" => "created_at-input",
|
@@ -83,9 +84,9 @@ describe GoCardlessPro::Services::EventsService do
|
|
83
84
|
|
84
85
|
describe "#all" do
|
85
86
|
let!(:first_response_stub) do
|
86
|
-
stub_request(:get,
|
87
|
+
stub_request(:get, %r(.*api.gocardless.com/events$)).to_return(
|
87
88
|
body: {
|
88
|
-
events
|
89
|
+
"events" => [{
|
89
90
|
|
90
91
|
"action" => "action-input",
|
91
92
|
"created_at" => "created_at-input",
|
@@ -105,9 +106,9 @@ describe GoCardlessPro::Services::EventsService do
|
|
105
106
|
end
|
106
107
|
|
107
108
|
let!(:second_response_stub) do
|
108
|
-
stub_request(:get,
|
109
|
+
stub_request(:get, %r(.*api.gocardless.com/events\?after=AB345)).to_return(
|
109
110
|
body: {
|
110
|
-
events
|
111
|
+
"events" => [{
|
111
112
|
|
112
113
|
"action" => "action-input",
|
113
114
|
"created_at" => "created_at-input",
|
@@ -145,11 +146,12 @@ describe GoCardlessPro::Services::EventsService do
|
|
145
146
|
|
146
147
|
context "passing in a custom header" do
|
147
148
|
let!(:stub) do
|
148
|
-
|
149
|
-
|
150
|
-
.
|
149
|
+
stub_url = "/events/:identity".gsub(':identity', id)
|
150
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).
|
151
|
+
with(headers: { 'Foo' => 'Bar' }).
|
152
|
+
to_return(
|
151
153
|
body: {
|
152
|
-
events
|
154
|
+
"events" => {
|
153
155
|
|
154
156
|
"action" => "action-input",
|
155
157
|
"created_at" => "created_at-input",
|
@@ -178,9 +180,10 @@ describe GoCardlessPro::Services::EventsService do
|
|
178
180
|
|
179
181
|
context "when there is a event to return" do
|
180
182
|
before do
|
181
|
-
|
183
|
+
stub_url = "/events/:identity".gsub(':identity', id)
|
184
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
182
185
|
body: {
|
183
|
-
events
|
186
|
+
"events" => {
|
184
187
|
|
185
188
|
"action" => "action-input",
|
186
189
|
"created_at" => "created_at-input",
|
@@ -202,7 +205,8 @@ describe GoCardlessPro::Services::EventsService do
|
|
202
205
|
|
203
206
|
context "when nothing is returned" do
|
204
207
|
before do
|
205
|
-
|
208
|
+
stub_url = "/events/:identity".gsub(':identity', id)
|
209
|
+
stub_request(:get, %r(.*api.gocardless.com#{stub_url})).to_return(
|
206
210
|
body: "",
|
207
211
|
headers: { 'Content-Type' => 'application/json' }
|
208
212
|
)
|