stripe 5.7.1 → 5.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/CODE_OF_CONDUCT.md +77 -0
- data/README.md +18 -0
- data/VERSION +1 -1
- data/lib/stripe/api_operations/request.rb +11 -0
- data/lib/stripe/object_types.rb +1 -0
- data/lib/stripe/resources.rb +1 -0
- data/lib/stripe/resources/mandate.rb +7 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/api_resource_test.rb +16 -0
- data/test/stripe/mandate_test.rb +14 -0
- data/test/test_helper.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5a17039dd8609885e953ff5fd576a532f77d02b555d6a3f5d1b6c8437252a34
|
4
|
+
data.tar.gz: c9ae5618e79a97607fd55563ecca60a3a79de58b5f46f99977c8ed28441b35e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6535270353329e05c49b0e3e7853cf096dd4e35ac1e677c781f9005c89a0432141176c5e68cde123381083237d9ff3d460a3fb82bb3373863950217c7496fc21
|
7
|
+
data.tar.gz: cfc98fa53ba0707c4ad798fc42a168a10eb4b62cb1e57cf6e08d17a9815d0a5c7bfd1057f6d2e40cc9a379210c12f11007c8ac3aafc307676a6e23445500a4ed
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.8.0 - 2019-11-05
|
4
|
+
* [#879](https://github.com/stripe/stripe-ruby/pull/879) Add support for `Mandate`
|
5
|
+
* [#876](https://github.com/stripe/stripe-ruby/pull/876) Add additional per-request configuration documentation
|
6
|
+
* [#874](https://github.com/stripe/stripe-ruby/pull/874) Raise an error when requests params are invalid
|
7
|
+
* [#873](https://github.com/stripe/stripe-ruby/pull/873) Contributor Covenant
|
8
|
+
|
3
9
|
## 5.7.1 - 2019-10-15
|
4
10
|
* [#869](https://github.com/stripe/stripe-ruby/pull/869) Fixes the misnamed `connection_base=` setter to be named `connect_base=`
|
5
11
|
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to make participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies within all project spaces, and it also applies when
|
49
|
+
an individual is representing the project or its community in public spaces.
|
50
|
+
Examples of representing a project or community include using an official
|
51
|
+
project e-mail address, posting via an official social media account, or acting
|
52
|
+
as an appointed representative at an online or offline event. Representation of
|
53
|
+
a project may be further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at conduct@stripe.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
74
|
+
|
75
|
+
For answers to common questions about this code of conduct, see
|
76
|
+
https://www.contributor-covenant.org/faq
|
77
|
+
|
data/README.md
CHANGED
@@ -110,8 +110,26 @@ Stripe::Charge.retrieve(
|
|
110
110
|
api_key: "sk_test_...",
|
111
111
|
}
|
112
112
|
)
|
113
|
+
|
114
|
+
Stripe::Charge.capture(
|
115
|
+
"ch_18atAXCdGbJFKhCuBAa4532Z",
|
116
|
+
{},
|
117
|
+
{
|
118
|
+
stripe_version: "2018-02-28",
|
119
|
+
api_key: "sk_test_...",
|
120
|
+
}
|
121
|
+
)
|
113
122
|
```
|
114
123
|
|
124
|
+
Keep in mind that there are different method signatures depending on the action:
|
125
|
+
- When operating on a collection (e.g. `.list`, `.create`) the method signature is
|
126
|
+
`method(params, opts)`.
|
127
|
+
- When operating on resource (e.g. `.capture`, `.update`) the method signature is
|
128
|
+
`method(id, params, opts)`.
|
129
|
+
- One exception is that `retrieve`, despite being an operation on a resource, has the signature
|
130
|
+
`retrieve(id, opts)`. In addition, it will accept a Hash for the `id` param but will extract the
|
131
|
+
`id` key out and use the others as options.
|
132
|
+
|
115
133
|
### Accessing a response object
|
116
134
|
|
117
135
|
Get access to response objects by initializing a client and using its `request`
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.8.0
|
@@ -5,6 +5,9 @@ module Stripe
|
|
5
5
|
module Request
|
6
6
|
module ClassMethods
|
7
7
|
def request(method, url, params = {}, opts = {})
|
8
|
+
params ||= {}
|
9
|
+
|
10
|
+
error_on_invalid_params(params)
|
8
11
|
warn_on_opts_in_params(params)
|
9
12
|
|
10
13
|
opts = Util.normalize_opts(opts)
|
@@ -47,6 +50,14 @@ module Stripe
|
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
53
|
+
private def error_on_invalid_params(params)
|
54
|
+
return if params.nil? || params.is_a?(Hash)
|
55
|
+
|
56
|
+
raise ArgumentError,
|
57
|
+
"request params should be either a Hash or nil " \
|
58
|
+
"(was a #{params.class})"
|
59
|
+
end
|
60
|
+
|
50
61
|
private def warn_on_opts_in_params(params)
|
51
62
|
Util::OPTS_USER_SPECIFIED.each do |opt|
|
52
63
|
if params.key?(opt)
|
data/lib/stripe/object_types.rb
CHANGED
@@ -48,6 +48,7 @@ module Stripe
|
|
48
48
|
Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
|
49
49
|
Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
|
50
50
|
LoginLink::OBJECT_NAME => LoginLink,
|
51
|
+
Mandate::OBJECT_NAME => Mandate,
|
51
52
|
Order::OBJECT_NAME => Order,
|
52
53
|
OrderReturn::OBJECT_NAME => OrderReturn,
|
53
54
|
PaymentIntent::OBJECT_NAME => PaymentIntent,
|
data/lib/stripe/resources.rb
CHANGED
@@ -37,6 +37,7 @@ require "stripe/resources/issuing/cardholder"
|
|
37
37
|
require "stripe/resources/issuing/dispute"
|
38
38
|
require "stripe/resources/issuing/transaction"
|
39
39
|
require "stripe/resources/login_link"
|
40
|
+
require "stripe/resources/mandate"
|
40
41
|
require "stripe/resources/order"
|
41
42
|
require "stripe/resources/order_return"
|
42
43
|
require "stripe/resources/payment_intent"
|
data/lib/stripe/version.rb
CHANGED
@@ -227,6 +227,22 @@ module Stripe
|
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
|
+
should "error if the params is not a Hash" do
|
231
|
+
stub_request(:post, "#{Stripe.api_base}/v1/charges/ch_123/capture")
|
232
|
+
.to_return(body: JSON.generate(charge_fixture))
|
233
|
+
|
234
|
+
e = assert_raises(ArgumentError) { Stripe::Charge.capture("ch_123", "sk_test_secret") }
|
235
|
+
|
236
|
+
assert_equal "request params should be either a Hash or nil (was a String)", e.message
|
237
|
+
end
|
238
|
+
|
239
|
+
should "allow making a request with params set to nil" do
|
240
|
+
stub_request(:post, "#{Stripe.api_base}/v1/charges/ch_123/capture")
|
241
|
+
.to_return(body: JSON.generate(charge_fixture))
|
242
|
+
|
243
|
+
Stripe::Charge.capture("ch_123", nil, "sk_test_secret")
|
244
|
+
end
|
245
|
+
|
230
246
|
should "error if a user-specified opt is given a non-nil non-string value" do
|
231
247
|
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
232
248
|
.to_return(body: JSON.generate(charge_fixture))
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path("../test_helper", __dir__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
class MandateTest < Test::Unit::TestCase
|
7
|
+
should "be retrievable" do
|
8
|
+
schedule = Stripe::Mandate.retrieve("mandate_123")
|
9
|
+
assert_requested :get,
|
10
|
+
"#{Stripe.api_base}/v1/mandates/mandate_123"
|
11
|
+
assert schedule.is_a?(Stripe::Mandate)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -16,7 +16,7 @@ require ::File.expand_path("test_data", __dir__)
|
|
16
16
|
require ::File.expand_path("stripe_mock", __dir__)
|
17
17
|
|
18
18
|
# If changing this number, please also change it in `.travis.yml`.
|
19
|
-
MOCK_MINIMUM_VERSION = "0.
|
19
|
+
MOCK_MINIMUM_VERSION = "0.72.0"
|
20
20
|
MOCK_PORT = Stripe::StripeMock.start
|
21
21
|
|
22
22
|
# Disable all real network connections except those that are outgoing to
|
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: 5.
|
4
|
+
version: 5.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Stripe is the easiest way to accept payments online. See https://stripe.com
|
14
14
|
for details.
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- ".vscode/extensions.json"
|
29
29
|
- ".vscode/settings.json"
|
30
30
|
- CHANGELOG.md
|
31
|
+
- CODE_OF_CONDUCT.md
|
31
32
|
- CONTRIBUTORS
|
32
33
|
- Gemfile
|
33
34
|
- History.txt
|
@@ -90,6 +91,7 @@ files:
|
|
90
91
|
- lib/stripe/resources/issuing/dispute.rb
|
91
92
|
- lib/stripe/resources/issuing/transaction.rb
|
92
93
|
- lib/stripe/resources/login_link.rb
|
94
|
+
- lib/stripe/resources/mandate.rb
|
93
95
|
- lib/stripe/resources/order.rb
|
94
96
|
- lib/stripe/resources/order_return.rb
|
95
97
|
- lib/stripe/resources/payment_intent.rb
|
@@ -175,6 +177,7 @@ files:
|
|
175
177
|
- test/stripe/issuing/transaction_test.rb
|
176
178
|
- test/stripe/list_object_test.rb
|
177
179
|
- test/stripe/login_link_test.rb
|
180
|
+
- test/stripe/mandate_test.rb
|
178
181
|
- test/stripe/multipart_encoder_test.rb
|
179
182
|
- test/stripe/oauth_test.rb
|
180
183
|
- test/stripe/order_return_test.rb
|
@@ -246,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
249
|
- !ruby/object:Gem::Version
|
247
250
|
version: '0'
|
248
251
|
requirements: []
|
249
|
-
rubygems_version: 3.0.
|
252
|
+
rubygems_version: 3.0.3
|
250
253
|
signing_key:
|
251
254
|
specification_version: 4
|
252
255
|
summary: Ruby bindings for the Stripe API
|
@@ -290,6 +293,7 @@ test_files:
|
|
290
293
|
- test/stripe/issuing/transaction_test.rb
|
291
294
|
- test/stripe/list_object_test.rb
|
292
295
|
- test/stripe/login_link_test.rb
|
296
|
+
- test/stripe/mandate_test.rb
|
293
297
|
- test/stripe/multipart_encoder_test.rb
|
294
298
|
- test/stripe/oauth_test.rb
|
295
299
|
- test/stripe/order_return_test.rb
|