gocardless 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ ## 1.8.0 - June 12, 2013
2
+
3
+ - Add Client#api_delete
4
+
1
5
  ## 1.7.0 - April 19, 2013
2
6
 
3
7
  - Adds `retry!` method to Bill, allowing you to re-attempt collection where a
@@ -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
@@ -1,3 +1,3 @@
1
1
  module GoCardless
2
- VERSION = '1.7.0'.freeze
2
+ VERSION = '1.8.0'.freeze
3
3
  end
@@ -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.api_get '/' }.to raise_exception GoCardless::ClientError
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.7.0
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-04-19 00:00:00.000000000 Z
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