stripe 1.37.0 → 1.38.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5af575546f483b85a46fef6fbc1da6b579e3d02
4
- data.tar.gz: 2a8e4a5d3e66143ecbcad1cc9be2201c04fa97b0
3
+ metadata.gz: 004d768dc2a4f11d96636a68dff3e31891d2e27a
4
+ data.tar.gz: d7f1a7fa8310ae02dcd6994ece7499558a4d65a5
5
5
  SHA512:
6
- metadata.gz: 6275388dfaab2973e5348419e74dfff51f877a7f4d2afe8c5833e899d01a4894589d9dd101c54bc895609759708c8017396a39595af67191578d4ebe4e1d7aad
7
- data.tar.gz: 0cb84f50554816a08071e420fbde8735fe3ab5bb9772504c8992d259d59928c71324f8b73676c13d17a301e3fb16024876a3d08196fa329d9e8552b13c24906f
6
+ metadata.gz: 90fa0546b9523e82eeca3dbbdc940dceeb2bf75ddb275d800b1eb53a8d4774333cbbc843d8a3fa9d4d976dd9b6080b6cfcf9af27a031415e1372d20d21aaf450
7
+ data.tar.gz: a0b56c9de14ced6bedd61463c30c32175363bf8a05ab5ef8d70089c8c5d30abcafa44684bd8446c35e7b9ec2b32e83dfed43842a28a5c70303b55197f1980477
@@ -1,3 +1,7 @@
1
+ === 1.38.0 2016-03-18
2
+
3
+ * Allow `opts` to be passed to an API resource's `#save` method
4
+
1
5
  === 1.37.0 2016-03-14
2
6
 
3
7
  * Add `Account#reject` to support the new API feature
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.37.0
1
+ 1.38.0
@@ -13,7 +13,11 @@ module Stripe
13
13
  # and includes them in the create or update. If +:req_url:+ is included
14
14
  # in the list, it overrides the update URL used for the create or
15
15
  # update.
16
- def save(params={})
16
+ # * +opts+ - A Hash of additional options (separate from the params /
17
+ # object values) to be added to the request. E.g. to allow for an
18
+ # idempotency_key to be passed in the request headers, or for the
19
+ # api_key to be overwritten. See {APIOperations::Request.request}.
20
+ def save(params={}, opts={})
17
21
  # We started unintentionally (sort of) allowing attributes sent to
18
22
  # +save+ to override values used during the update. So as not to break
19
23
  # the API, this makes that official here.
@@ -28,7 +32,7 @@ module Stripe
28
32
  # generated a uri for this object with an identifier baked in
29
33
  values.delete(:id)
30
34
 
31
- response, opts = request(:post, save_url, values)
35
+ response, opts = request(:post, save_url, values, opts)
32
36
  initialize_from(response, opts)
33
37
 
34
38
  self
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = '1.37.0'
2
+ VERSION = '1.38.0'
3
3
  end
@@ -387,6 +387,31 @@ module Stripe
387
387
  assert_equal false, c.livemode
388
388
  end
389
389
 
390
+ should "updating should send along the idempotency-key header" do
391
+ Stripe.expects(:execute_request).with do |opts|
392
+ opts[:headers][:idempotency_key] == 'bar'
393
+ end.returns(make_response(make_customer))
394
+ c = Stripe::Customer.new
395
+ c.save({}, { :idempotency_key => 'bar' })
396
+ assert_equal false, c.livemode
397
+ end
398
+
399
+ should "updating should fail if api_key is overwritten with nil" do
400
+ c = Stripe::Customer.new
401
+ assert_raises TypeError do
402
+ c.save({}, { :api_key => nil })
403
+ end
404
+ end
405
+
406
+ should "updating should use the supplied api_key" do
407
+ Stripe.expects(:execute_request).with do |opts|
408
+ opts[:headers][:authorization] == 'Bearer sk_test_local'
409
+ end.returns(make_response(make_customer))
410
+ c = Stripe::Customer.new
411
+ c.save({}, { :api_key => 'sk_test_local' })
412
+ assert_equal false, c.livemode
413
+ end
414
+
390
415
  should "deleting should send no props and result in an object that has no props other deleted" do
391
416
  @mock.expects(:get).never
392
417
  @mock.expects(:post).never
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.37.0
4
+ version: 1.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Boucher
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-14 00:00:00.000000000 Z
12
+ date: 2016-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client