stripe 2.0.0 → 2.0.1
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.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/VERSION +1 -1
- data/lib/stripe/file_upload.rb +7 -0
- data/lib/stripe/stripe_client.rb +1 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/file_upload_test.rb +20 -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: a6976080db5adc63ee2fff43e9989efa8cef6cc7
|
4
|
+
data.tar.gz: 389401fb74381ee49ecf96eddc8284fe89c46224
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2477c896c1807860c70af296220bf5ce630bae87c445caa3805a6b195068debc2990c8eaa08799f2f5e37b064c0d3b770119a4bbf9ca1be8c34f91d948f558
|
7
|
+
data.tar.gz: 6bf766bbdb91c02f6e709b7baa355d3b7868ce1882eea0bdb186b0f45a8969a8e93e79003df9072de14cfcc26da160f014fe1a252f2e48ab7d70526cb9f4331f
|
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.1
|
data/lib/stripe/file_upload.rb
CHANGED
@@ -15,6 +15,13 @@ module Stripe
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.create(params={}, opts={})
|
18
|
+
# rest-client would accept a vanilla `File` for upload, but Faraday does
|
19
|
+
# not. Support the old API by wrapping a `File` with an `UploadIO` object
|
20
|
+
# if we're given one.
|
21
|
+
if params[:file] && params[:file].is_a?(File)
|
22
|
+
params[:file] = Faraday::UploadIO.new(params[:file], nil)
|
23
|
+
end
|
24
|
+
|
18
25
|
opts = {
|
19
26
|
:content_type => 'multipart/form-data',
|
20
27
|
}.merge(Util.normalize_opts(opts))
|
data/lib/stripe/stripe_client.rb
CHANGED
@@ -29,6 +29,7 @@ module Stripe
|
|
29
29
|
# object per thread.
|
30
30
|
Thread.current[:stripe_client_default_conn] ||= begin
|
31
31
|
conn = Faraday.new do |c|
|
32
|
+
c.use Faraday::Request::Multipart
|
32
33
|
c.use Faraday::Request::UrlEncoded
|
33
34
|
c.use Faraday::Response::RaiseError
|
34
35
|
c.adapter Faraday.default_adapter
|
data/lib/stripe/version.rb
CHANGED
@@ -35,7 +35,11 @@ module Stripe
|
|
35
35
|
|
36
36
|
should "be creatable" do
|
37
37
|
stub_request(:post, "#{Stripe.uploads_base}/v1/files").
|
38
|
-
|
38
|
+
with(:headers => {
|
39
|
+
"Content-Type" => %r|\A#{Faraday::Request::Multipart.mime_type}|
|
40
|
+
}) { |request|
|
41
|
+
request.body =~ /FileUploadTest/
|
42
|
+
}.to_return(body: JSON.generate(FIXTURE))
|
39
43
|
|
40
44
|
file = Stripe::FileUpload.create(
|
41
45
|
purpose: "dispute_evidence",
|
@@ -43,5 +47,20 @@ module Stripe
|
|
43
47
|
)
|
44
48
|
assert file.kind_of?(Stripe::FileUpload)
|
45
49
|
end
|
50
|
+
|
51
|
+
should "be creatable with Faraday::UploadIO" do
|
52
|
+
stub_request(:post, "#{Stripe.uploads_base}/v1/files").
|
53
|
+
with(:headers => {
|
54
|
+
"Content-Type" => %r|\A#{Faraday::Request::Multipart.mime_type}|
|
55
|
+
}) { |request|
|
56
|
+
request.body =~ /FileUploadTest/
|
57
|
+
}.to_return(body: JSON.generate(FIXTURE))
|
58
|
+
|
59
|
+
file = Stripe::FileUpload.create(
|
60
|
+
purpose: "dispute_evidence",
|
61
|
+
file: Faraday::UploadIO.new(File.new(__FILE__), nil),
|
62
|
+
)
|
63
|
+
assert file.kind_of?(Stripe::FileUpload)
|
64
|
+
end
|
46
65
|
end
|
47
66
|
end
|
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.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|