gocardless 1.2.1 → 1.3.0

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.3.0 - August 30, 2012
2
+
3
+ - Add cancel! method to pre_authorization
4
+ - Add paid_at accessor to the bill resource
5
+
1
6
  ## 1.2.1 - July 11, 2012
2
7
 
3
8
  - Fix bug which caused Client#merchant to fail after #fetch_access_token was
@@ -16,7 +16,7 @@ module GoCardless
16
16
  attr_accessor :source_id
17
17
 
18
18
  reference_accessor :merchant_id, :user_id, :payment_id
19
- date_accessor :created_at
19
+ date_accessor :created_at, :paid_at
20
20
 
21
21
  def source
22
22
  klass = GoCardless.const_get(Utils.camelize(source_type.to_s))
@@ -25,6 +25,12 @@ module GoCardless
25
25
  def create_bill(attrs)
26
26
  Bill.new_with_client(client, attrs.merge(:source => self)).save
27
27
  end
28
+
29
+ def cancel!
30
+ path = self.class.endpoint.gsub(':id', id.to_s) + '/cancel'
31
+ client.api_put(path)
32
+ end
33
+
28
34
  end
29
35
  end
30
36
 
@@ -1,3 +1,3 @@
1
1
  module GoCardless
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe GoCardless::PreAuthorization do
4
+ before :each do
5
+ @app_id = 'abc'
6
+ @app_secret = 'xyz'
7
+ GoCardless.account_details = {:app_id => @app_id, :app_secret => @app_secret,
8
+ :token => 'xxx manage_merchant:1'}
9
+ @client = GoCardless.client
10
+ end
11
+
12
+ it "should be cancellable" do
13
+ s = GoCardless::PreAuthorization.new_with_client(@client, :id => '009988')
14
+ @client.expects(:api_put).with('/pre_authorizations/009988/cancel')
15
+ s.cancel!
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gocardless
3
3
  version: !ruby/object:Gem::Version
4
- hash: 849635752354842289
4
+ hash: 1414572536435516772
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 2
9
- - 1
10
- version: 1.2.1
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Harry Marr
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-07-11 00:00:00 Z
19
+ date: 2012-08-30 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: oauth2
@@ -147,6 +147,7 @@ files:
147
147
  - spec/client_spec.rb
148
148
  - spec/gocardless_spec.rb
149
149
  - spec/merchant_spec.rb
150
+ - spec/pre_authorization_spec.rb
150
151
  - spec/resource_spec.rb
151
152
  - spec/spec_helper.rb
152
153
  - spec/subscription_spec.rb
@@ -189,6 +190,7 @@ test_files:
189
190
  - spec/client_spec.rb
190
191
  - spec/gocardless_spec.rb
191
192
  - spec/merchant_spec.rb
193
+ - spec/pre_authorization_spec.rb
192
194
  - spec/resource_spec.rb
193
195
  - spec/spec_helper.rb
194
196
  - spec/subscription_spec.rb