stripe 3.31.1 → 4.5.0
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 +5 -5
- data/.travis.yml +1 -2
- data/CHANGELOG.md +31 -0
- data/Gemfile +5 -9
- data/VERSION +1 -1
- data/lib/stripe.rb +5 -0
- data/lib/stripe/account.rb +1 -1
- data/lib/stripe/account_link.rb +9 -0
- data/lib/stripe/checkout_session.rb +9 -0
- data/lib/stripe/oauth.rb +4 -1
- data/lib/stripe/radar/value_list.rb +14 -0
- data/lib/stripe/radar/value_list_item.rb +13 -0
- data/lib/stripe/review.rb +14 -0
- data/lib/stripe/stripe_client.rb +15 -7
- data/lib/stripe/util.rb +5 -0
- data/lib/stripe/version.rb +1 -1
- data/stripe.gemspec +3 -2
- data/test/stripe/account_link_test.rb +18 -0
- data/test/stripe/checkout_session_test.rb +33 -0
- data/test/stripe/oauth_test.rb +9 -0
- data/test/stripe/radar/value_list_item_test.rb +38 -0
- data/test/stripe/radar/value_list_test.rb +51 -0
- data/test/stripe/review_test.rb +27 -0
- data/test/stripe/stripe_object_test.rb +2 -2
- data/test/test_helper.rb +3 -2
- metadata +35 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 176cc43da4fb0e5967142300c7d5f22f4c13b21b81dfc01dd703a99396d3cb39
|
|
4
|
+
data.tar.gz: a7c12a9c2d2758377902ef75822ede38e9e0680343778e080cb6c6cec7b814fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d01504fe2c3080c4ffd469f91c8250da6e98ddc519df7182d0c0c2d92d1095be58669a619f880b9bef831be96905fece73c14fdc81d56af1a9a74d2f5a30ad1
|
|
7
|
+
data.tar.gz: 22795339a7d756f0960f8dba40dd4e9541d01e11e0cd48b0bfde30dbd0e29574c9c206288457a8a3e86c94a916c3358d787670c22053507ea11557274794bfb1
|
data/.travis.yml
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
|
|
3
3
|
rvm:
|
|
4
|
-
- 2.0
|
|
5
4
|
- 2.1
|
|
6
5
|
- 2.2
|
|
7
6
|
- 2.3
|
|
@@ -18,7 +17,7 @@ sudo: false
|
|
|
18
17
|
env:
|
|
19
18
|
global:
|
|
20
19
|
# If changing this number, please also change it in `test/test_helper.rb`.
|
|
21
|
-
- STRIPE_MOCK_VERSION=0.
|
|
20
|
+
- STRIPE_MOCK_VERSION=0.40.0
|
|
22
21
|
|
|
23
22
|
cache:
|
|
24
23
|
directories:
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.5.0 - 2019-01-02
|
|
4
|
+
* [#719](https://github.com/stripe/stripe-ruby/pull/719) Generate OAuth authorize URLs for Express accounts as well as standard
|
|
5
|
+
|
|
6
|
+
## 4.4.1 - 2018-12-31
|
|
7
|
+
* [#718](https://github.com/stripe/stripe-ruby/pull/718) Fix an error message typo
|
|
8
|
+
|
|
9
|
+
## 4.4.0 - 2018-12-21
|
|
10
|
+
* [#716](https://github.com/stripe/stripe-ruby/pull/716) Add support for the `CheckoutSession` resource
|
|
11
|
+
|
|
12
|
+
## 4.3.0 - 2018-12-10
|
|
13
|
+
* [#711](https://github.com/stripe/stripe-ruby/pull/711) Add support for account links
|
|
14
|
+
|
|
15
|
+
## 4.2.0 - 2018-11-28
|
|
16
|
+
* [#705](https://github.com/stripe/stripe-ruby/pull/705) Add support for the `Review` APIs
|
|
17
|
+
|
|
18
|
+
## 4.1.0 - 2018-11-27
|
|
19
|
+
* [#695](https://github.com/stripe/stripe-ruby/pull/695) Add support for `ValueList` and `ValueListItem` for Radar
|
|
20
|
+
|
|
21
|
+
## 4.0.3 - 2018-11-19
|
|
22
|
+
* [#703](https://github.com/stripe/stripe-ruby/pull/703) Don't use `Net::HTTP::Persistent` on Windows where it's not well supported
|
|
23
|
+
|
|
24
|
+
## 4.0.2 - 2018-11-16
|
|
25
|
+
* [#701](https://github.com/stripe/stripe-ruby/pull/701) Require minimum Faraday 0.13 for proper support of persistent connections
|
|
26
|
+
|
|
27
|
+
## 4.0.1 - 2018-11-15
|
|
28
|
+
* [#699](https://github.com/stripe/stripe-ruby/pull/699) Only send telemetry if `Request-Id` was present in the response
|
|
29
|
+
|
|
30
|
+
## 4.0.0 - 2018-11-15
|
|
31
|
+
* [#698](https://github.com/stripe/stripe-ruby/pull/698) Use persistent connections by default through `Net::HTTP::Persistent`
|
|
32
|
+
* [#698](https://github.com/stripe/stripe-ruby/pull/698) Drop support for Ruby 2.0 (which we consider a breaking change here)
|
|
33
|
+
|
|
3
34
|
## 3.31.1 - 2018-11-12
|
|
4
35
|
* [#697](https://github.com/stripe/stripe-ruby/pull/697) Send telemetry in milliseconds specifically
|
|
5
36
|
|
data/Gemfile
CHANGED
|
@@ -24,18 +24,14 @@ group :development do
|
|
|
24
24
|
# older Ruby versions. Check Ruby the version here and put a maximum
|
|
25
25
|
# constraint on Rack if necessary.
|
|
26
26
|
if RUBY_VERSION >= "2.2.2"
|
|
27
|
-
gem "rack", ">=
|
|
27
|
+
gem "rack", ">= 2.0.6"
|
|
28
28
|
else
|
|
29
|
-
gem "rack", ">= 1.
|
|
29
|
+
gem "rack", ">= 1.6.11", "< 2.0" # rubocop:disable Bundler/DuplicatedGem
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
platforms :mri do
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
gem "byebug"
|
|
37
|
-
gem "pry"
|
|
38
|
-
gem "pry-byebug"
|
|
39
|
-
end
|
|
33
|
+
gem "byebug"
|
|
34
|
+
gem "pry"
|
|
35
|
+
gem "pry-byebug"
|
|
40
36
|
end
|
|
41
37
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.5.0
|
data/lib/stripe.rb
CHANGED
|
@@ -37,6 +37,7 @@ require "stripe/webhook"
|
|
|
37
37
|
|
|
38
38
|
# Named API resources
|
|
39
39
|
require "stripe/account"
|
|
40
|
+
require "stripe/account_link"
|
|
40
41
|
require "stripe/alipay_account"
|
|
41
42
|
require "stripe/apple_pay_domain"
|
|
42
43
|
require "stripe/application_fee"
|
|
@@ -48,6 +49,7 @@ require "stripe/bitcoin_receiver"
|
|
|
48
49
|
require "stripe/bitcoin_transaction"
|
|
49
50
|
require "stripe/card"
|
|
50
51
|
require "stripe/charge"
|
|
52
|
+
require "stripe/checkout_session"
|
|
51
53
|
require "stripe/country_spec"
|
|
52
54
|
require "stripe/coupon"
|
|
53
55
|
require "stripe/customer"
|
|
@@ -75,12 +77,15 @@ require "stripe/payout"
|
|
|
75
77
|
require "stripe/person"
|
|
76
78
|
require "stripe/plan"
|
|
77
79
|
require "stripe/product"
|
|
80
|
+
require "stripe/radar/value_list"
|
|
81
|
+
require "stripe/radar/value_list_item"
|
|
78
82
|
require "stripe/recipient"
|
|
79
83
|
require "stripe/recipient_transfer"
|
|
80
84
|
require "stripe/refund"
|
|
81
85
|
require "stripe/reporting/report_run"
|
|
82
86
|
require "stripe/reporting/report_type"
|
|
83
87
|
require "stripe/reversal"
|
|
88
|
+
require "stripe/review"
|
|
84
89
|
require "stripe/sigma/scheduled_query_run"
|
|
85
90
|
require "stripe/sku"
|
|
86
91
|
require "stripe/source"
|
data/lib/stripe/account.rb
CHANGED
|
@@ -103,7 +103,7 @@ module Stripe
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def legal_entity=(_)
|
|
106
|
-
raise NoMethodError, '
|
|
106
|
+
raise NoMethodError, 'Overriding legal_entity can cause serious issues. Instead, set the individual fields of legal_entity like blah.legal_entity.first_name = \'Blah\''
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
def deauthorize(client_id = nil, opts = {})
|
data/lib/stripe/oauth.rb
CHANGED
|
@@ -31,11 +31,14 @@ module Stripe
|
|
|
31
31
|
def self.authorize_url(params = {}, opts = {})
|
|
32
32
|
base = opts[:connect_base] || Stripe.connect_base
|
|
33
33
|
|
|
34
|
+
path = "/oauth/authorize"
|
|
35
|
+
path = "/express" + path if opts[:express]
|
|
36
|
+
|
|
34
37
|
params[:client_id] = get_client_id(params)
|
|
35
38
|
params[:response_type] ||= "code"
|
|
36
39
|
query = Util.encode_parameters(params)
|
|
37
40
|
|
|
38
|
-
"#{base}
|
|
41
|
+
"#{base}#{path}?#{query}"
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
def self.token(params = {}, opts = {})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stripe
|
|
4
|
+
module Radar
|
|
5
|
+
class ValueList < Stripe::APIResource
|
|
6
|
+
extend Stripe::APIOperations::Create
|
|
7
|
+
include Stripe::APIOperations::Delete
|
|
8
|
+
extend Stripe::APIOperations::List
|
|
9
|
+
include Stripe::APIOperations::Save
|
|
10
|
+
|
|
11
|
+
OBJECT_NAME = "radar.value_list".freeze
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stripe
|
|
4
|
+
module Radar
|
|
5
|
+
class ValueListItem < Stripe::APIResource
|
|
6
|
+
extend Stripe::APIOperations::Create
|
|
7
|
+
include Stripe::APIOperations::Delete
|
|
8
|
+
extend Stripe::APIOperations::List
|
|
9
|
+
|
|
10
|
+
OBJECT_NAME = "radar.value_list_item".freeze
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stripe
|
|
4
|
+
class Review < APIResource
|
|
5
|
+
extend Stripe::APIOperations::List
|
|
6
|
+
|
|
7
|
+
OBJECT_NAME = "review".freeze
|
|
8
|
+
|
|
9
|
+
def approve(params = {}, opts = {})
|
|
10
|
+
resp, opts = request(:post, resource_url + "/approve", params, opts)
|
|
11
|
+
initialize_from(resp.data, opts)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/stripe/stripe_client.rb
CHANGED
|
@@ -31,11 +31,18 @@ module Stripe
|
|
|
31
31
|
# of connection re-use, so make sure that we have a separate connection
|
|
32
32
|
# object per thread.
|
|
33
33
|
Thread.current[:stripe_client_default_conn] ||= begin
|
|
34
|
-
conn = Faraday.new do |
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
conn = Faraday.new do |builder|
|
|
35
|
+
builder.use Faraday::Request::Multipart
|
|
36
|
+
builder.use Faraday::Request::UrlEncoded
|
|
37
|
+
builder.use Faraday::Response::RaiseError
|
|
38
|
+
|
|
39
|
+
# Net::HTTP::Persistent doesn't seem to do well on Windows or JRuby,
|
|
40
|
+
# so fall back to default there.
|
|
41
|
+
if Gem.win_platform? || RUBY_PLATFORM == "java"
|
|
42
|
+
builder.adapter :net_http
|
|
43
|
+
else
|
|
44
|
+
builder.adapter :net_http_persistent
|
|
45
|
+
end
|
|
39
46
|
end
|
|
40
47
|
|
|
41
48
|
if Stripe.verify_ssl_certs
|
|
@@ -218,7 +225,8 @@ module Stripe
|
|
|
218
225
|
resp = yield
|
|
219
226
|
context = context.dup_from_response(resp)
|
|
220
227
|
log_response(context, request_start, resp.status, resp.body)
|
|
221
|
-
|
|
228
|
+
|
|
229
|
+
if Stripe.enable_telemetry? && context.request_id
|
|
222
230
|
request_duration_ms = ((Time.now - request_start) * 1000).to_int
|
|
223
231
|
@last_request_metrics = StripeRequestMetrics.new(context.request_id, request_duration_ms)
|
|
224
232
|
end
|
|
@@ -270,7 +278,7 @@ module Stripe
|
|
|
270
278
|
end
|
|
271
279
|
|
|
272
280
|
# Formats a plugin "app info" hash into a string that we can tack onto the
|
|
273
|
-
# end of a User-Agent string where it'll be fairly
|
|
281
|
+
# end of a User-Agent string where it'll be fairly prominent in places like
|
|
274
282
|
# the Dashboard. Note that this formatting has been implemented to match
|
|
275
283
|
# other libraries, and shouldn't be changed without universal consensus.
|
|
276
284
|
def format_app_info(info)
|
data/lib/stripe/util.rb
CHANGED
|
@@ -46,6 +46,7 @@ module Stripe
|
|
|
46
46
|
|
|
47
47
|
# business objects
|
|
48
48
|
Account::OBJECT_NAME => Account,
|
|
49
|
+
AccountLink::OBJECT_NAME => AccountLink,
|
|
49
50
|
AlipayAccount::OBJECT_NAME => AlipayAccount,
|
|
50
51
|
ApplePayDomain::OBJECT_NAME => ApplePayDomain,
|
|
51
52
|
ApplicationFee::OBJECT_NAME => ApplicationFee,
|
|
@@ -57,6 +58,7 @@ module Stripe
|
|
|
57
58
|
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
|
|
58
59
|
Card::OBJECT_NAME => Card,
|
|
59
60
|
Charge::OBJECT_NAME => Charge,
|
|
61
|
+
CheckoutSession::OBJECT_NAME => CheckoutSession,
|
|
60
62
|
CountrySpec::OBJECT_NAME => CountrySpec,
|
|
61
63
|
Coupon::OBJECT_NAME => Coupon,
|
|
62
64
|
Customer::OBJECT_NAME => Customer,
|
|
@@ -85,12 +87,15 @@ module Stripe
|
|
|
85
87
|
Person::OBJECT_NAME => Person,
|
|
86
88
|
Plan::OBJECT_NAME => Plan,
|
|
87
89
|
Product::OBJECT_NAME => Product,
|
|
90
|
+
Radar::ValueList::OBJECT_NAME => Radar::ValueList,
|
|
91
|
+
Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
|
|
88
92
|
Recipient::OBJECT_NAME => Recipient,
|
|
89
93
|
RecipientTransfer::OBJECT_NAME => RecipientTransfer,
|
|
90
94
|
Refund::OBJECT_NAME => Refund,
|
|
91
95
|
Reporting::ReportRun::OBJECT_NAME => Reporting::ReportRun,
|
|
92
96
|
Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
|
|
93
97
|
Reversal::OBJECT_NAME => Reversal,
|
|
98
|
+
Review::OBJECT_NAME => Review,
|
|
94
99
|
SKU::OBJECT_NAME => SKU,
|
|
95
100
|
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
|
|
96
101
|
Source::OBJECT_NAME => Source,
|
data/lib/stripe/version.rb
CHANGED
data/stripe.gemspec
CHANGED
|
@@ -7,7 +7,7 @@ require "stripe/version"
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "stripe"
|
|
9
9
|
s.version = Stripe::VERSION
|
|
10
|
-
s.required_ruby_version = ">= 2.
|
|
10
|
+
s.required_ruby_version = ">= 2.1.0"
|
|
11
11
|
s.summary = "Ruby bindings for the Stripe API"
|
|
12
12
|
s.description = "Stripe is the easiest way to accept payments online. See https://stripe.com for details."
|
|
13
13
|
s.author = "Stripe"
|
|
@@ -15,7 +15,8 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
s.homepage = "https://stripe.com/docs/api/ruby"
|
|
16
16
|
s.license = "MIT"
|
|
17
17
|
|
|
18
|
-
s.add_dependency("faraday", "~> 0.
|
|
18
|
+
s.add_dependency("faraday", "~> 0.13")
|
|
19
|
+
s.add_dependency("net-http-persistent", "~> 3.0")
|
|
19
20
|
|
|
20
21
|
s.files = `git ls-files`.split("\n")
|
|
21
22
|
s.test_files = `git ls-files -- test/*`.split("\n")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require ::File.expand_path("../../test_helper", __FILE__)
|
|
4
|
+
|
|
5
|
+
module Stripe
|
|
6
|
+
class AccountLinkTest < Test::Unit::TestCase
|
|
7
|
+
should "be creatable" do
|
|
8
|
+
link = Stripe::AccountLink.create(
|
|
9
|
+
account: "acct_123",
|
|
10
|
+
failure_url: "https://stripe.com/failure",
|
|
11
|
+
success_url: "https://stripe.com/success",
|
|
12
|
+
type: "custom_account_verification"
|
|
13
|
+
)
|
|
14
|
+
assert_requested :post, "#{Stripe.api_base}/v1/account_links"
|
|
15
|
+
assert link.is_a?(Stripe::AccountLink)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require ::File.expand_path("../../test_helper", __FILE__)
|
|
4
|
+
|
|
5
|
+
module Stripe
|
|
6
|
+
class CheckoutSessionTest < Test::Unit::TestCase
|
|
7
|
+
should "be creatable" do
|
|
8
|
+
session = Stripe::CheckoutSession.create(
|
|
9
|
+
allowed_source_types: ["card"],
|
|
10
|
+
cancel_url: "https://stripe.com/cancel",
|
|
11
|
+
client_reference_id: "1234",
|
|
12
|
+
line_items: [
|
|
13
|
+
{
|
|
14
|
+
amount: 123,
|
|
15
|
+
currency: "usd",
|
|
16
|
+
description: "item 1",
|
|
17
|
+
images: [
|
|
18
|
+
"https://stripe.com/img1",
|
|
19
|
+
],
|
|
20
|
+
name: "name",
|
|
21
|
+
quantity: 2,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
payment_intent_data: [
|
|
25
|
+
receipt_email: "test@stripe.com",
|
|
26
|
+
],
|
|
27
|
+
success_url: "https://stripe.com/success"
|
|
28
|
+
)
|
|
29
|
+
assert_requested :post, "#{Stripe.api_base}/v1/checkout_sessions"
|
|
30
|
+
assert session.is_a?(Stripe::CheckoutSession)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/test/stripe/oauth_test.rb
CHANGED
|
@@ -35,6 +35,15 @@ module Stripe
|
|
|
35
35
|
assert_equal(["https://example.com/profile/test"], params["stripe_user[url]"])
|
|
36
36
|
assert_equal(["US"], params["stripe_user[country]"])
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
should "optionally return an express path" do
|
|
40
|
+
uri_str = OAuth.authorize_url({}, express: true)
|
|
41
|
+
|
|
42
|
+
uri = URI.parse(uri_str)
|
|
43
|
+
assert_equal("https", uri.scheme)
|
|
44
|
+
assert_equal("connect.stripe.com", uri.host)
|
|
45
|
+
assert_equal("/express/oauth/authorize", uri.path)
|
|
46
|
+
end
|
|
38
47
|
end
|
|
39
48
|
|
|
40
49
|
context ".token" do
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require ::File.expand_path("../../../test_helper", __FILE__)
|
|
4
|
+
|
|
5
|
+
module Stripe
|
|
6
|
+
module Radar
|
|
7
|
+
class ValueListItemTest < Test::Unit::TestCase
|
|
8
|
+
should "be listable" do
|
|
9
|
+
items = Stripe::Radar::ValueListItem.list(value_list: "rsl_123")
|
|
10
|
+
assert_requested :get, "#{Stripe.api_base}/v1/radar/value_list_items?value_list=rsl_123"
|
|
11
|
+
assert items.data.is_a?(Array)
|
|
12
|
+
assert items.first.is_a?(Stripe::Radar::ValueListItem)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
should "be retrievable" do
|
|
16
|
+
item = Stripe::Radar::ValueListItem.retrieve("rsli_123")
|
|
17
|
+
assert_requested :get, "#{Stripe.api_base}/v1/radar/value_list_items/rsli_123"
|
|
18
|
+
assert item.is_a?(Stripe::Radar::ValueListItem)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
should "be creatable" do
|
|
22
|
+
item = Stripe::Radar::ValueListItem.create(
|
|
23
|
+
value_list: "rsl_123",
|
|
24
|
+
value: "value"
|
|
25
|
+
)
|
|
26
|
+
assert_requested :post, "#{Stripe.api_base}/v1/radar/value_list_items"
|
|
27
|
+
assert item.is_a?(Stripe::Radar::ValueListItem)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
should "be deletable" do
|
|
31
|
+
list = Stripe::Radar::ValueListItem.retrieve("rsli_123")
|
|
32
|
+
list = list.delete
|
|
33
|
+
assert_requested :delete, "#{Stripe.api_base}/v1/radar/value_list_items/rsli_123"
|
|
34
|
+
assert list.is_a?(Stripe::Radar::ValueListItem)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require ::File.expand_path("../../../test_helper", __FILE__)
|
|
4
|
+
|
|
5
|
+
module Stripe
|
|
6
|
+
module Radar
|
|
7
|
+
class ValueListTest < Test::Unit::TestCase
|
|
8
|
+
should "be listable" do
|
|
9
|
+
lists = Stripe::Radar::ValueList.list
|
|
10
|
+
assert_requested :get, "#{Stripe.api_base}/v1/radar/value_lists"
|
|
11
|
+
assert lists.data.is_a?(Array)
|
|
12
|
+
assert lists.first.is_a?(Stripe::Radar::ValueList)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
should "be retrievable" do
|
|
16
|
+
list = Stripe::Radar::ValueList.retrieve("rsl_123")
|
|
17
|
+
assert_requested :get, "#{Stripe.api_base}/v1/radar/value_lists/rsl_123"
|
|
18
|
+
assert list.is_a?(Stripe::Radar::ValueList)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
should "be creatable" do
|
|
22
|
+
list = Stripe::Radar::ValueList.create(
|
|
23
|
+
alias: "list_alias",
|
|
24
|
+
name: "list_name"
|
|
25
|
+
)
|
|
26
|
+
assert_requested :post, "#{Stripe.api_base}/v1/radar/value_lists"
|
|
27
|
+
assert list.is_a?(Stripe::Radar::ValueList)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
should "be saveable" do
|
|
31
|
+
list = Stripe::Radar::ValueList.retrieve("rsl_123")
|
|
32
|
+
list.metadata["key"] = "value"
|
|
33
|
+
list.save
|
|
34
|
+
assert_requested :post, "#{Stripe.api_base}/v1/radar/value_lists/rsl_123"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should "be updateable" do
|
|
38
|
+
list = Stripe::Radar::ValueList.update("rsl_123", metadata: { key: "value" })
|
|
39
|
+
assert_requested :post, "#{Stripe.api_base}/v1/radar/value_lists/rsl_123"
|
|
40
|
+
assert list.is_a?(Stripe::Radar::ValueList)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
should "be deletable" do
|
|
44
|
+
list = Stripe::Radar::ValueList.retrieve("rsl_123")
|
|
45
|
+
list = list.delete
|
|
46
|
+
assert_requested :delete, "#{Stripe.api_base}/v1/radar/value_lists/rsl_123"
|
|
47
|
+
assert list.is_a?(Stripe::Radar::ValueList)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require ::File.expand_path("../../test_helper", __FILE__)
|
|
4
|
+
|
|
5
|
+
module Stripe
|
|
6
|
+
class ReviewTest < Test::Unit::TestCase
|
|
7
|
+
should "be listable" do
|
|
8
|
+
reviews = Stripe::Review.list
|
|
9
|
+
assert_requested :get, "#{Stripe.api_base}/v1/reviews"
|
|
10
|
+
assert reviews.data.is_a?(Array)
|
|
11
|
+
assert reviews.first.is_a?(Stripe::Review)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
should "be retrievable" do
|
|
15
|
+
review = Stripe::Review.retrieve("prv_123")
|
|
16
|
+
assert_requested :get, "#{Stripe.api_base}/v1/reviews/prv_123"
|
|
17
|
+
assert review.is_a?(Stripe::Review)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
should "be approvable" do
|
|
21
|
+
review = Stripe::Review.retrieve("prv_123")
|
|
22
|
+
review.approve
|
|
23
|
+
assert_requested :post, "#{Stripe.api_base}/v1/reviews/prv_123/approve"
|
|
24
|
+
assert review.is_a?(Stripe::Review)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -452,14 +452,14 @@ module Stripe
|
|
|
452
452
|
|
|
453
453
|
should "#to_s will call to_s for all embedded stripe objects" do
|
|
454
454
|
obj = Stripe::StripeObject.construct_from(id: "id",
|
|
455
|
-
#
|
|
455
|
+
# embedded list object
|
|
456
456
|
refunds: Stripe::ListObject.construct_from(data: [
|
|
457
457
|
# embedded object in list
|
|
458
458
|
Stripe::StripeObject.construct_from(id: "id",
|
|
459
459
|
# embedded object in an object in a list object
|
|
460
460
|
metadata: Stripe::StripeObject.construct_from(foo: "bar")),
|
|
461
461
|
]),
|
|
462
|
-
#
|
|
462
|
+
# embedded stripe object
|
|
463
463
|
metadata: Stripe::StripeObject.construct_from(foo: "bar"))
|
|
464
464
|
expected = JSON.pretty_generate(id: "id",
|
|
465
465
|
refunds: {
|
data/test/test_helper.rb
CHANGED
|
@@ -16,7 +16,7 @@ PROJECT_ROOT = ::File.expand_path("../../", __FILE__)
|
|
|
16
16
|
require ::File.expand_path("../test_data", __FILE__)
|
|
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.40.0".freeze
|
|
20
20
|
MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12_111
|
|
21
21
|
|
|
22
22
|
# Disable all real network connections except those that are outgoing to
|
|
@@ -27,7 +27,8 @@ WebMock.disable_net_connect!(allow: "localhost:#{MOCK_PORT}")
|
|
|
27
27
|
# we can print one error and fail fast so that it's more clear to the user how
|
|
28
28
|
# they should fix the problem.
|
|
29
29
|
begin
|
|
30
|
-
|
|
30
|
+
conn = Faraday::Connection.new("http://localhost:#{MOCK_PORT}")
|
|
31
|
+
resp = conn.get("/")
|
|
31
32
|
version = resp.headers["Stripe-Mock-Version"]
|
|
32
33
|
if version != "master" &&
|
|
33
34
|
Gem::Version.new(version) < Gem::Version.new(MOCK_MINIMUM_VERSION)
|
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:
|
|
4
|
+
version: 4.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -16,14 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0.
|
|
19
|
+
version: '0.13'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0.
|
|
26
|
+
version: '0.13'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: net-http-persistent
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3.0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3.0'
|
|
27
41
|
description: Stripe is the easiest way to accept payments online. See https://stripe.com
|
|
28
42
|
for details.
|
|
29
43
|
email: support@stripe.com
|
|
@@ -50,6 +64,7 @@ files:
|
|
|
50
64
|
- lib/data/ca-certificates.crt
|
|
51
65
|
- lib/stripe.rb
|
|
52
66
|
- lib/stripe/account.rb
|
|
67
|
+
- lib/stripe/account_link.rb
|
|
53
68
|
- lib/stripe/alipay_account.rb
|
|
54
69
|
- lib/stripe/api_operations/create.rb
|
|
55
70
|
- lib/stripe/api_operations/delete.rb
|
|
@@ -68,6 +83,7 @@ files:
|
|
|
68
83
|
- lib/stripe/bitcoin_transaction.rb
|
|
69
84
|
- lib/stripe/card.rb
|
|
70
85
|
- lib/stripe/charge.rb
|
|
86
|
+
- lib/stripe/checkout_session.rb
|
|
71
87
|
- lib/stripe/country_spec.rb
|
|
72
88
|
- lib/stripe/coupon.rb
|
|
73
89
|
- lib/stripe/customer.rb
|
|
@@ -98,12 +114,15 @@ files:
|
|
|
98
114
|
- lib/stripe/person.rb
|
|
99
115
|
- lib/stripe/plan.rb
|
|
100
116
|
- lib/stripe/product.rb
|
|
117
|
+
- lib/stripe/radar/value_list.rb
|
|
118
|
+
- lib/stripe/radar/value_list_item.rb
|
|
101
119
|
- lib/stripe/recipient.rb
|
|
102
120
|
- lib/stripe/recipient_transfer.rb
|
|
103
121
|
- lib/stripe/refund.rb
|
|
104
122
|
- lib/stripe/reporting/report_run.rb
|
|
105
123
|
- lib/stripe/reporting/report_type.rb
|
|
106
124
|
- lib/stripe/reversal.rb
|
|
125
|
+
- lib/stripe/review.rb
|
|
107
126
|
- lib/stripe/sigma/scheduled_query_run.rb
|
|
108
127
|
- lib/stripe/singleton_api_resource.rb
|
|
109
128
|
- lib/stripe/sku.rb
|
|
@@ -130,6 +149,7 @@ files:
|
|
|
130
149
|
- stripe.gemspec
|
|
131
150
|
- test/api_stub_helpers.rb
|
|
132
151
|
- test/stripe/account_external_accounts_operations_test.rb
|
|
152
|
+
- test/stripe/account_link_test.rb
|
|
133
153
|
- test/stripe/account_login_links_operations_test.rb
|
|
134
154
|
- test/stripe/account_persons_operations_test.rb
|
|
135
155
|
- test/stripe/account_test.rb
|
|
@@ -143,6 +163,7 @@ files:
|
|
|
143
163
|
- test/stripe/balance_test.rb
|
|
144
164
|
- test/stripe/bank_account_test.rb
|
|
145
165
|
- test/stripe/charge_test.rb
|
|
166
|
+
- test/stripe/checkout_session_test.rb
|
|
146
167
|
- test/stripe/country_spec_test.rb
|
|
147
168
|
- test/stripe/coupon_test.rb
|
|
148
169
|
- test/stripe/customer_card_test.rb
|
|
@@ -174,11 +195,14 @@ files:
|
|
|
174
195
|
- test/stripe/person_test.rb
|
|
175
196
|
- test/stripe/plan_test.rb
|
|
176
197
|
- test/stripe/product_test.rb
|
|
198
|
+
- test/stripe/radar/value_list_item_test.rb
|
|
199
|
+
- test/stripe/radar/value_list_test.rb
|
|
177
200
|
- test/stripe/recipient_test.rb
|
|
178
201
|
- test/stripe/refund_test.rb
|
|
179
202
|
- test/stripe/reporting/report_run_test.rb
|
|
180
203
|
- test/stripe/reporting/report_type_test.rb
|
|
181
204
|
- test/stripe/reversal_test.rb
|
|
205
|
+
- test/stripe/review_test.rb
|
|
182
206
|
- test/stripe/sigma/scheduled_query_run_test.rb
|
|
183
207
|
- test/stripe/sku_test.rb
|
|
184
208
|
- test/stripe/source_test.rb
|
|
@@ -215,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
215
239
|
requirements:
|
|
216
240
|
- - ">="
|
|
217
241
|
- !ruby/object:Gem::Version
|
|
218
|
-
version: 2.
|
|
242
|
+
version: 2.1.0
|
|
219
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
244
|
requirements:
|
|
221
245
|
- - ">="
|
|
@@ -223,13 +247,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
223
247
|
version: '0'
|
|
224
248
|
requirements: []
|
|
225
249
|
rubyforge_project:
|
|
226
|
-
rubygems_version: 2.
|
|
250
|
+
rubygems_version: 2.7.7
|
|
227
251
|
signing_key:
|
|
228
252
|
specification_version: 4
|
|
229
253
|
summary: Ruby bindings for the Stripe API
|
|
230
254
|
test_files:
|
|
231
255
|
- test/api_stub_helpers.rb
|
|
232
256
|
- test/stripe/account_external_accounts_operations_test.rb
|
|
257
|
+
- test/stripe/account_link_test.rb
|
|
233
258
|
- test/stripe/account_login_links_operations_test.rb
|
|
234
259
|
- test/stripe/account_persons_operations_test.rb
|
|
235
260
|
- test/stripe/account_test.rb
|
|
@@ -243,6 +268,7 @@ test_files:
|
|
|
243
268
|
- test/stripe/balance_test.rb
|
|
244
269
|
- test/stripe/bank_account_test.rb
|
|
245
270
|
- test/stripe/charge_test.rb
|
|
271
|
+
- test/stripe/checkout_session_test.rb
|
|
246
272
|
- test/stripe/country_spec_test.rb
|
|
247
273
|
- test/stripe/coupon_test.rb
|
|
248
274
|
- test/stripe/customer_card_test.rb
|
|
@@ -274,11 +300,14 @@ test_files:
|
|
|
274
300
|
- test/stripe/person_test.rb
|
|
275
301
|
- test/stripe/plan_test.rb
|
|
276
302
|
- test/stripe/product_test.rb
|
|
303
|
+
- test/stripe/radar/value_list_item_test.rb
|
|
304
|
+
- test/stripe/radar/value_list_test.rb
|
|
277
305
|
- test/stripe/recipient_test.rb
|
|
278
306
|
- test/stripe/refund_test.rb
|
|
279
307
|
- test/stripe/reporting/report_run_test.rb
|
|
280
308
|
- test/stripe/reporting/report_type_test.rb
|
|
281
309
|
- test/stripe/reversal_test.rb
|
|
310
|
+
- test/stripe/review_test.rb
|
|
282
311
|
- test/stripe/sigma/scheduled_query_run_test.rb
|
|
283
312
|
- test/stripe/sku_test.rb
|
|
284
313
|
- test/stripe/source_test.rb
|