stripe 1.50.0 → 1.50.1
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/README.md +47 -2
- data/VERSION +1 -1
- data/lib/stripe/util.rb +1 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/account_test.rb +1 -1
- data/test/stripe/util_test.rb +6 -6
- 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: d7a6e05be384fc9ff98e33581d00aeb9deead4fb
|
4
|
+
data.tar.gz: 4dde279ff2795efc7d7607b0772ca594fa4afd26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0773fbcc58390263df79f5d53b186689b4f6b95ca22463502b99754c47227f49610d92e85fb48a529f38c05ceb23ea2c7769582b17179ea9352dc9a8a68ac8a4
|
7
|
+
data.tar.gz: 260b73c85e24a8fc19fede4dd078e3b84ecb217b0edcb5f720c33cbf20ba9778ed006d1ef721c46a89147893a4599bee29aaade8e9686d4a81bed0cdf4399e35
|
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -30,12 +30,12 @@ If you want to build the gem from source:
|
|
30
30
|
|
31
31
|
gem build stripe.gemspec
|
32
32
|
|
33
|
-
|
33
|
+
### Requirements
|
34
34
|
|
35
35
|
* Ruby 1.9.3 or above.
|
36
36
|
* rest-client
|
37
37
|
|
38
|
-
|
38
|
+
### Bundler
|
39
39
|
|
40
40
|
If you are installing via bundler, you should be sure to use the https rubygems
|
41
41
|
source in your Gemfile, as any gems fetched over http could potentially be
|
@@ -48,6 +48,50 @@ gem 'rails'
|
|
48
48
|
gem 'stripe'
|
49
49
|
```
|
50
50
|
|
51
|
+
## Usage
|
52
|
+
|
53
|
+
The library needs to be configured with your account's secret key which is
|
54
|
+
available in the [Dashboard][dashboard]. Assign its value to `Stripe.api_key`
|
55
|
+
and the library will send it along automatically with every request:
|
56
|
+
|
57
|
+
``` ruby
|
58
|
+
require "stripe"
|
59
|
+
Stripe.api_key = "sk_test_..."
|
60
|
+
|
61
|
+
# list charges
|
62
|
+
Stripe::Charge.list()
|
63
|
+
|
64
|
+
# retrieve single charge
|
65
|
+
Stripe::Charge.retrieve(
|
66
|
+
"ch_18atAXCdGbJFKhCuBAa4532Z",
|
67
|
+
)
|
68
|
+
```
|
69
|
+
|
70
|
+
You can also set a per-request key and/or account like in the examples below.
|
71
|
+
This is often useful for Connect applications that use multiple API keys during
|
72
|
+
the lifetime of a process.
|
73
|
+
|
74
|
+
Authentication is transparently handled for you in subsequent method calls on
|
75
|
+
the returned object.
|
76
|
+
|
77
|
+
For example:
|
78
|
+
|
79
|
+
``` ruby
|
80
|
+
require "stripe"
|
81
|
+
|
82
|
+
Stripe::Charge.list(
|
83
|
+
{},
|
84
|
+
:api_key => "sk_test_...",
|
85
|
+
:stripe_account => "acct_..."
|
86
|
+
)
|
87
|
+
|
88
|
+
Stripe::Charge.retrieve(
|
89
|
+
"ch_18atAXCdGbJFKhCuBAa4532Z",
|
90
|
+
:api_key => "sk_test_...",
|
91
|
+
:stripe_account => "acct_..."
|
92
|
+
)
|
93
|
+
```
|
94
|
+
|
51
95
|
## Development
|
52
96
|
|
53
97
|
Run all tests:
|
@@ -87,3 +131,4 @@ Example:
|
|
87
131
|
Stripe.max_network_retries = 2
|
88
132
|
|
89
133
|
[curl]: http://curl.haxx.se/docs/caextract.html
|
134
|
+
[dashboard]: https://dashboard.stripe.com/account
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.50.
|
1
|
+
1.50.1
|
data/lib/stripe/util.rb
CHANGED
@@ -135,7 +135,7 @@ module Stripe
|
|
135
135
|
|
136
136
|
# do not sort the final output because arrays (and arrays of hashes
|
137
137
|
# especially) can be order sensitive, but do sort incoming parameters
|
138
|
-
params.
|
138
|
+
params.each do |key, value|
|
139
139
|
calculated_key = parent_key ? "#{parent_key}[#{key}]" : "#{key}"
|
140
140
|
if value.is_a?(Hash)
|
141
141
|
result += flatten_params(value, calculated_key)
|
data/lib/stripe/version.rb
CHANGED
data/test/stripe/account_test.rb
CHANGED
@@ -105,7 +105,7 @@ module Stripe
|
|
105
105
|
}
|
106
106
|
@mock.expects(:post).
|
107
107
|
once.
|
108
|
-
with('https://api.stripe.com/v1/accounts/acct_foo', nil, 'legal_entity[address][line1]=2+Three+Four
|
108
|
+
with('https://api.stripe.com/v1/accounts/acct_foo', nil, 'legal_entity[first_name]=Bob&legal_entity[address][line1]=2+Three+Four').
|
109
109
|
returns(make_response(resp))
|
110
110
|
|
111
111
|
a = Stripe::Account.update('acct_foo', :legal_entity => {
|
data/test/stripe/util_test.rb
CHANGED
@@ -36,8 +36,8 @@ module Stripe
|
|
36
36
|
[:d, { :a => "a", :b => "b" }],
|
37
37
|
[:e, [0, 1]],
|
38
38
|
[:f, [
|
39
|
-
{ :
|
40
|
-
{ :
|
39
|
+
{ :foo => "1", :ghi => "2" },
|
40
|
+
{ :foo => "3", :bar => "4" },
|
41
41
|
]],
|
42
42
|
]
|
43
43
|
assert_equal([
|
@@ -52,10 +52,10 @@ module Stripe
|
|
52
52
|
# *The key here is the order*. In order to be properly interpreted as
|
53
53
|
# an array of hashes on the server, everything from a single hash must
|
54
54
|
# come in at once. A duplicate key in an array triggers a new element.
|
55
|
-
["f[][
|
56
|
-
["f[][
|
57
|
-
["f[][
|
58
|
-
["f[][
|
55
|
+
["f[][foo]", "1"],
|
56
|
+
["f[][ghi]", "2"],
|
57
|
+
["f[][foo]", "3"],
|
58
|
+
["f[][bar]", "4"],
|
59
59
|
], Stripe::Util.flatten_params(params))
|
60
60
|
end
|
61
61
|
|
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: 1.50.
|
4
|
+
version: 1.50.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|