stripe 5.22.0 → 5.26.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 +4 -4
- data/.rubocop.yml +4 -4
- data/.travis.yml +1 -3
- data/CHANGELOG.md +16 -0
- data/README.md +22 -22
- data/VERSION +1 -1
- data/lib/stripe.rb +32 -166
- data/lib/stripe/api_operations/create.rb +1 -1
- data/lib/stripe/api_operations/delete.rb +7 -3
- data/lib/stripe/api_operations/list.rb +1 -1
- data/lib/stripe/api_operations/nested_resource.rb +6 -5
- data/lib/stripe/api_operations/request.rb +19 -3
- data/lib/stripe/api_operations/save.rb +7 -4
- data/lib/stripe/api_resource.rb +4 -3
- data/lib/stripe/list_object.rb +2 -2
- data/lib/stripe/oauth.rb +3 -3
- data/lib/stripe/object_types.rb +2 -0
- data/lib/stripe/resources.rb +2 -0
- data/lib/stripe/resources/account.rb +2 -1
- data/lib/stripe/resources/account_link.rb +1 -0
- data/lib/stripe/resources/apple_pay_domain.rb +1 -0
- data/lib/stripe/resources/application_fee.rb +1 -0
- data/lib/stripe/resources/balance.rb +1 -0
- data/lib/stripe/resources/balance_transaction.rb +1 -0
- data/lib/stripe/resources/bank_account.rb +2 -1
- data/lib/stripe/resources/billing_portal/session.rb +1 -0
- data/lib/stripe/resources/bitcoin_receiver.rb +1 -0
- data/lib/stripe/resources/card.rb +1 -0
- data/lib/stripe/resources/charge.rb +1 -0
- data/lib/stripe/resources/checkout/session.rb +1 -0
- data/lib/stripe/resources/country_spec.rb +1 -0
- data/lib/stripe/resources/coupon.rb +1 -0
- data/lib/stripe/resources/credit_note.rb +3 -2
- data/lib/stripe/resources/customer.rb +2 -1
- data/lib/stripe/resources/dispute.rb +1 -0
- data/lib/stripe/resources/ephemeral_key.rb +1 -0
- data/lib/stripe/resources/event.rb +1 -0
- data/lib/stripe/resources/exchange_rate.rb +1 -0
- data/lib/stripe/resources/file.rb +1 -0
- data/lib/stripe/resources/file_link.rb +1 -0
- data/lib/stripe/resources/invoice.rb +3 -2
- data/lib/stripe/resources/invoice_item.rb +1 -0
- data/lib/stripe/resources/issuing/authorization.rb +1 -0
- data/lib/stripe/resources/issuing/card.rb +1 -0
- data/lib/stripe/resources/issuing/cardholder.rb +1 -0
- data/lib/stripe/resources/issuing/dispute.rb +12 -0
- data/lib/stripe/resources/issuing/transaction.rb +1 -0
- data/lib/stripe/resources/mandate.rb +1 -0
- data/lib/stripe/resources/order.rb +1 -0
- data/lib/stripe/resources/order_return.rb +1 -0
- data/lib/stripe/resources/payment_intent.rb +1 -0
- data/lib/stripe/resources/payment_method.rb +1 -0
- data/lib/stripe/resources/payout.rb +1 -0
- data/lib/stripe/resources/plan.rb +1 -0
- data/lib/stripe/resources/price.rb +1 -0
- data/lib/stripe/resources/product.rb +1 -0
- data/lib/stripe/resources/promotion_code.rb +12 -0
- data/lib/stripe/resources/radar/early_fraud_warning.rb +1 -0
- data/lib/stripe/resources/radar/value_list.rb +1 -0
- data/lib/stripe/resources/radar/value_list_item.rb +1 -0
- data/lib/stripe/resources/recipient.rb +1 -0
- data/lib/stripe/resources/refund.rb +1 -0
- data/lib/stripe/resources/reporting/report_run.rb +1 -0
- data/lib/stripe/resources/reporting/report_type.rb +1 -0
- data/lib/stripe/resources/review.rb +1 -0
- data/lib/stripe/resources/setup_attempt.rb +10 -0
- data/lib/stripe/resources/setup_intent.rb +1 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +1 -0
- data/lib/stripe/resources/sku.rb +1 -0
- data/lib/stripe/resources/source.rb +4 -3
- data/lib/stripe/resources/subscription.rb +1 -0
- data/lib/stripe/resources/subscription_item.rb +2 -1
- data/lib/stripe/resources/subscription_schedule.rb +1 -0
- data/lib/stripe/resources/tax_rate.rb +1 -0
- data/lib/stripe/resources/terminal/connection_token.rb +1 -0
- data/lib/stripe/resources/terminal/location.rb +1 -0
- data/lib/stripe/resources/terminal/reader.rb +1 -0
- data/lib/stripe/resources/three_d_secure.rb +1 -0
- data/lib/stripe/resources/token.rb +1 -0
- data/lib/stripe/resources/topup.rb +1 -0
- data/lib/stripe/resources/transfer.rb +1 -0
- data/lib/stripe/resources/webhook_endpoint.rb +1 -0
- data/lib/stripe/stripe_configuration.rb +167 -0
- data/lib/stripe/stripe_object.rb +1 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/account_link_test.rb +3 -3
- data/test/stripe/api_resource_test.rb +7 -7
- data/test/stripe/customer_card_test.rb +6 -0
- data/test/stripe/issuing/dispute_test.rb +20 -1
- data/test/stripe/product_test.rb +1 -2
- data/test/stripe/promotion_code_test.rb +42 -0
- data/test/stripe/setup_attempt_test.rb +16 -0
- data/test/stripe/stripe_configuration_test.rb +128 -0
- data/test/stripe/subscription_item_test.rb +1 -1
- data/test/stripe_test.rb +88 -19
- data/test/test_helper.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 904e51a8673243fee242bfac79daeeb93aa5f3333ae0a70dbafc7aac55f87d90
|
|
4
|
+
data.tar.gz: e4d11976d87cdae6b9cbf3f62379effa07a719e244b81d4c3cc1914a5be3ccd1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c130372f29afb9cf4bae86d2608a537aae2302cf342dfc152b018ac71a787053977dcb7e0a5e044e518b7feb1fa67f2932de67cbb24cb82c9d7e946890503de
|
|
7
|
+
data.tar.gz: a91d6654370dc3a187e159cd49f4546ebe11b0f00e96b165b06f010b639d4213681393426a6ea40b4c768db6b6bf337307be5408d4d987f5ac616ff6817a6960
|
data/.rubocop.yml
CHANGED
|
@@ -44,10 +44,10 @@ Metrics/ClassLength:
|
|
|
44
44
|
- "test/**/*.rb"
|
|
45
45
|
|
|
46
46
|
Metrics/MethodLength:
|
|
47
|
-
# There's ~2 long methods in `StripeClient
|
|
48
|
-
# little, we could move this to be closer to ~30
|
|
49
|
-
# probably too short).
|
|
50
|
-
Max:
|
|
47
|
+
# There's ~2 long methods in `StripeClient` and one in `NestedResource`. If
|
|
48
|
+
# we want to truncate those a little, we could move this to be closer to ~30
|
|
49
|
+
# (but the default of 10 is probably too short).
|
|
50
|
+
Max: 55
|
|
51
51
|
|
|
52
52
|
Metrics/ModuleLength:
|
|
53
53
|
Enabled: false
|
data/.travis.yml
CHANGED
|
@@ -12,12 +12,10 @@ notifications:
|
|
|
12
12
|
email:
|
|
13
13
|
on_success: never
|
|
14
14
|
|
|
15
|
-
sudo: false
|
|
16
|
-
|
|
17
15
|
env:
|
|
18
16
|
global:
|
|
19
17
|
# If changing this number, please also change it in `test/test_helper.rb`.
|
|
20
|
-
- STRIPE_MOCK_VERSION=0.
|
|
18
|
+
- STRIPE_MOCK_VERSION=0.99.0
|
|
21
19
|
|
|
22
20
|
cache:
|
|
23
21
|
directories:
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.26.0 - 2020-09-29
|
|
4
|
+
* [#949](https://github.com/stripe/stripe-ruby/pull/949) Add support for the `SetupAttempt` resource and List API
|
|
5
|
+
|
|
6
|
+
## 5.25.0 - 2020-09-02
|
|
7
|
+
* [#944](https://github.com/stripe/stripe-ruby/pull/944) Add support for the Issuing Dispute Submit API
|
|
8
|
+
|
|
9
|
+
## 5.24.0 - 2020-08-26
|
|
10
|
+
* [#939](https://github.com/stripe/stripe-ruby/pull/939) Extract configurations into separate object
|
|
11
|
+
* [#940](https://github.com/stripe/stripe-ruby/pull/940) Fix typo in documentation of `stripe_object.rb`
|
|
12
|
+
|
|
13
|
+
## 5.23.1 - 2020-08-05
|
|
14
|
+
* [#936](https://github.com/stripe/stripe-ruby/pull/936) Rename API resource's `request` method
|
|
15
|
+
|
|
16
|
+
## 5.23.0 - 2020-08-05
|
|
17
|
+
* [#937](https://github.com/stripe/stripe-ruby/pull/937) Add support for the `PromotionCode` resource and APIs
|
|
18
|
+
|
|
3
19
|
## 5.22.0 - 2020-05-11
|
|
4
20
|
* [#918](https://github.com/stripe/stripe-ruby/pull/918) Add support for the `LineItem` resource and APIs
|
|
5
21
|
|
data/README.md
CHANGED
|
@@ -60,14 +60,14 @@ available in your [Stripe Dashboard][api-keys]. Set `Stripe.api_key` to its
|
|
|
60
60
|
value:
|
|
61
61
|
|
|
62
62
|
```ruby
|
|
63
|
-
require
|
|
64
|
-
Stripe.api_key =
|
|
63
|
+
require 'stripe'
|
|
64
|
+
Stripe.api_key = 'sk_test_...'
|
|
65
65
|
|
|
66
66
|
# list customers
|
|
67
67
|
Stripe::Customer.list()
|
|
68
68
|
|
|
69
69
|
# retrieve single customer
|
|
70
|
-
Stripe::Customer.retrieve(
|
|
70
|
+
Stripe::Customer.retrieve('cus_123456789')
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
### Per-request Configuration
|
|
@@ -82,38 +82,38 @@ require "stripe"
|
|
|
82
82
|
Stripe::Customer.list(
|
|
83
83
|
{},
|
|
84
84
|
{
|
|
85
|
-
api_key:
|
|
86
|
-
stripe_account:
|
|
87
|
-
stripe_version:
|
|
85
|
+
api_key: 'sk_test_...',
|
|
86
|
+
stripe_account: 'acct_...',
|
|
87
|
+
stripe_version: '2018-02-28',
|
|
88
88
|
}
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
Stripe::Customer.retrieve(
|
|
92
|
-
|
|
92
|
+
'cus_123456789',
|
|
93
93
|
{
|
|
94
|
-
api_key:
|
|
95
|
-
stripe_account:
|
|
96
|
-
stripe_version:
|
|
94
|
+
api_key: 'sk_test_...',
|
|
95
|
+
stripe_account: 'acct_...',
|
|
96
|
+
stripe_version: '2018-02-28',
|
|
97
97
|
}
|
|
98
98
|
)
|
|
99
99
|
|
|
100
100
|
Stripe::Customer.retrieve(
|
|
101
101
|
{
|
|
102
|
-
id:
|
|
102
|
+
id: 'cus_123456789',
|
|
103
103
|
expand: %w(balance_transaction)
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
|
-
stripe_version:
|
|
107
|
-
api_key:
|
|
106
|
+
stripe_version: '2018-02-28',
|
|
107
|
+
api_key: 'sk_test_...',
|
|
108
108
|
}
|
|
109
109
|
)
|
|
110
110
|
|
|
111
111
|
Stripe::Customer.capture(
|
|
112
|
-
|
|
112
|
+
'cus_123456789',
|
|
113
113
|
{},
|
|
114
114
|
{
|
|
115
|
-
stripe_version:
|
|
116
|
-
api_key:
|
|
115
|
+
stripe_version: '2018-02-28',
|
|
116
|
+
api_key: 'sk_test_...',
|
|
117
117
|
}
|
|
118
118
|
)
|
|
119
119
|
```
|
|
@@ -136,7 +136,7 @@ method:
|
|
|
136
136
|
```ruby
|
|
137
137
|
client = Stripe::StripeClient.new
|
|
138
138
|
customer, resp = client.request do
|
|
139
|
-
Stripe::Customer.retrieve(
|
|
139
|
+
Stripe::Customer.retrieve('cus_123456789',)
|
|
140
140
|
end
|
|
141
141
|
puts resp.request_id
|
|
142
142
|
```
|
|
@@ -146,7 +146,7 @@ puts resp.request_id
|
|
|
146
146
|
A proxy can be configured with `Stripe.proxy`:
|
|
147
147
|
|
|
148
148
|
```ruby
|
|
149
|
-
Stripe.proxy =
|
|
149
|
+
Stripe.proxy = 'https://user:pass@example.com:1234'
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
### Configuring an API Version
|
|
@@ -155,7 +155,7 @@ By default, the library will use the API version pinned to the account making
|
|
|
155
155
|
a request. This can be overridden with this global option:
|
|
156
156
|
|
|
157
157
|
```ruby
|
|
158
|
-
Stripe.api_version =
|
|
158
|
+
Stripe.api_version = '2018-02-28'
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
See [versioning in the API reference][versioning] for more information.
|
|
@@ -166,7 +166,7 @@ By default, the library will use its own internal bundle of known CA
|
|
|
166
166
|
certificates, but it's possible to configure your own:
|
|
167
167
|
|
|
168
168
|
```ruby
|
|
169
|
-
Stripe.ca_bundle_path =
|
|
169
|
+
Stripe.ca_bundle_path = 'path/to/ca/bundle'
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
### Configuring Automatic Retries
|
|
@@ -258,7 +258,7 @@ For example:
|
|
|
258
258
|
Stripe::Instrumentation.subscribe(:request_end) do |request_event|
|
|
259
259
|
tags = {
|
|
260
260
|
method: request_event.method,
|
|
261
|
-
resource: request_event.path.split(
|
|
261
|
+
resource: request_event.path.split('/')[2],
|
|
262
262
|
code: request_event.http_status,
|
|
263
263
|
retries: request_event.num_retries
|
|
264
264
|
}
|
|
@@ -272,7 +272,7 @@ If you're writing a plugin that uses the library, we'd appreciate it if you
|
|
|
272
272
|
identified using `#set_app_info`:
|
|
273
273
|
|
|
274
274
|
```ruby
|
|
275
|
-
Stripe.set_app_info(
|
|
275
|
+
Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesomeplugin.info')
|
|
276
276
|
```
|
|
277
277
|
|
|
278
278
|
This information is passed along when the library makes calls to the Stripe
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.
|
|
1
|
+
5.26.0
|
data/lib/stripe.rb
CHANGED
|
@@ -12,6 +12,7 @@ require "securerandom"
|
|
|
12
12
|
require "set"
|
|
13
13
|
require "socket"
|
|
14
14
|
require "uri"
|
|
15
|
+
require "forwardable"
|
|
15
16
|
|
|
16
17
|
# Version
|
|
17
18
|
require "stripe/version"
|
|
@@ -38,6 +39,7 @@ require "stripe/error_object"
|
|
|
38
39
|
require "stripe/api_resource"
|
|
39
40
|
require "stripe/singleton_api_resource"
|
|
40
41
|
require "stripe/webhook"
|
|
42
|
+
require "stripe/stripe_configuration"
|
|
41
43
|
|
|
42
44
|
# Named API resources
|
|
43
45
|
require "stripe/resources"
|
|
@@ -48,47 +50,41 @@ require "stripe/oauth"
|
|
|
48
50
|
module Stripe
|
|
49
51
|
DEFAULT_CA_BUNDLE_PATH = __dir__ + "/data/ca-certificates.crt"
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@uploads_base = "https://files.stripe.com"
|
|
56
|
-
|
|
57
|
-
@log_level = nil
|
|
58
|
-
@logger = nil
|
|
59
|
-
|
|
60
|
-
@proxy = nil
|
|
61
|
-
|
|
62
|
-
@max_network_retries = 0
|
|
63
|
-
@max_network_retry_delay = 2
|
|
64
|
-
@initial_network_retry_delay = 0.5
|
|
65
|
-
|
|
66
|
-
@ca_bundle_path = DEFAULT_CA_BUNDLE_PATH
|
|
67
|
-
@ca_store = nil
|
|
68
|
-
@verify_ssl_certs = true
|
|
53
|
+
# map to the same values as the standard library's logger
|
|
54
|
+
LEVEL_DEBUG = Logger::DEBUG
|
|
55
|
+
LEVEL_ERROR = Logger::ERROR
|
|
56
|
+
LEVEL_INFO = Logger::INFO
|
|
69
57
|
|
|
70
|
-
@
|
|
71
|
-
@read_timeout = 80
|
|
58
|
+
@app_info = nil
|
|
72
59
|
|
|
73
|
-
@
|
|
60
|
+
@configuration = Stripe::StripeConfiguration.setup
|
|
74
61
|
|
|
75
62
|
class << self
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
extend Forwardable
|
|
64
|
+
|
|
65
|
+
# User configurable options
|
|
66
|
+
def_delegators :@configuration, :api_key, :api_key=
|
|
67
|
+
def_delegators :@configuration, :api_version, :api_version=
|
|
68
|
+
def_delegators :@configuration, :stripe_account, :stripe_account=
|
|
69
|
+
def_delegators :@configuration, :api_base, :api_base=
|
|
70
|
+
def_delegators :@configuration, :uploads_base, :uploads_base=
|
|
71
|
+
def_delegators :@configuration, :connect_base, :connect_base=
|
|
72
|
+
def_delegators :@configuration, :open_timeout, :open_timeout=
|
|
73
|
+
def_delegators :@configuration, :read_timeout, :read_timeout=
|
|
74
|
+
def_delegators :@configuration, :proxy, :proxy=
|
|
75
|
+
def_delegators :@configuration, :verify_ssl_certs, :verify_ssl_certs=
|
|
76
|
+
def_delegators :@configuration, :ca_bundle_path, :ca_bundle_path=
|
|
77
|
+
def_delegators :@configuration, :log_level, :log_level=
|
|
78
|
+
def_delegators :@configuration, :logger, :logger=
|
|
79
|
+
def_delegators :@configuration, :max_network_retries, :max_network_retries=
|
|
80
|
+
def_delegators :@configuration, :enable_telemetry=, :enable_telemetry?
|
|
81
|
+
|
|
82
|
+
# Internal configurations
|
|
83
|
+
def_delegators :@configuration, :max_network_retry_delay
|
|
84
|
+
def_delegators :@configuration, :initial_network_retry_delay
|
|
85
|
+
def_delegators :@configuration, :ca_store
|
|
86
|
+
|
|
78
87
|
attr_accessor :client_id
|
|
79
|
-
attr_accessor :stripe_account
|
|
80
|
-
|
|
81
|
-
# These all get manual attribute writers so that we can reset connections
|
|
82
|
-
# if they change.
|
|
83
|
-
attr_reader :api_base
|
|
84
|
-
attr_reader :connect_base
|
|
85
|
-
attr_reader :open_timeout
|
|
86
|
-
attr_reader :proxy
|
|
87
|
-
attr_reader :read_timeout
|
|
88
|
-
attr_reader :uploads_base
|
|
89
|
-
attr_reader :verify_ssl_certs
|
|
90
|
-
|
|
91
|
-
attr_reader :max_network_retry_delay, :initial_network_retry_delay
|
|
92
88
|
end
|
|
93
89
|
|
|
94
90
|
# Gets the application for a plugin that's identified some. See
|
|
@@ -101,126 +97,6 @@ module Stripe
|
|
|
101
97
|
@app_info = info
|
|
102
98
|
end
|
|
103
99
|
|
|
104
|
-
def self.api_base=(api_base)
|
|
105
|
-
@api_base = api_base
|
|
106
|
-
StripeClient.clear_all_connection_managers
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# The location of a file containing a bundle of CA certificates. By default
|
|
110
|
-
# the library will use an included bundle that can successfully validate
|
|
111
|
-
# Stripe certificates.
|
|
112
|
-
def self.ca_bundle_path
|
|
113
|
-
@ca_bundle_path
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
def self.ca_bundle_path=(path)
|
|
117
|
-
@ca_bundle_path = path
|
|
118
|
-
|
|
119
|
-
# empty this field so a new store is initialized
|
|
120
|
-
@ca_store = nil
|
|
121
|
-
|
|
122
|
-
StripeClient.clear_all_connection_managers
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
# A certificate store initialized from the the bundle in #ca_bundle_path and
|
|
126
|
-
# which is used to validate TLS on every request.
|
|
127
|
-
#
|
|
128
|
-
# This was added to the give the gem "pseudo thread safety" in that it seems
|
|
129
|
-
# when initiating many parallel requests marshaling the certificate store is
|
|
130
|
-
# the most likely point of failure (see issue #382). Any program attempting
|
|
131
|
-
# to leverage this pseudo safety should make a call to this method (i.e.
|
|
132
|
-
# `Stripe.ca_store`) in their initialization code because it marshals lazily
|
|
133
|
-
# and is itself not thread safe.
|
|
134
|
-
def self.ca_store
|
|
135
|
-
@ca_store ||= begin
|
|
136
|
-
store = OpenSSL::X509::Store.new
|
|
137
|
-
store.add_file(ca_bundle_path)
|
|
138
|
-
store
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
def self.connect_base=(connect_base)
|
|
143
|
-
@connect_base = connect_base
|
|
144
|
-
StripeClient.clear_all_connection_managers
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def self.enable_telemetry?
|
|
148
|
-
@enable_telemetry
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def self.enable_telemetry=(val)
|
|
152
|
-
@enable_telemetry = val
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
# map to the same values as the standard library's logger
|
|
156
|
-
LEVEL_DEBUG = Logger::DEBUG
|
|
157
|
-
LEVEL_ERROR = Logger::ERROR
|
|
158
|
-
LEVEL_INFO = Logger::INFO
|
|
159
|
-
|
|
160
|
-
# When set prompts the library to log some extra information to $stdout and
|
|
161
|
-
# $stderr about what it's doing. For example, it'll produce information about
|
|
162
|
-
# requests, responses, and errors that are received. Valid log levels are
|
|
163
|
-
# `debug` and `info`, with `debug` being a little more verbose in places.
|
|
164
|
-
#
|
|
165
|
-
# Use of this configuration is only useful when `.logger` is _not_ set. When
|
|
166
|
-
# it is, the decision what levels to print is entirely deferred to the logger.
|
|
167
|
-
def self.log_level
|
|
168
|
-
@log_level
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
def self.log_level=(val)
|
|
172
|
-
# Backwards compatibility for values that we briefly allowed
|
|
173
|
-
if val == "debug"
|
|
174
|
-
val = LEVEL_DEBUG
|
|
175
|
-
elsif val == "info"
|
|
176
|
-
val = LEVEL_INFO
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
if !val.nil? && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(val)
|
|
180
|
-
raise ArgumentError,
|
|
181
|
-
"log_level should only be set to `nil`, `debug` or `info`"
|
|
182
|
-
end
|
|
183
|
-
@log_level = val
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
# Sets a logger to which logging output will be sent. The logger should
|
|
187
|
-
# support the same interface as the `Logger` class that's part of Ruby's
|
|
188
|
-
# standard library (hint, anything in `Rails.logger` will likely be
|
|
189
|
-
# suitable).
|
|
190
|
-
#
|
|
191
|
-
# If `.logger` is set, the value of `.log_level` is ignored. The decision on
|
|
192
|
-
# what levels to print is entirely deferred to the logger.
|
|
193
|
-
def self.logger
|
|
194
|
-
@logger
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
def self.logger=(val)
|
|
198
|
-
@logger = val
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
def self.max_network_retries
|
|
202
|
-
@max_network_retries
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
def self.max_network_retries=(val)
|
|
206
|
-
@max_network_retries = val.to_i
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
def self.open_timeout=(open_timeout)
|
|
210
|
-
@open_timeout = open_timeout
|
|
211
|
-
StripeClient.clear_all_connection_managers
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
def self.proxy=(proxy)
|
|
215
|
-
@proxy = proxy
|
|
216
|
-
StripeClient.clear_all_connection_managers
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
def self.read_timeout=(read_timeout)
|
|
220
|
-
@read_timeout = read_timeout
|
|
221
|
-
StripeClient.clear_all_connection_managers
|
|
222
|
-
end
|
|
223
|
-
|
|
224
100
|
# Sets some basic information about the running application that's sent along
|
|
225
101
|
# with API requests. Useful for plugin authors to identify their plugin when
|
|
226
102
|
# communicating with Stripe.
|
|
@@ -234,16 +110,6 @@ module Stripe
|
|
|
234
110
|
version: version,
|
|
235
111
|
}
|
|
236
112
|
end
|
|
237
|
-
|
|
238
|
-
def self.uploads_base=(uploads_base)
|
|
239
|
-
@uploads_base = uploads_base
|
|
240
|
-
StripeClient.clear_all_connection_managers
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
def self.verify_ssl_certs=(verify_ssl_certs)
|
|
244
|
-
@verify_ssl_certs = verify_ssl_certs
|
|
245
|
-
StripeClient.clear_all_connection_managers
|
|
246
|
-
end
|
|
247
113
|
end
|
|
248
114
|
|
|
249
115
|
Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
|
|
@@ -4,7 +4,7 @@ module Stripe
|
|
|
4
4
|
module APIOperations
|
|
5
5
|
module Create
|
|
6
6
|
def create(params = {}, opts = {})
|
|
7
|
-
resp, opts =
|
|
7
|
+
resp, opts = execute_resource_request(:post, resource_url, params, opts)
|
|
8
8
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -15,15 +15,19 @@ module Stripe
|
|
|
15
15
|
# * +opts+ - A Hash of additional options (separate from the params /
|
|
16
16
|
# object values) to be added to the request. E.g. to allow for an
|
|
17
17
|
# idempotency_key to be passed in the request headers, or for the
|
|
18
|
-
# api_key to be overwritten. See
|
|
18
|
+
# api_key to be overwritten. See
|
|
19
|
+
# {APIOperations::Request.execute_resource_request}.
|
|
19
20
|
def delete(id, params = {}, opts = {})
|
|
20
|
-
resp, opts =
|
|
21
|
+
resp, opts = execute_resource_request(:delete,
|
|
22
|
+
"#{resource_url}/#{id}",
|
|
23
|
+
params, opts)
|
|
21
24
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
22
25
|
end
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
def delete(params = {}, opts = {})
|
|
26
|
-
resp, opts =
|
|
29
|
+
resp, opts = execute_resource_request(:delete, resource_url,
|
|
30
|
+
params, opts)
|
|
27
31
|
initialize_from(resp.data, opts)
|
|
28
32
|
end
|
|
29
33
|
|