stripe 1.21.0 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,11 +6,17 @@ rvm:
6
6
  - 1.9.3
7
7
  - 2.0.0
8
8
  - 2.1
9
- - 2.2
9
+ - 2.2
10
+ - jruby-19mode
10
11
 
11
12
  gemfile:
12
13
  - gemfiles/default-with-activesupport.gemfile
13
14
  - gemfiles/json.gemfile
14
15
  - gemfiles/yajl.gemfile
15
16
 
17
+ matrix:
18
+ exclude:
19
+ - rvm: jruby-19mode
20
+ gemfile: gemfiles/yajl.gemfile
21
+
16
22
  sudo: false
@@ -1,3 +1,7 @@
1
+ === 1.22.0 2015-06-10
2
+
3
+ * Added support for bank accounts and debit cards in managed accounts (via the `external_accounts` param)
4
+
1
5
  === 1.21.0 2015-04-14
2
6
 
3
7
  * Remove TLS cert revocation check. (All pre-heartbleed certs have expired.)
@@ -1,5 +1,9 @@
1
1
  = Stripe Ruby bindings {<img src="https://travis-ci.org/stripe/stripe-ruby.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/stripe/stripe-ruby] {<img src="https://gemnasium.com/stripe/stripe-ruby.png" alt="Dependency Status" />}[https://gemnasium.com/stripe/stripe-ruby]
2
2
 
3
+ == Documentation
4
+
5
+ {Ruby API Docs}[https://stripe.com/docs/api/ruby#intro]
6
+
3
7
  == Installation
4
8
 
5
9
  You don't need this source code unless you want to modify the gem. If
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.21.0
1
+ 1.22.0
@@ -39,6 +39,7 @@ require 'stripe/token'
39
39
  require 'stripe/event'
40
40
  require 'stripe/transfer'
41
41
  require 'stripe/recipient'
42
+ require 'stripe/bank_account'
42
43
  require 'stripe/card'
43
44
  require 'stripe/subscription'
44
45
  require 'stripe/application_fee'
@@ -96,12 +97,12 @@ module Stripe
96
97
  request_opts = {:verify_ssl => OpenSSL::SSL::VERIFY_PEER,
97
98
  :ssl_ca_file => @ssl_bundle_path}
98
99
  else
100
+ request_opts = {:verify_ssl => false}
99
101
  unless @verify_ssl_warned
100
102
  @verify_ssl_warned = true
101
103
  $stderr.puts("WARNING: Running without SSL cert verification. " \
102
104
  "You should never do this in production. " \
103
105
  "Execute 'Stripe.verify_ssl_certs = true' to enable verification.")
104
- request_opts = {:verify_ssl => false}
105
106
  end
106
107
  end
107
108
 
@@ -0,0 +1,19 @@
1
+ module Stripe
2
+ class BankAccount < APIResource
3
+ include Stripe::APIOperations::Update
4
+ include Stripe::APIOperations::Delete
5
+ include Stripe::APIOperations::List
6
+
7
+ def url
8
+ if respond_to?(:customer)
9
+ "#{Customer.url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
10
+ elsif respond_to?(:account)
11
+ "#{Account.url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
12
+ end
13
+ end
14
+
15
+ def self.retrieve(id, opts=nil)
16
+ raise NotImplementedError.new("Bank accounts cannot be retrieved without an account ID. Retrieve a bank account using account.external_accounts.retrieve('card_id')")
17
+ end
18
+ end
19
+ end
@@ -9,11 +9,13 @@ module Stripe
9
9
  "#{Recipient.url}/#{CGI.escape(recipient)}/cards/#{CGI.escape(id)}"
10
10
  elsif respond_to?(:customer)
11
11
  "#{Customer.url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
12
+ elsif respond_to?(:account)
13
+ "#{Account.url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
12
14
  end
13
15
  end
14
16
 
15
17
  def self.retrieve(id, opts=nil)
16
- raise NotImplementedError.new("Cards cannot be retrieved without a customer ID. Retrieve a card using customer.cards.retrieve('card_id')")
18
+ raise NotImplementedError.new("Cards cannot be retrieved without a customer ID. Retrieve a card using customer.sources.retrieve('card_id')")
17
19
  end
18
20
  end
19
21
  end
@@ -25,6 +25,7 @@ module Stripe
25
25
  'application_fee' => ApplicationFee,
26
26
  'balance' => Balance,
27
27
  'balance_transaction' => BalanceTransaction,
28
+ 'bank_account' => BankAccount,
28
29
  'card' => Card,
29
30
  'charge' => Charge,
30
31
  'coupon' => Coupon,
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = '1.21.0'
2
+ VERSION = '1.22.0'
3
3
  end
@@ -78,5 +78,41 @@ module Stripe
78
78
  Stripe::Account.retrieve(:api_key => nil)
79
79
  end
80
80
  end
81
+
82
+ should "be able to create a bank account" do
83
+ resp = {
84
+ :id => 'acct_1234',
85
+ :external_accounts => {
86
+ :object => "list",
87
+ :url => "/v1/accounts/acct_1234/external_accounts",
88
+ :data => [],
89
+ }
90
+ }
91
+ @mock.expects(:get).once.returns(test_response(resp))
92
+ a = Stripe::Account.retrieve
93
+
94
+ @mock.expects(:post).
95
+ once.
96
+ with('https://api.stripe.com/v1/accounts/acct_1234/external_accounts', nil, 'external_account=btok_1234').
97
+ returns(test_response(resp))
98
+ a.external_accounts.create({:external_account => 'btok_1234'})
99
+ end
100
+
101
+ should "be able to retrieve a bank account" do
102
+ resp = {
103
+ :id => 'acct_1234',
104
+ :external_accounts => {
105
+ :object => "list",
106
+ :url => "/v1/accounts/acct_1234/external_accounts",
107
+ :data => [{
108
+ :id => "ba_1234",
109
+ :object => "bank_account",
110
+ }],
111
+ }
112
+ }
113
+ @mock.expects(:get).once.returns(test_response(resp))
114
+ a = Stripe::Account.retrieve
115
+ assert_equal(BankAccount, a.external_accounts.data[0].class)
116
+ end
81
117
  end
82
118
  end
@@ -53,5 +53,11 @@ module Stripe
53
53
  card = c.sources.create(:source => "tok_41YJ05ijAaWaFS")
54
54
  assert_equal "test_card", card.id
55
55
  end
56
+
57
+ should "raise if accessing Stripe::Card.retrieve directly" do
58
+ assert_raises NotImplementedError do
59
+ Stripe::Card.retrieve "card_12345"
60
+ end
61
+ end
56
62
  end
57
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.22.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-04-14 00:00:00.000000000 Z
13
+ date: 2015-06-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -144,6 +144,7 @@ files:
144
144
  - lib/stripe/application_fee_refund.rb
145
145
  - lib/stripe/balance.rb
146
146
  - lib/stripe/balance_transaction.rb
147
+ - lib/stripe/bank_account.rb
147
148
  - lib/stripe/bitcoin_receiver.rb
148
149
  - lib/stripe/bitcoin_transaction.rb
149
150
  - lib/stripe/card.rb
@@ -217,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
218
  version: '0'
218
219
  requirements: []
219
220
  rubyforge_project:
220
- rubygems_version: 1.8.23.2
221
+ rubygems_version: 1.8.23
221
222
  signing_key:
222
223
  specification_version: 3
223
224
  summary: Ruby bindings for the Stripe API