gocardless-pro 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +132 -0
- data/circle.yml +18 -0
- data/demo.rb +10 -0
- data/gocardless-pro.gemspec +27 -0
- data/lib/gocardless-pro.rb +243 -0
- data/lib/gocardless-pro/api_service.rb +57 -0
- data/lib/gocardless-pro/error.rb +42 -0
- data/lib/gocardless-pro/error/gocardless_error.rb +5 -0
- data/lib/gocardless-pro/error/invalid_api_usage_error.rb +5 -0
- data/lib/gocardless-pro/error/invalid_state_error.rb +5 -0
- data/lib/gocardless-pro/error/validation_error.rb +5 -0
- data/lib/gocardless-pro/list_response.rb +34 -0
- data/lib/gocardless-pro/paginator.rb +37 -0
- data/lib/gocardless-pro/request.rb +69 -0
- data/lib/gocardless-pro/resources/api_key.rb +62 -0
- data/lib/gocardless-pro/resources/creditor.rb +83 -0
- data/lib/gocardless-pro/resources/creditor_bank_account.rb +78 -0
- data/lib/gocardless-pro/resources/customer.rb +72 -0
- data/lib/gocardless-pro/resources/customer_bank_account.rb +80 -0
- data/lib/gocardless-pro/resources/event.rb +75 -0
- data/lib/gocardless-pro/resources/helper.rb +29 -0
- data/lib/gocardless-pro/resources/mandate.rb +70 -0
- data/lib/gocardless-pro/resources/payment.rb +86 -0
- data/lib/gocardless-pro/resources/payout.rb +66 -0
- data/lib/gocardless-pro/resources/publishable_api_key.rb +51 -0
- data/lib/gocardless-pro/resources/redirect_flow.rb +104 -0
- data/lib/gocardless-pro/resources/refund.rb +70 -0
- data/lib/gocardless-pro/resources/role.rb +101 -0
- data/lib/gocardless-pro/resources/subscription.rb +152 -0
- data/lib/gocardless-pro/resources/user.rb +60 -0
- data/lib/gocardless-pro/response.rb +77 -0
- data/lib/gocardless-pro/services/api_key_service.rb +130 -0
- data/lib/gocardless-pro/services/base_service.rb +29 -0
- data/lib/gocardless-pro/services/creditor_bank_account_service.rb +122 -0
- data/lib/gocardless-pro/services/creditor_service.rb +112 -0
- data/lib/gocardless-pro/services/customer_bank_account_service.rb +153 -0
- data/lib/gocardless-pro/services/customer_service.rb +112 -0
- data/lib/gocardless-pro/services/event_service.rb +80 -0
- data/lib/gocardless-pro/services/helper_service.rb +97 -0
- data/lib/gocardless-pro/services/mandate_service.rb +170 -0
- data/lib/gocardless-pro/services/payment_service.rb +164 -0
- data/lib/gocardless-pro/services/payout_service.rb +80 -0
- data/lib/gocardless-pro/services/publishable_api_key_service.rb +130 -0
- data/lib/gocardless-pro/services/redirect_flow_service.rb +96 -0
- data/lib/gocardless-pro/services/refund_service.rb +126 -0
- data/lib/gocardless-pro/services/role_service.rb +127 -0
- data/lib/gocardless-pro/services/subscription_service.rb +133 -0
- data/lib/gocardless-pro/services/user_service.rb +148 -0
- data/lib/gocardless-pro/version.rb +8 -0
- data/spec/api_service_spec.rb +69 -0
- data/spec/client_spec.rb +29 -0
- data/spec/error_spec.rb +44 -0
- data/spec/resources/api_key_spec.rb +85 -0
- data/spec/resources/creditor_bank_account_spec.rb +109 -0
- data/spec/resources/creditor_spec.rb +125 -0
- data/spec/resources/customer_bank_account_spec.rb +109 -0
- data/spec/resources/customer_spec.rb +127 -0
- data/spec/resources/event_spec.rb +113 -0
- data/spec/resources/helper_spec.rb +23 -0
- data/spec/resources/mandate_spec.rb +97 -0
- data/spec/resources/payment_spec.rb +129 -0
- data/spec/resources/payout_spec.rb +89 -0
- data/spec/resources/publishable_api_key_spec.rb +63 -0
- data/spec/resources/redirect_flow_spec.rb +97 -0
- data/spec/resources/refund_spec.rb +77 -0
- data/spec/resources/role_spec.rb +63 -0
- data/spec/resources/subscription_spec.rb +157 -0
- data/spec/resources/user_spec.rb +85 -0
- data/spec/response_spec.rb +79 -0
- data/spec/services/api_key_service_spec.rb +362 -0
- data/spec/services/creditor_bank_account_service_spec.rb +365 -0
- data/spec/services/creditor_service_spec.rb +339 -0
- data/spec/services/customer_bank_account_service_spec.rb +404 -0
- data/spec/services/customer_service_spec.rb +365 -0
- data/spec/services/event_service_spec.rb +172 -0
- data/spec/services/helper_service_spec.rb +123 -0
- data/spec/services/mandate_service_spec.rb +449 -0
- data/spec/services/payment_service_spec.rb +497 -0
- data/spec/services/payout_service_spec.rb +172 -0
- data/spec/services/publishable_api_key_service_spec.rb +336 -0
- data/spec/services/redirect_flow_service_spec.rb +208 -0
- data/spec/services/refund_service_spec.rb +279 -0
- data/spec/services/role_service_spec.rb +336 -0
- data/spec/services/subscription_service_spec.rb +488 -0
- data/spec/services/user_service_spec.rb +433 -0
- data/spec/spec_helper.rb +91 -0
- metadata +255 -0
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Services::PayoutService do
|
4
|
+
let(:client) do
|
5
|
+
GoCardless::Client.new(
|
6
|
+
api_key: "AK123",
|
7
|
+
api_secret: "ABC"
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
describe "#list" do
|
17
|
+
describe "with no filters" do
|
18
|
+
subject(:get_list_response) { client.payouts.list }
|
19
|
+
|
20
|
+
before do
|
21
|
+
stub_request(:get, /.*api.gocardless.com\/payouts/).to_return(
|
22
|
+
body: {
|
23
|
+
payouts: [{
|
24
|
+
|
25
|
+
"amount" => "amount-input",
|
26
|
+
"created_at" => "created_at-input",
|
27
|
+
"currency" => "currency-input",
|
28
|
+
"id" => "id-input",
|
29
|
+
"links" => "links-input",
|
30
|
+
"reference" => "reference-input",
|
31
|
+
"status" => "status-input",
|
32
|
+
}],
|
33
|
+
meta: {
|
34
|
+
cursors: {
|
35
|
+
before: nil,
|
36
|
+
after: "ABC123"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}.to_json,
|
40
|
+
:headers => {'Content-Type' => 'application/json'}
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "wraps each item in the resource class" do
|
45
|
+
expect(get_list_response.map { |x| x.class }.uniq.first).to eq(GoCardless::Resources::Payout)
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
expect(get_list_response.first.amount).to eq("amount-input")
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
expect(get_list_response.first.created_at).to eq("created_at-input")
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
expect(get_list_response.first.currency).to eq("currency-input")
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
expect(get_list_response.first.id).to eq("id-input")
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
expect(get_list_response.first.reference).to eq("reference-input")
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
expect(get_list_response.first.status).to eq("status-input")
|
72
|
+
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
it "exposes the cursors for before and after" do
|
77
|
+
expect(get_list_response.before).to eq(nil)
|
78
|
+
expect(get_list_response.after).to eq("ABC123")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "#all" do
|
84
|
+
let!(:first_response_stub) do
|
85
|
+
stub_request(:get, /.*api.gocardless.com\/payouts$/).to_return(
|
86
|
+
body: {
|
87
|
+
payouts: [{
|
88
|
+
|
89
|
+
"amount" => "amount-input",
|
90
|
+
"created_at" => "created_at-input",
|
91
|
+
"currency" => "currency-input",
|
92
|
+
"id" => "id-input",
|
93
|
+
"links" => "links-input",
|
94
|
+
"reference" => "reference-input",
|
95
|
+
"status" => "status-input",
|
96
|
+
}],
|
97
|
+
meta: {
|
98
|
+
cursors: { after: 'AB345' },
|
99
|
+
limit: 1
|
100
|
+
}
|
101
|
+
}.to_json,
|
102
|
+
:headers => {'Content-Type' => 'application/json'}
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
106
|
+
let!(:second_response_stub) do
|
107
|
+
stub_request(:get, /.*api.gocardless.com\/payouts\?after=AB345/).to_return(
|
108
|
+
body: {
|
109
|
+
payouts: [{
|
110
|
+
|
111
|
+
"amount" => "amount-input",
|
112
|
+
"created_at" => "created_at-input",
|
113
|
+
"currency" => "currency-input",
|
114
|
+
"id" => "id-input",
|
115
|
+
"links" => "links-input",
|
116
|
+
"reference" => "reference-input",
|
117
|
+
"status" => "status-input",
|
118
|
+
}],
|
119
|
+
meta: {
|
120
|
+
limit: 2,
|
121
|
+
cursors: {}
|
122
|
+
}
|
123
|
+
}.to_json,
|
124
|
+
:headers => {'Content-Type' => 'application/json'}
|
125
|
+
)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "automatically makes the extra requests" do
|
129
|
+
expect(client.payouts.all.to_a.length).to eq(2)
|
130
|
+
expect(first_response_stub).to have_been_requested
|
131
|
+
expect(second_response_stub).to have_been_requested
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
describe "#get" do
|
141
|
+
let(:id) { "ID123" }
|
142
|
+
|
143
|
+
subject(:get_response) { client.payouts.get(id) }
|
144
|
+
|
145
|
+
context "when there is a payout to return" do
|
146
|
+
before do
|
147
|
+
stub_request(:get, /.*api.gocardless.com\/payouts\/ID123/).to_return(
|
148
|
+
body: {
|
149
|
+
payouts: {
|
150
|
+
|
151
|
+
"amount" => "amount-input",
|
152
|
+
"created_at" => "created_at-input",
|
153
|
+
"currency" => "currency-input",
|
154
|
+
"id" => "id-input",
|
155
|
+
"links" => "links-input",
|
156
|
+
"reference" => "reference-input",
|
157
|
+
"status" => "status-input",
|
158
|
+
}
|
159
|
+
}.to_json,
|
160
|
+
:headers => {'Content-Type' => 'application/json'}
|
161
|
+
)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "wraps the response in a resource" do
|
165
|
+
expect(get_response).to be_a(GoCardless::Resources::Payout)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
end
|
@@ -0,0 +1,336 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoCardless::Services::PublishableApiKeyService do
|
4
|
+
let(:client) do
|
5
|
+
GoCardless::Client.new(
|
6
|
+
api_key: "AK123",
|
7
|
+
api_secret: "ABC"
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
describe "#create" do
|
17
|
+
subject(:post_create_response) { client.publishable_api_keys.create(new_resource) }
|
18
|
+
context "with a valid request" do
|
19
|
+
let(:new_resource) do
|
20
|
+
{
|
21
|
+
|
22
|
+
"created_at" => "created_at-input",
|
23
|
+
"enabled" => "enabled-input",
|
24
|
+
"id" => "id-input",
|
25
|
+
"key" => "key-input",
|
26
|
+
"name" => "name-input",
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
before do
|
31
|
+
stub_request(:post, /.*api.gocardless.com\/publishable_api_keys/).
|
32
|
+
with(
|
33
|
+
body: {
|
34
|
+
publishable_api_keys: {
|
35
|
+
|
36
|
+
"created_at" => "created_at-input",
|
37
|
+
"enabled" => "enabled-input",
|
38
|
+
"id" => "id-input",
|
39
|
+
"key" => "key-input",
|
40
|
+
"name" => "name-input",
|
41
|
+
}
|
42
|
+
}
|
43
|
+
).
|
44
|
+
to_return(
|
45
|
+
body: {
|
46
|
+
publishable_api_keys: {
|
47
|
+
|
48
|
+
"created_at" => "created_at-input",
|
49
|
+
"enabled" => "enabled-input",
|
50
|
+
"id" => "id-input",
|
51
|
+
"key" => "key-input",
|
52
|
+
"name" => "name-input",
|
53
|
+
}
|
54
|
+
}.to_json,
|
55
|
+
:headers => {'Content-Type' => 'application/json'}
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "creates and returns the resource" do
|
60
|
+
expect(post_create_response).to be_a(GoCardless::Resources::PublishableApiKey)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "with a request that returns a validation error" do
|
65
|
+
let(:new_resource) { {} }
|
66
|
+
|
67
|
+
before do
|
68
|
+
stub_request(:post, /.*api.gocardless.com\/publishable_api_keys/).to_return(
|
69
|
+
body: {
|
70
|
+
error: {
|
71
|
+
type: 'validation_failed',
|
72
|
+
code: 422,
|
73
|
+
errors: [
|
74
|
+
{ message: 'test error message', field: 'test_field' }
|
75
|
+
]
|
76
|
+
}
|
77
|
+
}.to_json,
|
78
|
+
headers: {'Content-Type' => 'application/json'},
|
79
|
+
status: 422
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "throws the correct error" do
|
84
|
+
expect { post_create_response }.to raise_error(GoCardless::ValidationError)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
describe "#list" do
|
94
|
+
describe "with no filters" do
|
95
|
+
subject(:get_list_response) { client.publishable_api_keys.list }
|
96
|
+
|
97
|
+
before do
|
98
|
+
stub_request(:get, /.*api.gocardless.com\/publishable_api_keys/).to_return(
|
99
|
+
body: {
|
100
|
+
publishable_api_keys: [{
|
101
|
+
|
102
|
+
"created_at" => "created_at-input",
|
103
|
+
"enabled" => "enabled-input",
|
104
|
+
"id" => "id-input",
|
105
|
+
"key" => "key-input",
|
106
|
+
"name" => "name-input",
|
107
|
+
}],
|
108
|
+
meta: {
|
109
|
+
cursors: {
|
110
|
+
before: nil,
|
111
|
+
after: "ABC123"
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}.to_json,
|
115
|
+
:headers => {'Content-Type' => 'application/json'}
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "wraps each item in the resource class" do
|
120
|
+
expect(get_list_response.map { |x| x.class }.uniq.first).to eq(GoCardless::Resources::PublishableApiKey)
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
expect(get_list_response.first.created_at).to eq("created_at-input")
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
expect(get_list_response.first.enabled).to eq("enabled-input")
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
expect(get_list_response.first.id).to eq("id-input")
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
expect(get_list_response.first.key).to eq("key-input")
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
expect(get_list_response.first.name).to eq("name-input")
|
141
|
+
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
it "exposes the cursors for before and after" do
|
146
|
+
expect(get_list_response.before).to eq(nil)
|
147
|
+
expect(get_list_response.after).to eq("ABC123")
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "#all" do
|
153
|
+
let!(:first_response_stub) do
|
154
|
+
stub_request(:get, /.*api.gocardless.com\/publishable_api_keys$/).to_return(
|
155
|
+
body: {
|
156
|
+
publishable_api_keys: [{
|
157
|
+
|
158
|
+
"created_at" => "created_at-input",
|
159
|
+
"enabled" => "enabled-input",
|
160
|
+
"id" => "id-input",
|
161
|
+
"key" => "key-input",
|
162
|
+
"name" => "name-input",
|
163
|
+
}],
|
164
|
+
meta: {
|
165
|
+
cursors: { after: 'AB345' },
|
166
|
+
limit: 1
|
167
|
+
}
|
168
|
+
}.to_json,
|
169
|
+
:headers => {'Content-Type' => 'application/json'}
|
170
|
+
)
|
171
|
+
end
|
172
|
+
|
173
|
+
let!(:second_response_stub) do
|
174
|
+
stub_request(:get, /.*api.gocardless.com\/publishable_api_keys\?after=AB345/).to_return(
|
175
|
+
body: {
|
176
|
+
publishable_api_keys: [{
|
177
|
+
|
178
|
+
"created_at" => "created_at-input",
|
179
|
+
"enabled" => "enabled-input",
|
180
|
+
"id" => "id-input",
|
181
|
+
"key" => "key-input",
|
182
|
+
"name" => "name-input",
|
183
|
+
}],
|
184
|
+
meta: {
|
185
|
+
limit: 2,
|
186
|
+
cursors: {}
|
187
|
+
}
|
188
|
+
}.to_json,
|
189
|
+
:headers => {'Content-Type' => 'application/json'}
|
190
|
+
)
|
191
|
+
end
|
192
|
+
|
193
|
+
it "automatically makes the extra requests" do
|
194
|
+
expect(client.publishable_api_keys.all.to_a.length).to eq(2)
|
195
|
+
expect(first_response_stub).to have_been_requested
|
196
|
+
expect(second_response_stub).to have_been_requested
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
describe "#get" do
|
206
|
+
let(:id) { "ID123" }
|
207
|
+
|
208
|
+
subject(:get_response) { client.publishable_api_keys.get(id) }
|
209
|
+
|
210
|
+
context "when there is a publishable_api_key to return" do
|
211
|
+
before do
|
212
|
+
stub_request(:get, /.*api.gocardless.com\/publishable_api_keys\/ID123/).to_return(
|
213
|
+
body: {
|
214
|
+
publishable_api_keys: {
|
215
|
+
|
216
|
+
"created_at" => "created_at-input",
|
217
|
+
"enabled" => "enabled-input",
|
218
|
+
"id" => "id-input",
|
219
|
+
"key" => "key-input",
|
220
|
+
"name" => "name-input",
|
221
|
+
}
|
222
|
+
}.to_json,
|
223
|
+
:headers => {'Content-Type' => 'application/json'}
|
224
|
+
)
|
225
|
+
end
|
226
|
+
|
227
|
+
it "wraps the response in a resource" do
|
228
|
+
expect(get_response).to be_a(GoCardless::Resources::PublishableApiKey)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
describe "#update" do
|
239
|
+
subject(:put_update_response) { client.publishable_api_keys.update(id, update_params) }
|
240
|
+
let(:id) { "ABC123" }
|
241
|
+
|
242
|
+
context "with a valid request" do
|
243
|
+
let(:update_params) { { "hello" => "world" } }
|
244
|
+
|
245
|
+
let!(:stub) do
|
246
|
+
stub_request(:put, /.*api.gocardless.com\/publishable_api_keys\/ABC123/).to_return(
|
247
|
+
body: {
|
248
|
+
publishable_api_keys: {
|
249
|
+
|
250
|
+
"created_at" => "created_at-input",
|
251
|
+
"enabled" => "enabled-input",
|
252
|
+
"id" => "id-input",
|
253
|
+
"key" => "key-input",
|
254
|
+
"name" => "name-input",
|
255
|
+
}
|
256
|
+
}.to_json,
|
257
|
+
:headers => {'Content-Type' => 'application/json'}
|
258
|
+
)
|
259
|
+
end
|
260
|
+
|
261
|
+
it "updates and returns the resource" do
|
262
|
+
expect(put_update_response).to be_a(GoCardless::Resources::PublishableApiKey)
|
263
|
+
expect(stub).to have_been_requested
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
describe "#disable" do
|
273
|
+
|
274
|
+
|
275
|
+
subject(:post_response) { client.publishable_api_keys.disable(resource_id) }
|
276
|
+
|
277
|
+
let(:resource_id) { "ABC123" }
|
278
|
+
|
279
|
+
let!(:stub) do
|
280
|
+
# /publishable_api_keys/%v/actions/disable
|
281
|
+
stub_url = "/publishable_api_keys/:identity/actions/disable".gsub(':identity', resource_id)
|
282
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).to_return(
|
283
|
+
body: {
|
284
|
+
publishable_api_keys: {
|
285
|
+
|
286
|
+
"created_at" => "created_at-input",
|
287
|
+
"enabled" => "enabled-input",
|
288
|
+
"id" => "id-input",
|
289
|
+
"key" => "key-input",
|
290
|
+
"name" => "name-input",
|
291
|
+
}
|
292
|
+
}.to_json,
|
293
|
+
headers: {'Content-Type' => 'application/json'},
|
294
|
+
)
|
295
|
+
end
|
296
|
+
|
297
|
+
it "wraps the response and calls the right endpoint" do
|
298
|
+
expect(post_response).to be_a(GoCardless::Resources::PublishableApiKey)
|
299
|
+
|
300
|
+
expect(stub).to have_been_requested
|
301
|
+
end
|
302
|
+
|
303
|
+
context "when the request needs a body and custom header" do
|
304
|
+
|
305
|
+
let(:body) { { foo: 'bar' } }
|
306
|
+
let(:headers) { { 'Foo' => 'Bar' } }
|
307
|
+
subject(:post_response) { client.publishable_api_keys.disable(resource_id, body, headers) }
|
308
|
+
|
309
|
+
let(:resource_id) { "ABC123" }
|
310
|
+
|
311
|
+
let!(:stub) do
|
312
|
+
# /publishable_api_keys/%v/actions/disable
|
313
|
+
stub_url = "/publishable_api_keys/:identity/actions/disable".gsub(':identity', resource_id)
|
314
|
+
stub_request(:post, /.*api.gocardless.com#{stub_url}/).
|
315
|
+
with(
|
316
|
+
body: { foo: 'bar' },
|
317
|
+
headers: { 'Foo' => 'Bar' }
|
318
|
+
).to_return(
|
319
|
+
body: {
|
320
|
+
publishable_api_keys: {
|
321
|
+
|
322
|
+
"created_at" => "created_at-input",
|
323
|
+
"enabled" => "enabled-input",
|
324
|
+
"id" => "id-input",
|
325
|
+
"key" => "key-input",
|
326
|
+
"name" => "name-input",
|
327
|
+
}
|
328
|
+
}.to_json,
|
329
|
+
headers: {'Content-Type' => 'application/json'},
|
330
|
+
)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
|
336
|
+
end
|