terminal-shop 3.8.9 → 3.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7f5c4f7f56e756435c0a707cc2fcf9255fa738d5cfcd05a1a65763ec528f7cc
4
- data.tar.gz: abbe65c733114e77044e9e991ad6f122a52aefd6cf5e6b9d0f93f8993395b56d
3
+ metadata.gz: 8641a7314cfe99c67112619c269abe92eeb80b2ab8afbf552713b5164c3a1f5c
4
+ data.tar.gz: 4b040668b4aa5ca2bf01798abed02611a0a932f2a6641881b30a0c15c57995fd
5
5
  SHA512:
6
- metadata.gz: dfa49b7b447bdf9e4c14767d138f8a78b994dbd03cd33aefb86f420d41a232ad836c18184d8b4cbc097ccc98f1db0ae2beb2e32a3d33932ef056d5c1d89e85c1
7
- data.tar.gz: 7162025bcb37db82ca0b4f34150f89fafe2446b2ad5c92b06a0ca53b8a3d84fb64f33a74a21ccffc892067d5b949fce6b41530a4d8554ddfe76b30e4d970825f
6
+ metadata.gz: 3e5944cb9959d6936ca56ce7aa8f6cee16fe64fc19a5a2a53ab84220dfbb6d94738a534f5200fd8578f1d46d88e4363f7b26d1c1627325fbc99a2f2969ff1165
7
+ data.tar.gz: 7c5b1d0265e12770da0be79d3bdea8e94932bb400112f58a72b7df96d072f5f6a024a6ce50f29ee42957b50eb1ab280ba52d8c4986fd845dd0f676e66c784f6e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.9.0 (2025-09-27)
4
+
5
+ Full Changelog: [v3.8.10...v3.9.0](https://github.com/terminaldotshop/terminal-sdk-ruby/compare/v3.8.10...v3.9.0)
6
+
7
+ ### Features
8
+
9
+ * expose response headers for both streams and errors ([21b1cb6](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/21b1cb61ee1b0264d04fb4ce3c7b12e65b8dace9))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * shorten multipart boundary sep to less than RFC specificed max length ([b1cb8d7](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/b1cb8d7f52a4cb1fccb512e82aab97d54c6687fa))
15
+
16
+
17
+ ### Performance Improvements
18
+
19
+ * faster code formatting ([c4d7efd](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/c4d7efd87dddd04e7099452f717a5e2becab73c2))
20
+
21
+
22
+ ### Chores
23
+
24
+ * add json schema comment for rubocop.yml ([cdd17ee](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/cdd17ee6be620549c47c1656dde4c70c4a76d6cc))
25
+ * **internal:** codegen related update ([5b3d643](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/5b3d643979e95d1bf5084fae10f85fc8e73e648d))
26
+ * **internal:** codegen related update ([2195e2b](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/2195e2b0ea1cbbf360bb5c3373626e538676266f))
27
+
28
+ ## 3.8.10 (2025-08-20)
29
+
30
+ Full Changelog: [v3.8.9...v3.8.10](https://github.com/terminaldotshop/terminal-sdk-ruby/compare/v3.8.9...v3.8.10)
31
+
32
+ ### Bug Fixes
33
+
34
+ * bump sorbet version and fix new type errors from the breaking change ([b8a165c](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/b8a165c99dda340d95ee12680ad4a662dae84adb))
35
+
36
+
37
+ ### Chores
38
+
39
+ * collect metadata from type DSL ([48d6bd6](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/48d6bd6aef75e097d4fac1e87680a56194a46849))
40
+ * **internal:** update comment in script ([29e8d0e](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/29e8d0ee82f862af88091ce124082f798a73d52f))
41
+ * update @stainless-api/prism-cli to v5.15.0 ([c859658](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/c85965842c1dd5e37ed2f37010a8dfa096f12147))
42
+
3
43
  ## 3.8.9 (2025-08-05)
4
44
 
5
45
  Full Changelog: [v3.8.8...v3.8.9](https://github.com/terminaldotshop/terminal-sdk-ruby/compare/v3.8.8...v3.8.9)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "terminal-shop", "~> 3.8.9"
20
+ gem "terminal-shop", "~> 3.9.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -40,6 +40,9 @@ module TerminalShop
40
40
  # @return [Integer, nil]
41
41
  attr_accessor :status
42
42
 
43
+ # @return [Hash{String=>String}, nil]
44
+ attr_accessor :headers
45
+
43
46
  # @return [Object, nil]
44
47
  attr_accessor :body
45
48
 
@@ -47,13 +50,15 @@ module TerminalShop
47
50
  #
48
51
  # @param url [URI::Generic]
49
52
  # @param status [Integer, nil]
53
+ # @param headers [Hash{String=>String}, nil]
50
54
  # @param body [Object, nil]
51
55
  # @param request [nil]
52
56
  # @param response [nil]
53
57
  # @param message [String, nil]
54
- def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil)
58
+ def initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil)
55
59
  @url = url
56
60
  @status = status
61
+ @headers = headers
57
62
  @body = body
58
63
  @request = request
59
64
  @response = response
@@ -74,6 +79,7 @@ module TerminalShop
74
79
  #
75
80
  # @param url [URI::Generic]
76
81
  # @param status [nil]
82
+ # @param headers [Hash{String=>String}, nil]
77
83
  # @param body [nil]
78
84
  # @param request [nil]
79
85
  # @param response [nil]
@@ -81,6 +87,7 @@ module TerminalShop
81
87
  def initialize(
82
88
  url:,
83
89
  status: nil,
90
+ headers: nil,
84
91
  body: nil,
85
92
  request: nil,
86
93
  response: nil,
@@ -95,6 +102,7 @@ module TerminalShop
95
102
  #
96
103
  # @param url [URI::Generic]
97
104
  # @param status [nil]
105
+ # @param headers [Hash{String=>String}, nil]
98
106
  # @param body [nil]
99
107
  # @param request [nil]
100
108
  # @param response [nil]
@@ -102,6 +110,7 @@ module TerminalShop
102
110
  def initialize(
103
111
  url:,
104
112
  status: nil,
113
+ headers: nil,
105
114
  body: nil,
106
115
  request: nil,
107
116
  response: nil,
@@ -116,21 +125,24 @@ module TerminalShop
116
125
  #
117
126
  # @param url [URI::Generic]
118
127
  # @param status [Integer]
128
+ # @param headers [Hash{String=>String}, nil]
119
129
  # @param body [Object, nil]
120
130
  # @param request [nil]
121
131
  # @param response [nil]
122
132
  # @param message [String, nil]
123
133
  #
124
134
  # @return [self]
125
- def self.for(url:, status:, body:, request:, response:, message: nil)
126
- kwargs = {
127
- url: url,
128
- status: status,
129
- body: body,
130
- request: request,
131
- response: response,
132
- message: message
133
- }
135
+ def self.for(url:, status:, headers:, body:, request:, response:, message: nil)
136
+ kwargs =
137
+ {
138
+ url: url,
139
+ status: status,
140
+ headers: headers,
141
+ body: body,
142
+ request: request,
143
+ response: response,
144
+ message: message
145
+ }
134
146
 
135
147
  case status
136
148
  in 400
@@ -162,15 +174,17 @@ module TerminalShop
162
174
  #
163
175
  # @param url [URI::Generic]
164
176
  # @param status [Integer]
177
+ # @param headers [Hash{String=>String}, nil]
165
178
  # @param body [Object, nil]
166
179
  # @param request [nil]
167
180
  # @param response [nil]
168
181
  # @param message [String, nil]
169
- def initialize(url:, status:, body:, request:, response:, message: nil)
182
+ def initialize(url:, status:, headers:, body:, request:, response:, message: nil)
170
183
  message ||= {url: url.to_s, status: status, body: body}
171
184
  super(
172
185
  url: url,
173
186
  status: status,
187
+ headers: headers,
174
188
  body: body,
175
189
  request: request,
176
190
  response: response,
@@ -47,7 +47,7 @@ module TerminalShop
47
47
  # @api private
48
48
  #
49
49
  # @param status [Integer]
50
- # @param headers [Hash{String=>String}, Net::HTTPHeader]
50
+ # @param headers [Hash{String=>String}]
51
51
  #
52
52
  # @return [Boolean]
53
53
  def should_retry?(status, headers:)
@@ -85,7 +85,7 @@ module TerminalShop
85
85
  #
86
86
  # @param status [Integer]
87
87
  #
88
- # @param response_headers [Hash{String=>String}, Net::HTTPHeader]
88
+ # @param response_headers [Hash{String=>String}]
89
89
  #
90
90
  # @return [Hash{Symbol=>Object}]
91
91
  def follow_redirect(request, status:, response_headers:)
@@ -367,10 +367,7 @@ module TerminalShop
367
367
  # @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
368
368
  def send_request(request, redirect_count:, retry_count:, send_retry_header:)
369
369
  url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
370
- input = {
371
- **request.except(:timeout),
372
- deadline: TerminalShop::Internal::Util.monotonic_secs + timeout
373
- }
370
+ input = {**request.except(:timeout), deadline: TerminalShop::Internal::Util.monotonic_secs + timeout}
374
371
 
375
372
  if send_retry_header
376
373
  headers["x-stainless-retry-count"] = retry_count.to_s
@@ -381,6 +378,7 @@ module TerminalShop
381
378
  rescue TerminalShop::Errors::APIConnectionError => e
382
379
  status = e
383
380
  end
381
+ headers = TerminalShop::Internal::Util.normalized_headers(response&.each_header&.to_h)
384
382
 
385
383
  case status
386
384
  in ..299
@@ -393,7 +391,7 @@ module TerminalShop
393
391
  in 300..399
394
392
  self.class.reap_connection!(status, stream: stream)
395
393
 
396
- request = self.class.follow_redirect(request, status: status, response_headers: response)
394
+ request = self.class.follow_redirect(request, status: status, response_headers: headers)
397
395
  send_request(
398
396
  request,
399
397
  redirect_count: redirect_count + 1,
@@ -402,9 +400,9 @@ module TerminalShop
402
400
  )
403
401
  in TerminalShop::Errors::APIConnectionError if retry_count >= max_retries
404
402
  raise status
405
- in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: response)
403
+ in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: headers)
406
404
  decoded = Kernel.then do
407
- TerminalShop::Internal::Util.decode_content(response, stream: stream, suppress_error: true)
405
+ TerminalShop::Internal::Util.decode_content(headers, stream: stream, suppress_error: true)
408
406
  ensure
409
407
  self.class.reap_connection!(status, stream: stream)
410
408
  end
@@ -412,6 +410,7 @@ module TerminalShop
412
410
  raise TerminalShop::Errors::APIStatusError.for(
413
411
  url: url,
414
412
  status: status,
413
+ headers: headers,
415
414
  body: decoded,
416
415
  request: nil,
417
416
  response: response
@@ -488,19 +487,21 @@ module TerminalShop
488
487
  send_retry_header: send_retry_header
489
488
  )
490
489
 
491
- decoded = TerminalShop::Internal::Util.decode_content(response, stream: stream)
490
+ headers = TerminalShop::Internal::Util.normalized_headers(response.each_header.to_h)
491
+ decoded = TerminalShop::Internal::Util.decode_content(headers, stream: stream)
492
492
  case req
493
493
  in {stream: Class => st}
494
494
  st.new(
495
495
  model: model,
496
496
  url: url,
497
497
  status: status,
498
+ headers: headers,
498
499
  response: response,
499
500
  unwrap: unwrap,
500
501
  stream: decoded
501
502
  )
502
503
  in {page: Class => page}
503
- page.new(client: self, req: req, headers: response, page_data: decoded)
504
+ page.new(client: self, req: req, headers: headers, page_data: decoded)
504
505
  else
505
506
  unwrapped = TerminalShop::Internal::Util.dig(decoded, unwrap)
506
507
  TerminalShop::Internal::Type::Converter.coerce(model, unwrapped)
@@ -193,15 +193,7 @@ module TerminalShop
193
193
  end
194
194
 
195
195
  define_sorbet_constant!(:Request) do
196
- T.type_alias do
197
- {
198
- method: Symbol,
199
- url: URI::Generic,
200
- headers: T::Hash[String, String],
201
- body: T.anything,
202
- deadline: Float
203
- }
204
- end
196
+ T.type_alias { {method: Symbol, url: URI::Generic, headers: T::Hash[String, String], body: T.anything, deadline: Float} }
205
197
  end
206
198
  end
207
199
  end
@@ -148,6 +148,7 @@ module TerminalShop
148
148
  # @option spec [Boolean] :"nil?"
149
149
  def initialize(type_info, spec = {})
150
150
  @item_type_fn = TerminalShop::Internal::Type::Converter.type_info(type_info || spec)
151
+ @meta = TerminalShop::Internal::Type::Converter.meta_info(type_info, spec)
151
152
  @nilable = spec.fetch(:nil?, false)
152
153
  end
153
154
 
@@ -52,6 +52,7 @@ module TerminalShop
52
52
  #
53
53
  # @option spec [Boolean] :"nil?"
54
54
  private def add_field(name_sym, required:, type_info:, spec:)
55
+ meta = TerminalShop::Internal::Type::Converter.meta_info(type_info, spec)
55
56
  type_fn, info =
56
57
  case type_info
57
58
  in Proc | TerminalShop::Internal::Type::Converter | Class
@@ -63,14 +64,7 @@ module TerminalShop
63
64
  setter = :"#{name_sym}="
64
65
  api_name = info.fetch(:api_name, name_sym)
65
66
  nilable = info.fetch(:nil?, false)
66
- const = if required && !nilable
67
- info.fetch(
68
- :const,
69
- TerminalShop::Internal::OMIT
70
- )
71
- else
72
- TerminalShop::Internal::OMIT
73
- end
67
+ const = required && !nilable ? info.fetch(:const, TerminalShop::Internal::OMIT) : TerminalShop::Internal::OMIT
74
68
 
75
69
  [name_sym, setter].each { undef_method(_1) } if known_fields.key?(name_sym)
76
70
 
@@ -81,7 +75,8 @@ module TerminalShop
81
75
  required: required,
82
76
  nilable: nilable,
83
77
  const: const,
84
- type_fn: type_fn
78
+ type_fn: type_fn,
79
+ meta: meta
85
80
  }
86
81
 
87
82
  define_method(setter) do |value|
@@ -39,7 +39,7 @@ module TerminalShop
39
39
  #
40
40
  # @param client [TerminalShop::Internal::Transport::BaseClient]
41
41
  # @param req [Hash{Symbol=>Object}]
42
- # @param headers [Hash{String=>String}, Net::HTTPHeader]
42
+ # @param headers [Hash{String=>String}]
43
43
  # @param page_data [Object]
44
44
  def initialize(client:, req:, headers:, page_data:)
45
45
  @client = client
@@ -98,6 +98,33 @@ module TerminalShop
98
98
  end
99
99
  end
100
100
 
101
+ # @api private
102
+ #
103
+ # @param type_info [Hash{Symbol=>Object}, Proc, TerminalShop::Internal::Type::Converter, Class] .
104
+ #
105
+ # @option type_info [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
106
+ #
107
+ # @option type_info [Proc] :enum
108
+ #
109
+ # @option type_info [Proc] :union
110
+ #
111
+ # @option type_info [Boolean] :"nil?"
112
+ #
113
+ # @param spec [Hash{Symbol=>Object}, Proc, TerminalShop::Internal::Type::Converter, Class] .
114
+ #
115
+ # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
116
+ #
117
+ # @option spec [Proc] :enum
118
+ #
119
+ # @option spec [Proc] :union
120
+ #
121
+ # @option spec [Boolean] :"nil?"
122
+ #
123
+ # @return [Hash{Symbol=>Object}]
124
+ def meta_info(type_info, spec)
125
+ [spec, type_info].grep(Hash).first.to_h.except(:const, :enum, :union, :nil?)
126
+ end
127
+
101
128
  # @api private
102
129
  #
103
130
  # @param translate_names [Boolean]
@@ -168,6 +168,7 @@ module TerminalShop
168
168
  # @option spec [Boolean] :"nil?"
169
169
  def initialize(type_info, spec = {})
170
170
  @item_type_fn = TerminalShop::Internal::Type::Converter.type_info(type_info || spec)
171
+ @meta = TerminalShop::Internal::Type::Converter.meta_info(type_info, spec)
171
172
  @nilable = spec.fetch(:nil?, false)
172
173
  end
173
174
 
@@ -12,20 +12,20 @@ module TerminalShop
12
12
  #
13
13
  # All of the specified variant info for this union.
14
14
  #
15
- # @return [Array<Array(Symbol, Proc)>]
15
+ # @return [Array<Array(Symbol, Proc, Hash{Symbol=>Object})>]
16
16
  private def known_variants = (@known_variants ||= [])
17
17
 
18
18
  # @api private
19
19
  #
20
- # @return [Array<Array(Symbol, Object)>]
20
+ # @return [Array<Array(Symbol, Object, Hash{Symbol=>Object})>]
21
21
  protected def derefed_variants
22
- known_variants.map { |key, variant_fn| [key, variant_fn.call] }
22
+ known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] }
23
23
  end
24
24
 
25
25
  # All of the specified variants for this union.
26
26
  #
27
27
  # @return [Array<Object>]
28
- def variants = derefed_variants.map(&:last)
28
+ def variants = derefed_variants.map { _2 }
29
29
 
30
30
  # @api private
31
31
  #
@@ -51,12 +51,13 @@ module TerminalShop
51
51
  #
52
52
  # @option spec [Boolean] :"nil?"
53
53
  private def variant(key, spec = nil)
54
+ meta = TerminalShop::Internal::Type::Converter.meta_info(nil, spec)
54
55
  variant_info =
55
56
  case key
56
57
  in Symbol
57
- [key, TerminalShop::Internal::Type::Converter.type_info(spec)]
58
+ [key, TerminalShop::Internal::Type::Converter.type_info(spec), meta]
58
59
  in Proc | TerminalShop::Internal::Type::Converter | Class | Hash
59
- [nil, TerminalShop::Internal::Type::Converter.type_info(key)]
60
+ [nil, TerminalShop::Internal::Type::Converter.type_info(key), meta]
60
61
  end
61
62
 
62
63
  known_variants << variant_info
@@ -79,7 +80,8 @@ module TerminalShop
79
80
  return nil if key == TerminalShop::Internal::OMIT
80
81
 
81
82
  key = key.to_sym if key.is_a?(String)
82
- known_variants.find { |k,| k == key }&.last&.call
83
+ _, found = known_variants.find { |k,| k == key }
84
+ found&.call
83
85
  else
84
86
  nil
85
87
  end
@@ -244,7 +244,7 @@ module TerminalShop
244
244
  #
245
245
  # @return [String]
246
246
  def uri_origin(uri)
247
- "#{uri.scheme}://#{uri.host}#{uri.port == uri.default_port ? '' : ":#{uri.port}"}"
247
+ "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
248
  end
249
249
 
250
250
  # @api private
@@ -566,7 +566,8 @@ module TerminalShop
566
566
  #
567
567
  # @return [Array(String, Enumerable<String>)]
568
568
  private def encode_multipart_streaming(body)
569
- boundary = SecureRandom.urlsafe_base64(60)
569
+ # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
570
+ boundary = SecureRandom.urlsafe_base64(46)
570
571
 
571
572
  closing = []
572
573
  strio = writable_enum do |y|
@@ -647,7 +648,7 @@ module TerminalShop
647
648
  #
648
649
  # Assumes each chunk in stream has `Encoding::BINARY`.
649
650
  #
650
- # @param headers [Hash{String=>String}, Net::HTTPHeader]
651
+ # @param headers [Hash{String=>String}]
651
652
  # @param stream [Enumerable<String>]
652
653
  # @param suppress_error [Boolean]
653
654
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TerminalShop
4
- VERSION = "3.8.9"
4
+ VERSION = "3.9.0"
5
5
  end
@@ -33,6 +33,9 @@ module TerminalShop
33
33
  sig { returns(T.nilable(Integer)) }
34
34
  attr_accessor :status
35
35
 
36
+ sig { returns(T.nilable(T::Hash[String, String])) }
37
+ attr_accessor :headers
38
+
36
39
  sig { returns(T.nilable(T.anything)) }
37
40
  attr_accessor :body
38
41
 
@@ -41,6 +44,7 @@ module TerminalShop
41
44
  params(
42
45
  url: URI::Generic,
43
46
  status: T.nilable(Integer),
47
+ headers: T.nilable(T::Hash[String, String]),
44
48
  body: T.nilable(Object),
45
49
  request: NilClass,
46
50
  response: NilClass,
@@ -50,6 +54,7 @@ module TerminalShop
50
54
  def self.new(
51
55
  url:,
52
56
  status: nil,
57
+ headers: nil,
53
58
  body: nil,
54
59
  request: nil,
55
60
  response: nil,
@@ -59,10 +64,10 @@ module TerminalShop
59
64
  end
60
65
 
61
66
  class APIConnectionError < TerminalShop::Errors::APIError
62
- sig { void }
67
+ sig { returns(NilClass) }
63
68
  attr_accessor :status
64
69
 
65
- sig { void }
70
+ sig { returns(NilClass) }
66
71
  attr_accessor :body
67
72
 
68
73
  # @api private
@@ -70,6 +75,7 @@ module TerminalShop
70
75
  params(
71
76
  url: URI::Generic,
72
77
  status: NilClass,
78
+ headers: T.nilable(T::Hash[String, String]),
73
79
  body: NilClass,
74
80
  request: NilClass,
75
81
  response: NilClass,
@@ -79,6 +85,7 @@ module TerminalShop
79
85
  def self.new(
80
86
  url:,
81
87
  status: nil,
88
+ headers: nil,
82
89
  body: nil,
83
90
  request: nil,
84
91
  response: nil,
@@ -93,6 +100,7 @@ module TerminalShop
93
100
  params(
94
101
  url: URI::Generic,
95
102
  status: NilClass,
103
+ headers: T.nilable(T::Hash[String, String]),
96
104
  body: NilClass,
97
105
  request: NilClass,
98
106
  response: NilClass,
@@ -102,6 +110,7 @@ module TerminalShop
102
110
  def self.new(
103
111
  url:,
104
112
  status: nil,
113
+ headers: nil,
105
114
  body: nil,
106
115
  request: nil,
107
116
  response: nil,
@@ -116,13 +125,22 @@ module TerminalShop
116
125
  params(
117
126
  url: URI::Generic,
118
127
  status: Integer,
128
+ headers: T.nilable(T::Hash[String, String]),
119
129
  body: T.nilable(Object),
120
130
  request: NilClass,
121
131
  response: NilClass,
122
132
  message: T.nilable(String)
123
133
  ).returns(T.attached_class)
124
134
  end
125
- def self.for(url:, status:, body:, request:, response:, message: nil)
135
+ def self.for(
136
+ url:,
137
+ status:,
138
+ headers:,
139
+ body:,
140
+ request:,
141
+ response:,
142
+ message: nil
143
+ )
126
144
  end
127
145
 
128
146
  sig { returns(Integer) }
@@ -133,13 +151,22 @@ module TerminalShop
133
151
  params(
134
152
  url: URI::Generic,
135
153
  status: Integer,
154
+ headers: T.nilable(T::Hash[String, String]),
136
155
  body: T.nilable(Object),
137
156
  request: NilClass,
138
157
  response: NilClass,
139
158
  message: T.nilable(String)
140
159
  ).returns(T.attached_class)
141
160
  end
142
- def self.new(url:, status:, body:, request:, response:, message: nil)
161
+ def self.new(
162
+ url:,
163
+ status:,
164
+ headers:,
165
+ body:,
166
+ request:,
167
+ response:,
168
+ message: nil
169
+ )
143
170
  end
144
171
  end
145
172
 
@@ -85,10 +85,9 @@ module TerminalShop
85
85
 
86
86
  # @api private
87
87
  sig do
88
- params(
89
- status: Integer,
90
- headers: T.any(T::Hash[String, String], Net::HTTPHeader)
91
- ).returns(T::Boolean)
88
+ params(status: Integer, headers: T::Hash[String, String]).returns(
89
+ T::Boolean
90
+ )
92
91
  end
93
92
  def should_retry?(status, headers:)
94
93
  end
@@ -99,7 +98,7 @@ module TerminalShop
99
98
  request:
100
99
  TerminalShop::Internal::Transport::BaseClient::RequestInput,
101
100
  status: Integer,
102
- response_headers: T.any(T::Hash[String, String], Net::HTTPHeader)
101
+ response_headers: T::Hash[String, String]
103
102
  ).returns(
104
103
  TerminalShop::Internal::Transport::BaseClient::RequestInput
105
104
  )
@@ -31,7 +31,7 @@ module TerminalShop
31
31
  client: TerminalShop::Internal::Transport::BaseClient,
32
32
  req:
33
33
  TerminalShop::Internal::Transport::BaseClient::RequestComponents,
34
- headers: T.any(T::Hash[String, String], Net::HTTPHeader),
34
+ headers: T::Hash[String, String],
35
35
  page_data: T.anything
36
36
  ).void
37
37
  end
@@ -92,6 +92,64 @@ module TerminalShop
92
92
  def self.type_info(spec)
93
93
  end
94
94
 
95
+ # @api private
96
+ sig do
97
+ params(
98
+ type_info:
99
+ T.any(
100
+ {
101
+ const:
102
+ T.nilable(
103
+ T.any(NilClass, T::Boolean, Integer, Float, Symbol)
104
+ ),
105
+ enum:
106
+ T.nilable(
107
+ T.proc.returns(
108
+ TerminalShop::Internal::Type::Converter::Input
109
+ )
110
+ ),
111
+ union:
112
+ T.nilable(
113
+ T.proc.returns(
114
+ TerminalShop::Internal::Type::Converter::Input
115
+ )
116
+ )
117
+ },
118
+ T.proc.returns(
119
+ TerminalShop::Internal::Type::Converter::Input
120
+ ),
121
+ TerminalShop::Internal::Type::Converter::Input
122
+ ),
123
+ spec:
124
+ T.any(
125
+ {
126
+ const:
127
+ T.nilable(
128
+ T.any(NilClass, T::Boolean, Integer, Float, Symbol)
129
+ ),
130
+ enum:
131
+ T.nilable(
132
+ T.proc.returns(
133
+ TerminalShop::Internal::Type::Converter::Input
134
+ )
135
+ ),
136
+ union:
137
+ T.nilable(
138
+ T.proc.returns(
139
+ TerminalShop::Internal::Type::Converter::Input
140
+ )
141
+ )
142
+ },
143
+ T.proc.returns(
144
+ TerminalShop::Internal::Type::Converter::Input
145
+ ),
146
+ TerminalShop::Internal::Type::Converter::Input
147
+ )
148
+ ).returns(TerminalShop::Internal::AnyHash)
149
+ end
150
+ def self.meta_info(type_info, spec)
151
+ end
152
+
95
153
  # @api private
96
154
  sig do
97
155
  params(translate_names: T::Boolean).returns(
@@ -16,7 +16,8 @@ module TerminalShop
16
16
  T::Array[
17
17
  [
18
18
  T.nilable(Symbol),
19
- T.proc.returns(TerminalShop::Internal::Type::Converter::Input)
19
+ T.proc.returns(TerminalShop::Internal::Type::Converter::Input),
20
+ TerminalShop::Internal::AnyHash
20
21
  ]
21
22
  ]
22
23
  )
@@ -25,7 +26,13 @@ module TerminalShop
25
26
  end
26
27
 
27
28
  # @api private
28
- sig { returns(T::Array[[T.nilable(Symbol), T.anything]]) }
29
+ sig do
30
+ returns(
31
+ T::Array[
32
+ [T.nilable(Symbol), T.anything, TerminalShop::Internal::AnyHash]
33
+ ]
34
+ )
35
+ end
29
36
  protected def derefed_variants
30
37
  end
31
38
 
@@ -361,7 +361,7 @@ module TerminalShop
361
361
  # Assumes each chunk in stream has `Encoding::BINARY`.
362
362
  sig do
363
363
  params(
364
- headers: T.any(T::Hash[String, String], Net::HTTPHeader),
364
+ headers: T::Hash[String, String],
365
365
  stream: T::Enumerable[String],
366
366
  suppress_error: T::Boolean
367
367
  ).returns(T.anything)
@@ -21,11 +21,14 @@ module TerminalShop
21
21
 
22
22
  attr_accessor status: Integer?
23
23
 
24
+ attr_accessor headers: ::Hash[String, String]?
25
+
24
26
  attr_accessor body: top?
25
27
 
26
28
  def initialize: (
27
29
  url: URI::Generic,
28
30
  ?status: Integer?,
31
+ ?headers: ::Hash[String, String]?,
29
32
  ?body: Object?,
30
33
  ?request: nil,
31
34
  ?response: nil,
@@ -37,6 +40,7 @@ module TerminalShop
37
40
  def initialize: (
38
41
  url: URI::Generic,
39
42
  ?status: nil,
43
+ ?headers: ::Hash[String, String]?,
40
44
  ?body: nil,
41
45
  ?request: nil,
42
46
  ?response: nil,
@@ -48,6 +52,7 @@ module TerminalShop
48
52
  def initialize: (
49
53
  url: URI::Generic,
50
54
  ?status: nil,
55
+ ?headers: ::Hash[String, String]?,
51
56
  ?body: nil,
52
57
  ?request: nil,
53
58
  ?response: nil,
@@ -59,6 +64,7 @@ module TerminalShop
59
64
  def self.for: (
60
65
  url: URI::Generic,
61
66
  status: Integer,
67
+ headers: ::Hash[String, String]?,
62
68
  body: Object?,
63
69
  request: nil,
64
70
  response: nil,
@@ -68,6 +74,7 @@ module TerminalShop
68
74
  def initialize: (
69
75
  url: URI::Generic,
70
76
  status: Integer,
77
+ headers: ::Hash[String, String]?,
71
78
  body: Object?,
72
79
  request: nil,
73
80
  response: nil,
@@ -39,6 +39,23 @@ module TerminalShop
39
39
  | TerminalShop::Internal::Type::Converter::input spec
40
40
  ) -> (^-> top)
41
41
 
42
+ def self.meta_info: (
43
+ {
44
+ const: (nil | bool | Integer | Float | Symbol)?,
45
+ enum: ^-> TerminalShop::Internal::Type::Converter::input?,
46
+ union: ^-> TerminalShop::Internal::Type::Converter::input?
47
+ }
48
+ | ^-> TerminalShop::Internal::Type::Converter::input
49
+ | TerminalShop::Internal::Type::Converter::input type_info,
50
+ {
51
+ const: (nil | bool | Integer | Float | Symbol)?,
52
+ enum: ^-> TerminalShop::Internal::Type::Converter::input?,
53
+ union: ^-> TerminalShop::Internal::Type::Converter::input?
54
+ }
55
+ | ^-> TerminalShop::Internal::Type::Converter::input
56
+ | TerminalShop::Internal::Type::Converter::input spec
57
+ ) -> ::Hash[Symbol, top]
58
+
42
59
  def self.new_coerce_state: (
43
60
  ?translate_names: bool
44
61
  ) -> TerminalShop::Internal::Type::Converter::coerce_state
@@ -5,9 +5,9 @@ module TerminalShop
5
5
  include TerminalShop::Internal::Type::Converter
6
6
  include TerminalShop::Internal::Util::SorbetRuntimeSupport
7
7
 
8
- private def self.known_variants: -> ::Array[[Symbol?, (^-> TerminalShop::Internal::Type::Converter::input)]]
8
+ private def self.known_variants: -> ::Array[[Symbol?, (^-> TerminalShop::Internal::Type::Converter::input), ::Hash[Symbol, top]]]
9
9
 
10
- def self.derefed_variants: -> ::Array[[Symbol?, top]]
10
+ def self.derefed_variants: -> ::Array[[Symbol?, top, ::Hash[Symbol, top]]]
11
11
 
12
12
  def self.variants: -> ::Array[top]
13
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-shop
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.9
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terminal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-05 00:00:00.000000000 Z
11
+ date: 2025-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool