stripe 1.19.0 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,11 @@
1
+ === 1.20.0 2015-02-19
2
+
3
+ * Added Update & Delete operations to Bitcoin Receivers
4
+
5
+ === 1.19.1 2015-02-18
6
+
7
+ * Fixed fetching upcoming invoice/paying invoice methods
8
+
1
9
  === 1.19.0 2015-02-15
2
10
 
3
11
  * Support for new Transfers /reversals endpoint
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.19.0
1
+ 1.20.0
@@ -1,10 +1,20 @@
1
1
  module Stripe
2
2
  class BitcoinReceiver < APIResource
3
3
  include Stripe::APIOperations::Create
4
+ include Stripe::APIOperations::Update
5
+ include Stripe::APIOperations::Delete
4
6
  include Stripe::APIOperations::List
5
7
 
6
8
  def self.url
7
9
  "/v1/bitcoin/receivers"
8
10
  end
11
+
12
+ def url
13
+ if respond_to?(:customer)
14
+ "#{Customer.url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
15
+ else
16
+ "#{self.class.url}/#{CGI.escape(id)}"
17
+ end
18
+ end
9
19
  end
10
20
  end
@@ -5,13 +5,12 @@ module Stripe
5
5
  include Stripe::APIOperations::Create
6
6
 
7
7
  def self.upcoming(params, opts={})
8
- opts = Util.normalize_opts(opts)
9
- response, api_key = Stripe.request(:get, upcoming_url, opts, params)
8
+ response, opts = request(:get, upcoming_url, params, opts)
10
9
  Util.convert_to_stripe_object(response, opts)
11
10
  end
12
11
 
13
- def pay
14
- response, opts = Stripe.request(:post, pay_url, @opts, {})
12
+ def pay(opts={})
13
+ response, opts = request(:post, pay_url, {}, opts)
15
14
  refresh_from(response, opts)
16
15
  end
17
16
 
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = '1.19.0'
2
+ VERSION = '1.20.0'
3
3
  end
@@ -34,5 +34,28 @@ module Stripe
34
34
  transactions = receiver.transactions.all
35
35
  assert_equal(3, transactions.data.length)
36
36
  end
37
+
38
+ should "update should update a bitcoin receiver" do
39
+ @mock.expects(:get).once.returns(test_response(test_bitcoin_receiver))
40
+ @mock.expects(:post).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, "description=details").once.returns(test_response(test_bitcoin_receiver))
41
+ receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver)
42
+ receiver.refresh
43
+ receiver.description = "details"
44
+ receiver.save
45
+ end
46
+
47
+ should "delete a bitcoin receiver with no customer through top-level API" do
48
+ @mock.expects(:delete).with("#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_test_receiver", nil, nil).once.returns(test_response({:deleted => true, :id => "btcrcv_test_receiver"}))
49
+ receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver)
50
+ response = receiver.delete
51
+ assert(receiver.deleted)
52
+ end
53
+
54
+ should "delete a bitcoin receiver with a customer through customer's subresource API" do
55
+ @mock.expects(:delete).with("#{Stripe.api_base}/v1/customers/customer_foo/sources/btcrcv_test_receiver", nil, nil).once.returns(test_response({:deleted => true, :id => "btcrcv_test_receiver"}))
56
+ receiver = Stripe::BitcoinReceiver.construct_from(test_bitcoin_receiver(:customer => 'customer_foo'))
57
+ response = receiver.delete
58
+ assert(receiver.deleted)
59
+ end
37
60
  end
38
61
  end
@@ -22,5 +22,19 @@ module Stripe
22
22
  i.pay
23
23
  assert_equal nil, i.next_payment_attempt
24
24
  end
25
+
26
+ should "pay with extra opts should pay an invoice" do
27
+ @mock.expects(:get).once.returns(test_response(test_invoice))
28
+ i = Stripe::Invoice.retrieve('in_test_invoice', {:api_key => 'foobar'})
29
+
30
+ Stripe.expects(:execute_request).with do |opts|
31
+ opts[:url] == "#{Stripe.api_base}/v1/invoices/in_test_invoice/pay" &&
32
+ opts[:method] == :post &&
33
+ opts[:headers][:authorization] == 'Bearer foobar'
34
+ end.returns(test_response(test_paid_invoice))
35
+
36
+ i.pay
37
+ assert_equal nil, i.next_payment_attempt
38
+ end
25
39
  end
26
40
  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.19.0
4
+ version: 1.20.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-02-16 00:00:00.000000000 Z
13
+ date: 2015-02-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -268,4 +268,3 @@ test_files:
268
268
  - test/stripe/util_test.rb
269
269
  - test/test_data.rb
270
270
  - test/test_helper.rb
271
- has_rdoc: