gocardless 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/gocardless/client.rb +10 -0
- data/lib/gocardless/version.rb +1 -1
- data/spec/client_spec.rb +16 -1
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/lib/gocardless/client.rb
CHANGED
@@ -140,6 +140,16 @@ module GoCardless
|
|
140
140
|
request(:put, "#{API_PATH}#{path}", :data => data).parsed
|
141
141
|
end
|
142
142
|
|
143
|
+
# Issue a DELETE request to the API server
|
144
|
+
#
|
145
|
+
# @note this method is for internal use
|
146
|
+
# @param [String] path the path that will be added to the API prefix
|
147
|
+
# @param [Hash] data a hash of data that will be sent as the request body
|
148
|
+
# @return [Hash] hash the parsed response data
|
149
|
+
def api_delete(path, data = {})
|
150
|
+
request(:delete, "#{API_PATH}#{path}", :data => data).parsed
|
151
|
+
end
|
152
|
+
|
143
153
|
# @method merchant
|
144
154
|
# @return [Merchant] the merchant associated with the client's access token
|
145
155
|
def merchant
|
data/lib/gocardless/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -204,7 +204,22 @@ describe GoCardless::Client do
|
|
204
204
|
end
|
205
205
|
|
206
206
|
it "fails without an access_token" do
|
207
|
-
expect { @client.
|
207
|
+
expect { @client.api_post '/' }.to raise_exception GoCardless::ClientError
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe "#api_delete" do
|
212
|
+
it "encodes data to json" do
|
213
|
+
@client.access_token = 'TOKEN123'
|
214
|
+
token = @client.instance_variable_get(:@access_token)
|
215
|
+
r = mock
|
216
|
+
r.stubs(:parsed)
|
217
|
+
token.expects(:delete).with { |p,opts| opts[:body] == '{"a":1}' }.returns(r)
|
218
|
+
@client.api_delete('/test', {:a => 1})
|
219
|
+
end
|
220
|
+
|
221
|
+
it "fails without an access_token" do
|
222
|
+
expect { @client.api_delete '/' }.to raise_exception GoCardless::ClientError
|
208
223
|
end
|
209
224
|
end
|
210
225
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gocardless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: 1.8.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Harry Marr
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|