stripe 10.3.0.pre.beta.1 → 10.4.0.pre.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Makefile +1 -1
- data/OPENAPI_VERSION +1 -1
- data/README.md +4 -3
- data/VERSION +1 -1
- data/lib/stripe/api_operations/request.rb +13 -12
- data/lib/stripe/api_operations/save.rb +1 -1
- data/lib/stripe/api_version.rb +1 -1
- data/lib/stripe/singleton_api_resource.rb +19 -2
- data/lib/stripe/stripe_client.rb +16 -10
- data/lib/stripe/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7b70ab060653606fcb0aed81e4323829c6fd49c574ab49c67f2381acbe4d656
|
4
|
+
data.tar.gz: 903c2861ff74cf39b2615a41d490b1cbe854973064ffeb92344d4e48380f66f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b374960111dda05764ef8df8b03a11168c69691657258785db4615f99123f2ff7dd449e2b2b7192a32046e1560ce83f2e6d5040638041900c0f0360e80d9074
|
7
|
+
data.tar.gz: dd1b8cd4032de2f537131ee94d6959d36a8043ad723d1924d42ff5051f6f5517c2d0e1ef769aad17cc0774e19432d28b5000058c8782c69a6343d48d0cbb5dba
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 10.4.0-beta.1 - 2023-12-14
|
4
|
+
Updated stable APIs to the latest version
|
5
|
+
|
6
|
+
## 10.3.0 - 2023-12-14
|
7
|
+
* [#1294](https://github.com/stripe/stripe-ruby/pull/1294) Support sending parameters inside singleton retrieve
|
8
|
+
|
3
9
|
## 10.3.0-beta.1 - 2023-11-30
|
4
10
|
* [#1298](https://github.com/stripe/stripe-ruby/pull/1298) Update generated code for beta
|
5
11
|
* [#1296](https://github.com/stripe/stripe-ruby/pull/1296) Merge master into beta
|
data/Makefile
CHANGED
data/OPENAPI_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
v715
|
data/README.md
CHANGED
@@ -291,10 +291,11 @@ Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesom
|
|
291
291
|
This information is passed along when the library makes calls to the Stripe
|
292
292
|
API.
|
293
293
|
|
294
|
-
###
|
294
|
+
### Telemetry
|
295
295
|
|
296
|
-
By default, the library sends request latency
|
297
|
-
numbers help Stripe improve the overall latency of its API for all users
|
296
|
+
By default, the library sends telemetry to Stripe regarding request latency and feature usage. These
|
297
|
+
numbers help Stripe improve the overall latency of its API for all users, and
|
298
|
+
improve popular features.
|
298
299
|
|
299
300
|
You can disable this behavior if you prefer:
|
300
301
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
10.
|
1
|
+
10.4.0-beta.1
|
@@ -5,14 +5,14 @@ module Stripe
|
|
5
5
|
module Request
|
6
6
|
module ClassMethods
|
7
7
|
def execute_resource_request(method, url,
|
8
|
-
params = {}, opts = {})
|
8
|
+
params = {}, opts = {}, usage = [])
|
9
9
|
execute_resource_request_internal(
|
10
|
-
:execute_request, method, url, params, opts
|
10
|
+
:execute_request, method, url, params, opts, usage
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
14
14
|
def execute_resource_request_stream(method, url,
|
15
|
-
params = {}, opts = {},
|
15
|
+
params = {}, opts = {}, usage = [],
|
16
16
|
&read_body_chunk_block)
|
17
17
|
execute_resource_request_internal(
|
18
18
|
:execute_request_stream,
|
@@ -20,18 +20,19 @@ module Stripe
|
|
20
20
|
url,
|
21
21
|
params,
|
22
22
|
opts,
|
23
|
+
usage,
|
23
24
|
&read_body_chunk_block
|
24
25
|
)
|
25
26
|
end
|
26
27
|
|
27
|
-
private def request_stripe_object(method:, path:, params:, opts: {})
|
28
|
-
resp, opts = execute_resource_request(method, path, params, opts)
|
28
|
+
private def request_stripe_object(method:, path:, params:, opts: {}, usage: [])
|
29
|
+
resp, opts = execute_resource_request(method, path, params, opts, usage)
|
29
30
|
Util.convert_to_stripe_object_with_params(resp.data, params, opts)
|
30
31
|
end
|
31
32
|
|
32
33
|
private def execute_resource_request_internal(client_request_method_sym,
|
33
34
|
method, url,
|
34
|
-
params, opts,
|
35
|
+
params, opts, usage,
|
35
36
|
&read_body_chunk_block)
|
36
37
|
params ||= {}
|
37
38
|
|
@@ -54,8 +55,7 @@ module Stripe
|
|
54
55
|
client_request_method_sym,
|
55
56
|
method, url,
|
56
57
|
api_base: api_base, api_key: api_key,
|
57
|
-
headers: headers, params: params,
|
58
|
-
api_mode: api_mode,
|
58
|
+
headers: headers, params: params, usage: usage, api_mode: api_mode,
|
59
59
|
&read_body_chunk_block
|
60
60
|
)
|
61
61
|
|
@@ -68,6 +68,7 @@ module Stripe
|
|
68
68
|
[resp, opts_to_persist]
|
69
69
|
end
|
70
70
|
|
71
|
+
# TODO: (major)
|
71
72
|
# This method used to be called `request`, but it's such a short name
|
72
73
|
# that it eventually conflicted with the name of a field on an API
|
73
74
|
# resource (specifically, `Event#request`), so it was renamed to
|
@@ -113,9 +114,9 @@ module Stripe
|
|
113
114
|
end
|
114
115
|
|
115
116
|
protected def execute_resource_request(method, url,
|
116
|
-
params = {}, opts = {})
|
117
|
+
params = {}, opts = {}, usage = [])
|
117
118
|
opts = @opts.merge(Util.normalize_opts(opts))
|
118
|
-
self.class.execute_resource_request(method, url, params, opts)
|
119
|
+
self.class.execute_resource_request(method, url, params, opts, usage)
|
119
120
|
end
|
120
121
|
|
121
122
|
protected def execute_resource_request_stream(method, url,
|
@@ -127,8 +128,8 @@ module Stripe
|
|
127
128
|
)
|
128
129
|
end
|
129
130
|
|
130
|
-
private def request_stripe_object(method:, path:, params:, opts: {})
|
131
|
-
resp, opts = execute_resource_request(method, path, params, opts)
|
131
|
+
private def request_stripe_object(method:, path:, params:, opts: {}, usage: [])
|
132
|
+
resp, opts = execute_resource_request(method, path, params, opts, usage)
|
132
133
|
Util.convert_to_stripe_object_with_params(resp.data, params, opts)
|
133
134
|
end
|
134
135
|
|
@@ -66,7 +66,7 @@ module Stripe
|
|
66
66
|
# generated a uri for this object with an identifier baked in
|
67
67
|
values.delete(:id)
|
68
68
|
|
69
|
-
resp, opts = execute_resource_request(:post, save_url, values, opts)
|
69
|
+
resp, opts = execute_resource_request(:post, save_url, values, opts, ["save"])
|
70
70
|
initialize_from(resp.data, opts)
|
71
71
|
end
|
72
72
|
extend Gem::Deprecate
|
data/lib/stripe/api_version.rb
CHANGED
@@ -17,8 +17,25 @@ module Stripe
|
|
17
17
|
self.class.resource_url
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.retrieve(
|
21
|
-
|
20
|
+
def self.retrieve(params_or_opts = {}, definitely_opts = nil)
|
21
|
+
opts = nil
|
22
|
+
params = nil
|
23
|
+
if definitely_opts.nil?
|
24
|
+
unrecognized_key = params_or_opts.keys.find { |k| !Util::OPTS_USER_SPECIFIED.include?(k) }
|
25
|
+
if unrecognized_key
|
26
|
+
raise ArgumentError,
|
27
|
+
"Unrecognized request option: #{unrecognized_key}. Did you mean to specify this as retrieve params? " \
|
28
|
+
"If so, you must explicitly pass an opts hash as a second argument. " \
|
29
|
+
"For example: .retrieve({#{unrecognized_key}: 'foo'}, {})"
|
30
|
+
end
|
31
|
+
|
32
|
+
opts = params_or_opts
|
33
|
+
else
|
34
|
+
opts = definitely_opts
|
35
|
+
params = params_or_opts
|
36
|
+
end
|
37
|
+
|
38
|
+
instance = new(params, Util.normalize_opts(opts))
|
22
39
|
instance.refresh
|
23
40
|
instance
|
24
41
|
end
|
data/lib/stripe/stripe_client.rb
CHANGED
@@ -210,9 +210,9 @@ module Stripe
|
|
210
210
|
|
211
211
|
def execute_request(method, path,
|
212
212
|
api_base: nil, api_key: nil,
|
213
|
-
headers: {}, params: {}, api_mode: nil)
|
213
|
+
headers: {}, params: {}, api_mode: nil, usage: [])
|
214
214
|
http_resp, api_key = execute_request_internal(
|
215
|
-
method, path, api_base, api_key, headers, params, api_mode
|
215
|
+
method, path, api_base, api_key, headers, params, api_mode, usage
|
216
216
|
)
|
217
217
|
|
218
218
|
begin
|
@@ -241,7 +241,7 @@ module Stripe
|
|
241
241
|
# passed, then a StripeStreamResponse is returned containing an IO stream
|
242
242
|
# with the response body.
|
243
243
|
def execute_request_stream(method, path,
|
244
|
-
api_base: nil, api_key: nil,
|
244
|
+
api_base: nil, api_key: nil, usage: [],
|
245
245
|
headers: {}, params: {},
|
246
246
|
api_mode: nil,
|
247
247
|
&read_body_chunk_block)
|
@@ -252,7 +252,7 @@ module Stripe
|
|
252
252
|
|
253
253
|
http_resp, api_key = execute_request_internal(
|
254
254
|
method, path, api_base, api_key,
|
255
|
-
headers, params, api_mode, &read_body_chunk_block
|
255
|
+
headers, params, api_mode, usage, &read_body_chunk_block
|
256
256
|
)
|
257
257
|
|
258
258
|
# When the read_body_chunk_block is given, we no longer have access to the
|
@@ -432,7 +432,7 @@ module Stripe
|
|
432
432
|
|
433
433
|
private def execute_request_internal(method, path,
|
434
434
|
api_base, api_key, headers, params,
|
435
|
-
api_mode, &read_body_chunk_block)
|
435
|
+
api_mode, usage, &read_body_chunk_block)
|
436
436
|
raise ArgumentError, "method should be a symbol" \
|
437
437
|
unless method.is_a?(Symbol)
|
438
438
|
raise ArgumentError, "path should be a string" \
|
@@ -498,7 +498,7 @@ module Stripe
|
|
498
498
|
end
|
499
499
|
|
500
500
|
http_resp =
|
501
|
-
execute_request_with_rescues(method, api_base, headers, context) do
|
501
|
+
execute_request_with_rescues(method, api_base, headers, usage, context) do
|
502
502
|
self.class
|
503
503
|
.default_connection_manager(config)
|
504
504
|
.execute_request(method, url,
|
@@ -583,7 +583,7 @@ module Stripe
|
|
583
583
|
http_status >= 400
|
584
584
|
end
|
585
585
|
|
586
|
-
private def execute_request_with_rescues(method, api_base, headers, context)
|
586
|
+
private def execute_request_with_rescues(method, api_base, headers, usage, context)
|
587
587
|
num_retries = 0
|
588
588
|
|
589
589
|
begin
|
@@ -609,7 +609,7 @@ module Stripe
|
|
609
609
|
if config.enable_telemetry? && context.request_id
|
610
610
|
request_duration_ms = (request_duration * 1000).to_i
|
611
611
|
@last_request_metrics =
|
612
|
-
StripeRequestMetrics.new(context.request_id, request_duration_ms)
|
612
|
+
StripeRequestMetrics.new(context.request_id, request_duration_ms, usage: usage)
|
613
613
|
end
|
614
614
|
|
615
615
|
# We rescue all exceptions from a request so that we have an easy spot to
|
@@ -1072,13 +1072,19 @@ module Stripe
|
|
1072
1072
|
# Request duration in milliseconds
|
1073
1073
|
attr_accessor :request_duration_ms
|
1074
1074
|
|
1075
|
-
|
1075
|
+
# list of names of tracked behaviors associated with this request
|
1076
|
+
attr_accessor :usage
|
1077
|
+
|
1078
|
+
def initialize(request_id, request_duration_ms, usage: [])
|
1076
1079
|
self.request_id = request_id
|
1077
1080
|
self.request_duration_ms = request_duration_ms
|
1081
|
+
self.usage = usage
|
1078
1082
|
end
|
1079
1083
|
|
1080
1084
|
def payload
|
1081
|
-
{ request_id: request_id, request_duration_ms: request_duration_ms }
|
1085
|
+
ret = { request_id: request_id, request_duration_ms: request_duration_ms }
|
1086
|
+
ret[:usage] = usage if !usage.nil? && !usage.empty?
|
1087
|
+
ret
|
1082
1088
|
end
|
1083
1089
|
end
|
1084
1090
|
end
|
data/lib/stripe/version.rb
CHANGED
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: 10.
|
4
|
+
version: 10.4.0.pre.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-15 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.
|