stripe 2.10.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/VERSION +1 -1
- data/lib/stripe/api_operations/request.rb +15 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/api_resource_test.rb +27 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6354295ff3cc3d9d5b42cfd49aaa9371cdac40a8
|
4
|
+
data.tar.gz: 9b306be44b4df38c53ac0db5ba98101135958b8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72fe2684cc86a668f417ec87156c79e84401dbbc72b33d46836eee737e427ddfb838ad78cb4fe6517d3e064e4ffd9538d3634fc153def9ca874b60a3ddb505dc
|
7
|
+
data.tar.gz: 073939a037d90f8daf19740cf639c1a1aa09e9996b1510e2eb2ce79fccd083f757d7211d6034a16b0704b199895d0a53108995143a813e28be6abf209b4aaf77
|
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.11.0
|
@@ -5,6 +5,8 @@ module Stripe
|
|
5
5
|
OPTS_KEYS_TO_PERSIST = Set[:api_key, :api_base, :client, :stripe_account, :stripe_version]
|
6
6
|
|
7
7
|
def request(method, url, params={}, opts={})
|
8
|
+
warn_on_opts_in_params(params)
|
9
|
+
|
8
10
|
opts = Util.normalize_opts(opts)
|
9
11
|
opts[:client] ||= StripeClient.active_client
|
10
12
|
|
@@ -30,6 +32,19 @@ module Stripe
|
|
30
32
|
|
31
33
|
[resp, opts_to_persist]
|
32
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
KNOWN_OPTS = Set[:api_key, :idempotency_key, :stripe_account, :stripe_version]
|
39
|
+
private_constant :KNOWN_OPTS
|
40
|
+
|
41
|
+
def warn_on_opts_in_params(params)
|
42
|
+
KNOWN_OPTS.each do |opt|
|
43
|
+
if params.has_key?(opt)
|
44
|
+
$stderr.puts("WARNING: #{opt} should be in opts instead of params.")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
33
48
|
end
|
34
49
|
|
35
50
|
def self.included(base)
|
data/lib/stripe/version.rb
CHANGED
@@ -182,11 +182,37 @@ module Stripe
|
|
182
182
|
Stripe::Charge.list(:count => nil, :offset => 5, :sad => false)
|
183
183
|
|
184
184
|
stub_request(:post, "#{Stripe.api_base}/v1/charges").
|
185
|
-
with(body: {
|
185
|
+
with(body: { 'amount' => '50', 'currency' => 'usd' }).
|
186
186
|
to_return(body: JSON.generate({ :count => 1, :data => [API_FIXTURES.fetch(:charge)] }))
|
187
187
|
Stripe::Charge.create(:amount => 50, :currency => 'usd', :card => { :number => nil })
|
188
188
|
end
|
189
189
|
|
190
|
+
should "not trigger a warning if a known opt, such as idempotency_key, is in opts" do
|
191
|
+
stub_request(:post, "#{Stripe.api_base}/v1/charges").
|
192
|
+
to_return(body: JSON.generate(API_FIXTURES.fetch(:charge)))
|
193
|
+
old_stderr = $stderr
|
194
|
+
$stderr = StringIO.new
|
195
|
+
begin
|
196
|
+
Stripe::Charge.create({ :amount => 100, :currency => 'usd', :card => 'sc_token' }, { :idempotency_key => '12345' })
|
197
|
+
assert $stderr.string.empty?
|
198
|
+
ensure
|
199
|
+
$stderr = old_stderr
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
should "trigger a warning if a known opt, such as idempotency_key, is in params" do
|
204
|
+
stub_request(:post, "#{Stripe.api_base}/v1/charges").
|
205
|
+
to_return(body: JSON.generate(API_FIXTURES.fetch(:charge)))
|
206
|
+
old_stderr = $stderr
|
207
|
+
$stderr = StringIO.new
|
208
|
+
begin
|
209
|
+
Stripe::Charge.create({ :amount => 100, :currency => 'usd', :card => 'sc_token', :idempotency_key => '12345' })
|
210
|
+
assert_match Regexp.new('WARNING:'), $stderr.string
|
211
|
+
ensure
|
212
|
+
$stderr = old_stderr
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
190
216
|
should "requesting with a unicode ID should result in a request" do
|
191
217
|
stub_request(:get, "#{Stripe.api_base}/v1/customers/%E2%98%83").
|
192
218
|
to_return(body: JSON.generate(make_missing_id_error), status: 404)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|