terminal-shop 0.1.0.pre.alpha.10 → 0.1.0.pre.alpha.11

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.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/terminal-shop/base_client.rb +143 -124
  4. data/lib/terminal-shop/base_model.rb +2 -2
  5. data/lib/terminal-shop/base_page.rb +2 -6
  6. data/lib/terminal-shop/models/address.rb +0 -11
  7. data/lib/terminal-shop/models/address_create_response.rb +0 -6
  8. data/lib/terminal-shop/models/address_delete_response.rb +0 -6
  9. data/lib/terminal-shop/models/address_list_response.rb +0 -6
  10. data/lib/terminal-shop/models/app.rb +8 -9
  11. data/lib/terminal-shop/models/app_create_response.rb +0 -13
  12. data/lib/terminal-shop/models/app_delete_response.rb +0 -6
  13. data/lib/terminal-shop/models/app_get_response.rb +0 -6
  14. data/lib/terminal-shop/models/app_list_response.rb +0 -6
  15. data/lib/terminal-shop/models/card.rb +0 -16
  16. data/lib/terminal-shop/models/card_collect_response.rb +0 -12
  17. data/lib/terminal-shop/models/card_create_response.rb +0 -6
  18. data/lib/terminal-shop/models/card_delete_response.rb +0 -6
  19. data/lib/terminal-shop/models/card_list_response.rb +0 -6
  20. data/lib/terminal-shop/models/cart.rb +0 -33
  21. data/lib/terminal-shop/models/cart_convert_response.rb +0 -6
  22. data/lib/terminal-shop/models/cart_get_response.rb +0 -6
  23. data/lib/terminal-shop/models/cart_set_address_response.rb +0 -6
  24. data/lib/terminal-shop/models/cart_set_card_response.rb +0 -6
  25. data/lib/terminal-shop/models/cart_set_item_response.rb +0 -6
  26. data/lib/terminal-shop/models/email_create_response.rb +0 -6
  27. data/lib/terminal-shop/models/order.rb +0 -46
  28. data/lib/terminal-shop/models/order_get_response.rb +0 -6
  29. data/lib/terminal-shop/models/order_list_response.rb +0 -6
  30. data/lib/terminal-shop/models/product.rb +0 -11
  31. data/lib/terminal-shop/models/product_list_response.rb +0 -6
  32. data/lib/terminal-shop/models/product_variant.rb +0 -8
  33. data/lib/terminal-shop/models/profile.rb +0 -16
  34. data/lib/terminal-shop/models/profile_me_response.rb +0 -6
  35. data/lib/terminal-shop/models/profile_update_response.rb +0 -6
  36. data/lib/terminal-shop/models/subscription.rb +0 -24
  37. data/lib/terminal-shop/models/subscription_create_response.rb +0 -6
  38. data/lib/terminal-shop/models/subscription_delete_response.rb +0 -6
  39. data/lib/terminal-shop/models/subscription_list_response.rb +0 -6
  40. data/lib/terminal-shop/models/token.rb +0 -14
  41. data/lib/terminal-shop/models/token_create_response.rb +0 -13
  42. data/lib/terminal-shop/models/token_delete_response.rb +0 -6
  43. data/lib/terminal-shop/models/token_get_response.rb +0 -6
  44. data/lib/terminal-shop/models/token_list_response.rb +0 -6
  45. data/lib/terminal-shop/models/view_init_response.rb +0 -17
  46. data/lib/terminal-shop/pooled_net_requester.rb +116 -78
  47. data/lib/terminal-shop/resources/app.rb +2 -0
  48. data/lib/terminal-shop/util.rb +22 -7
  49. data/lib/terminal-shop/version.rb +1 -1
  50. data/lib/terminal-shop.rb +55 -55
  51. data/rbi/lib/terminal-shop/base_client.rbi +40 -27
  52. data/rbi/lib/terminal-shop/base_model.rbi +63 -99
  53. data/rbi/lib/terminal-shop/base_page.rbi +4 -3
  54. data/rbi/lib/terminal-shop/client.rbi +2 -1
  55. data/rbi/lib/terminal-shop/errors.rbi +10 -5
  56. data/rbi/lib/terminal-shop/models/address.rbi +16 -14
  57. data/rbi/lib/terminal-shop/models/address_create_params.rbi +16 -14
  58. data/rbi/lib/terminal-shop/models/address_list_response.rbi +1 -3
  59. data/rbi/lib/terminal-shop/models/app.rbi +11 -3
  60. data/rbi/lib/terminal-shop/models/app_create_response.rbi +2 -1
  61. data/rbi/lib/terminal-shop/models/app_list_response.rbi +1 -3
  62. data/rbi/lib/terminal-shop/models/card.rbi +5 -17
  63. data/rbi/lib/terminal-shop/models/card_collect_response.rbi +2 -1
  64. data/rbi/lib/terminal-shop/models/card_create_params.rbi +6 -2
  65. data/rbi/lib/terminal-shop/models/card_list_response.rbi +1 -3
  66. data/rbi/lib/terminal-shop/models/cart.rbi +16 -15
  67. data/rbi/lib/terminal-shop/models/cart_set_address_params.rbi +2 -1
  68. data/rbi/lib/terminal-shop/models/cart_set_card_params.rbi +6 -2
  69. data/rbi/lib/terminal-shop/models/cart_set_item_params.rbi +8 -8
  70. data/rbi/lib/terminal-shop/models/email_create_params.rbi +6 -2
  71. data/rbi/lib/terminal-shop/models/order.rbi +43 -44
  72. data/rbi/lib/terminal-shop/models/order_list_response.rbi +1 -3
  73. data/rbi/lib/terminal-shop/models/product.rbi +17 -14
  74. data/rbi/lib/terminal-shop/models/product_list_response.rbi +1 -3
  75. data/rbi/lib/terminal-shop/models/profile.rbi +13 -13
  76. data/rbi/lib/terminal-shop/models/profile_update_params.rbi +6 -8
  77. data/rbi/lib/terminal-shop/models/subscription.rbi +29 -26
  78. data/rbi/lib/terminal-shop/models/subscription_list_response.rbi +2 -1
  79. data/rbi/lib/terminal-shop/models/token_create_response.rbi +2 -1
  80. data/rbi/lib/terminal-shop/models/token_list_response.rbi +1 -3
  81. data/rbi/lib/terminal-shop/models/view_init_response.rbi +26 -34
  82. data/rbi/lib/terminal-shop/pooled_net_requester.rbi +59 -0
  83. data/rbi/lib/terminal-shop/request_options.rbi +6 -24
  84. data/rbi/lib/terminal-shop/resources/address.rbi +6 -11
  85. data/rbi/lib/terminal-shop/resources/app.rbi +10 -13
  86. data/rbi/lib/terminal-shop/resources/card.rbi +8 -20
  87. data/rbi/lib/terminal-shop/resources/cart.rbi +10 -21
  88. data/rbi/lib/terminal-shop/resources/email.rbi +2 -1
  89. data/rbi/lib/terminal-shop/resources/order.rbi +4 -10
  90. data/rbi/lib/terminal-shop/resources/product.rbi +2 -9
  91. data/rbi/lib/terminal-shop/resources/profile.rbi +4 -10
  92. data/rbi/lib/terminal-shop/resources/subscription.rbi +6 -11
  93. data/rbi/lib/terminal-shop/resources/token.rbi +8 -20
  94. data/rbi/lib/terminal-shop/resources/view.rbi +2 -9
  95. data/rbi/lib/terminal-shop/util.rbi +25 -23
  96. data/rbi/lib/terminal-shop/version.rbi +1 -1
  97. data/sig/terminal-shop/base_client.rbs +27 -27
  98. data/sig/terminal-shop/base_model.rbs +0 -2
  99. data/sig/terminal-shop/base_page.rbs +1 -1
  100. data/sig/terminal-shop/models/app.rbs +5 -2
  101. data/sig/terminal-shop/pooled_net_requester.rbs +42 -0
  102. data/sig/terminal-shop/resources/app.rbs +1 -0
  103. data/sig/terminal-shop/util.rbs +7 -1
  104. data/sig/terminal-shop/version.rbs +1 -1
  105. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e49f5a72c701e7a5a68d1b537d9910a95d385966dcab6788a080c0d7cfefc503
4
- data.tar.gz: c94a21a6fc772735aedd857c5f592b5ab0eb7344419814d593f7bec71b96b5e5
3
+ metadata.gz: 0d58dd761db47d982b5155d7be8408a23954f54addd5ccc35c52558b0f4cf115
4
+ data.tar.gz: 6038f407195ab9dbc4eb9204e1db159d0ac76fa57ea6820d509b67cb7e0ee62c
5
5
  SHA512:
6
- metadata.gz: 4b5237266009ebbfb3019971b882c5c92076931ee011fbad8023c8ac806a89bd58eeb1373aa38ee60374d8af66913bacd8f00afd5f809bec5e682cabdb70dced
7
- data.tar.gz: 882c016a8b85b9ce829fb952eb63cccf295595f64c500863a8550243946e5164b0308af9699f618cfd768a812831d4d2953af97a1ef12c7e3dc3bc9ab0f5c8b8
6
+ metadata.gz: dc784c472eaf5de540bc4d9f627ce9d10f6e655f6ce53283c2b88a6ffb2564ea62ac14dede92bfdc5dabaaa7a011634b5d6a6f7bf57912a1ff31f92cd9d45c75
7
+ data.tar.gz: 2bd9880f38253a082afc54d9cba099b7248dfa008c4324d6e6f5c78ee7e5c783e8b4066bbed021b9095bf860f97646ad44a204d910120d13b00b91799e1d1fa8
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Terminal Ruby API library
2
2
 
3
- The Terminal Ruby library provides convenient access to the Terminal REST API from any Ruby 3.0+
3
+ The Terminal Ruby library provides convenient access to the Terminal REST API from any Ruby 3.0.0+
4
4
  application.
5
5
 
6
6
  It is generated with [Stainless](https://www.stainlessapi.com/).
@@ -9,23 +9,117 @@ module TerminalShop
9
9
  # from whatwg fetch spec
10
10
  MAX_REDIRECTS = 20
11
11
 
12
- # @private
13
- #
14
- # @param req [Hash{Symbol=>Object}]
15
- #
16
- # @raise [ArgumentError]
17
- #
18
- def self.validate!(req)
19
- keys = [:method, :path, :query, :headers, :body, :unwrap, :page, :model, :options]
20
- case req
21
- in Hash
22
- req.each_key do |k|
23
- unless keys.include?(k)
24
- raise ArgumentError.new("Request `req` keys must be one of #{keys}, got #{k.inspect}")
12
+ class << self
13
+ # @private
14
+ #
15
+ # @param req [Hash{Symbol=>Object}]
16
+ #
17
+ # @raise [ArgumentError]
18
+ #
19
+ def validate!(req)
20
+ keys = [:method, :path, :query, :headers, :body, :unwrap, :page, :model, :options]
21
+ case req
22
+ in Hash
23
+ req.each_key do |k|
24
+ unless keys.include?(k)
25
+ raise ArgumentError.new("Request `req` keys must be one of #{keys}, got #{k.inspect}")
26
+ end
25
27
  end
28
+ else
29
+ raise ArgumentError.new("Request `req` must be a Hash or RequestOptions, got #{req.inspect}")
30
+ end
31
+ end
32
+
33
+ # @private
34
+ #
35
+ # @param status [Integer]
36
+ # @param headers [Hash{String=>String}, Net::HTTPHeader]
37
+ #
38
+ # @return [Boolean]
39
+ #
40
+ def should_retry?(status, headers:)
41
+ coerced = TerminalShop::Util.coerce_boolean(headers["x-should-retry"])
42
+ case [coerced, status]
43
+ in [true | false, _]
44
+ coerced
45
+ in [_, 408 | 409 | 429 | (500..)]
46
+ # retry on:
47
+ # 408: timeouts
48
+ # 409: locks
49
+ # 429: rate limits
50
+ # 500+: unknown errors
51
+ true
52
+ else
53
+ false
54
+ end
55
+ end
56
+
57
+ # @private
58
+ #
59
+ # @param request [Hash{Symbol=>Object}] .
60
+ #
61
+ # @option request [Symbol] :method
62
+ #
63
+ # @option request [URI::Generic] :url
64
+ #
65
+ # @option request [Hash{String=>String}] :headers
66
+ #
67
+ # @option request [Object] :body
68
+ #
69
+ # @option request [Boolean] :streaming
70
+ #
71
+ # @option request [Integer] :max_retries
72
+ #
73
+ # @option request [Float] :timeout
74
+ #
75
+ # @param status [Integer]
76
+ #
77
+ # @param response_headers [Hash{String=>String}, Net::HTTPHeader]
78
+ #
79
+ # @return [Hash{Symbol=>Object}]
80
+ #
81
+ def follow_redirect(request, status:, response_headers:)
82
+ method, url, headers = request.fetch_values(:method, :url, :headers)
83
+ location =
84
+ TerminalShop::Util.suppress(ArgumentError) do
85
+ URI.join(url, response_headers["location"])
86
+ end
87
+
88
+ unless location
89
+ message = "Server responded with status #{status} but no valid location header."
90
+ raise TerminalShop::APIConnectionError.new(url: url, message: message)
91
+ end
92
+
93
+ request = {**request, url: location}
94
+
95
+ case [url.scheme, location.scheme]
96
+ in ["https", "http"]
97
+ message = "Tried to redirect to a insecure URL"
98
+ raise TerminalShop::APIConnectionError.new(url: url, message: message)
99
+ else
100
+ nil
101
+ end
102
+
103
+ # from whatwg fetch spec
104
+ case [status, method]
105
+ in [301 | 302, :post] | [303, _]
106
+ drop = %w[content-encoding content-language content-length content-location content-type]
107
+ request = {
108
+ **request,
109
+ method: method == :head ? :head : :get,
110
+ headers: headers.except(*drop),
111
+ body: nil
112
+ }
113
+ else
26
114
  end
27
- else
28
- raise ArgumentError.new("Request `req` must be a Hash or RequestOptions, got #{req.inspect}")
115
+
116
+ # from undici
117
+ if TerminalShop::Util.uri_origin(url) != TerminalShop::Util.uri_origin(location)
118
+ drop = %w[authorization cookie host proxy-authorization]
119
+ request = {**request, headers: request.fetch(:headers).except(*drop)}
120
+ end
121
+
122
+ request
29
123
  end
30
124
  end
31
125
 
@@ -163,34 +257,16 @@ module TerminalShop
163
257
  TerminalShop::Util.deep_merge(*[req[:body], opts[:extra_body]].compact)
164
258
  end
165
259
 
166
- url = TerminalShop::Util.join_parsed_uri(@base_url, {**req, path: path, query: query})
167
260
  headers, encoded = TerminalShop::Util.encode_content(headers, body)
168
- max_retries = opts.fetch(:max_retries, @max_retries)
169
- {method: method, url: url, headers: headers, body: encoded, max_retries: max_retries, timeout: timeout}
170
- end
171
-
172
- # @private
173
- #
174
- # @param status [Integer]
175
- # @param headers [Hash{String=>String}]
176
- #
177
- # @return [Boolean]
178
- #
179
- private def should_retry?(status, headers:)
180
- coerced = TerminalShop::Util.coerce_boolean(headers["x-should-retry"])
181
- case [coerced, status]
182
- in [true | false, _]
183
- coerced
184
- in [_, 408 | 409 | 429 | (500..)]
185
- # retry on:
186
- # 408: timeouts
187
- # 409: locks
188
- # 429: rate limits
189
- # 500+: unknown errors
190
- true
191
- else
192
- false
193
- end
261
+ {
262
+ method: method,
263
+ url: TerminalShop::Util.join_parsed_uri(@base_url, {**req, path: path, query: query}),
264
+ headers: headers,
265
+ body: encoded,
266
+ streaming: false,
267
+ max_retries: opts.fetch(:max_retries, @max_retries),
268
+ timeout: timeout
269
+ }
194
270
  end
195
271
 
196
272
  # @private
@@ -230,71 +306,7 @@ module TerminalShop
230
306
  #
231
307
  # @option request [Object] :body
232
308
  #
233
- # @option request [Integer] :max_retries
234
- #
235
- # @option request [Float] :timeout
236
- #
237
- # @param status [Integer]
238
- #
239
- # @param location_header [String]
240
- #
241
- # @return [Hash{Symbol=>Object}]
242
- #
243
- private def follow_redirect(request, status:, location_header:)
244
- method, url, headers = request.fetch_values(:method, :url, :headers)
245
- location =
246
- TerminalShop::Util.suppress(ArgumentError) do
247
- URI.join(url, location_header)
248
- end
249
-
250
- unless location
251
- message = "Server responded with status #{status} but no valid location header."
252
- raise TerminalShop::APIConnectionError.new(url: url, message: message)
253
- end
254
-
255
- request = {**request, url: location}
256
-
257
- case [url.scheme, location.scheme]
258
- in ["https", "http"]
259
- message = "Tried to redirect to a insecure URL"
260
- raise TerminalShop::APIConnectionError.new(url: url, message: message)
261
- else
262
- nil
263
- end
264
-
265
- # from whatwg fetch spec
266
- case [status, method]
267
- in [301 | 302, :post] | [303, _]
268
- drop = %w[content-encoding content-language content-length content-location content-type]
269
- request = {
270
- **request,
271
- method: method == :head ? :head : :get,
272
- headers: headers.except(*drop),
273
- body: nil
274
- }
275
- else
276
- end
277
-
278
- # from undici
279
- if TerminalShop::Util.uri_origin(url) != TerminalShop::Util.uri_origin(location)
280
- drop = %w[authorization cookie host proxy-authorization]
281
- request = {**request, headers: request.fetch(:headers).except(*drop)}
282
- end
283
-
284
- request
285
- end
286
-
287
- # @private
288
- #
289
- # @param request [Hash{Symbol=>Object}] .
290
- #
291
- # @option request [Symbol] :method
292
- #
293
- # @option request [URI::Generic] :url
294
- #
295
- # @option request [Hash{String=>String}] :headers
296
- #
297
- # @option request [Object] :body
309
+ # @option request [Boolean] :streaming
298
310
  #
299
311
  # @option request [Integer] :max_retries
300
312
  #
@@ -307,18 +319,18 @@ module TerminalShop
307
319
  # @param send_retry_header [Boolean]
308
320
  #
309
321
  # @raise [TerminalShop::APIError]
310
- # @return [Net::HTTPResponse]
322
+ # @return [Array(Net::HTTPResponse, Enumerable)]
311
323
  #
312
324
  private def send_request(request, redirect_count:, retry_count:, send_retry_header:)
313
- url, headers, body, max_retries = request.fetch_values(:url, :headers, :body, :max_retries)
314
- no_retry = retry_count >= max_retries || body.is_a?(IO) || body.is_a?(StringIO)
325
+ url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
326
+ input = {**request.except(:timeout), deadline: TerminalShop::Util.monotonic_secs + timeout}
315
327
 
316
328
  if send_retry_header
317
329
  headers["x-stainless-retry-count"] = retry_count.to_s
318
330
  end
319
331
 
320
332
  begin
321
- response = @requester.execute(request)
333
+ response, stream = @requester.execute(input)
322
334
  status = Integer(response.code)
323
335
  rescue TerminalShop::APIConnectionError => e
324
336
  status = e
@@ -326,12 +338,12 @@ module TerminalShop
326
338
 
327
339
  case status
328
340
  in ..299
329
- response
341
+ [response, stream]
330
342
  in 300..399 if redirect_count >= MAX_REDIRECTS
331
343
  message = "Failed to complete the request within #{MAX_REDIRECTS} redirects."
332
344
  raise TerminalShop::APIConnectionError.new(url: url, message: message)
333
345
  in 300..399
334
- request = follow_redirect(request, status: status, location_header: response["location"])
346
+ request = self.class.follow_redirect(request, status: status, response_headers: response)
335
347
  send_request(
336
348
  request,
337
349
  redirect_count: redirect_count + 1,
@@ -340,13 +352,16 @@ module TerminalShop
340
352
  )
341
353
  in TerminalShop::APIConnectionError if retry_count >= max_retries
342
354
  raise status
343
- in (400..) if no_retry || (response && !should_retry?(status, headers: response))
344
- body = TerminalShop::Util.decode_content(response, suppress_error: true)
355
+ in (400..) if retry_count >= max_retries || (response && !self.class.should_retry?(
356
+ status,
357
+ headers: response
358
+ ))
359
+ decoded = TerminalShop::Util.decode_content(response, stream: stream, suppress_error: true)
345
360
 
346
361
  raise TerminalShop::APIStatusError.for(
347
362
  url: url,
348
363
  status: status,
349
- body: body,
364
+ body: decoded,
350
365
  request: nil,
351
366
  response: response
352
367
  )
@@ -361,6 +376,8 @@ module TerminalShop
361
376
  send_retry_header: send_retry_header
362
377
  )
363
378
  end
379
+ ensure
380
+ stream&.each { break } unless status.is_a?(Integer) && status < 300
364
381
  end
365
382
 
366
383
  # @private
@@ -385,17 +402,19 @@ module TerminalShop
385
402
  #
386
403
  # @option req [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :options
387
404
  #
388
- # @param response [nil]
405
+ # @param headers [Hash{String=>String}, Net::HTTPHeader]
406
+ #
407
+ # @param stream [Enumerable]
389
408
  #
390
409
  # @return [Object]
391
410
  #
392
- private def parse_response(req, response)
393
- parsed = TerminalShop::Util.decode_content(response)
394
- unwrapped = TerminalShop::Util.dig(parsed, req[:unwrap])
411
+ private def parse_response(req, headers:, stream:)
412
+ decoded = TerminalShop::Util.decode_content(headers, stream: stream)
413
+ unwrapped = TerminalShop::Util.dig(decoded, req[:unwrap])
395
414
 
396
415
  case [req[:page], req.fetch(:model, TerminalShop::Unknown)]
397
416
  in [Class => page, _]
398
- page.new(client: self, req: req, headers: response, unwrapped: unwrapped)
417
+ page.new(client: self, req: req, headers: headers, unwrapped: unwrapped)
399
418
  in [nil, Class | TerminalShop::Converter => model]
400
419
  TerminalShop::Converter.coerce(model, unwrapped)
401
420
  in [nil, nil]
@@ -433,17 +452,17 @@ module TerminalShop
433
452
  self.class.validate!(req)
434
453
  opts = req[:options].to_h
435
454
  TerminalShop::RequestOptions.validate!(opts)
436
- request = build_request(req, opts)
455
+ request = build_request(req.except(:options), opts)
437
456
 
438
457
  # Don't send the current retry count in the headers if the caller modified the header defaults.
439
458
  send_retry_header = request.fetch(:headers)["x-stainless-retry-count"] == "0"
440
- response = send_request(
459
+ response, stream = send_request(
441
460
  request,
442
461
  redirect_count: 0,
443
462
  retry_count: 0,
444
463
  send_retry_header: send_retry_header
445
464
  )
446
- parse_response(req, response)
465
+ parse_response(req, headers: response, stream: stream)
447
466
  end
448
467
 
449
468
  # @return [String]
@@ -148,6 +148,8 @@ module TerminalShop
148
148
  [true, Integer(value), 1]
149
149
  in [-> { _1 <= Float }, Numeric]
150
150
  [true, Float(value), 1]
151
+ in [-> { _1 <= Symbol }, String]
152
+ [true, value.to_sym, 1]
151
153
  in [-> { _1 <= String }, Symbol]
152
154
  [true, value.to_s, 1]
153
155
  in [-> { _1 <= Date || _1 <= Time }, String]
@@ -367,7 +369,6 @@ module TerminalShop
367
369
  # @abstract
368
370
  #
369
371
  class Union
370
- extend TerminalShop::Extern
371
372
  extend TerminalShop::Converter
372
373
 
373
374
  # @private
@@ -840,7 +841,6 @@ module TerminalShop
840
841
  # @abstract
841
842
  #
842
843
  class BaseModel
843
- extend TerminalShop::Extern
844
844
  extend TerminalShop::Converter
845
845
 
846
846
  # @private
@@ -6,8 +6,6 @@ module TerminalShop
6
6
  # @abstract
7
7
  #
8
8
  module BasePage
9
- # rubocop:disable Lint/UnusedMethodArgument
10
-
11
9
  # @return [Boolean]
12
10
  #
13
11
  def next_page? = (raise NotImplementedError)
@@ -21,7 +19,7 @@ module TerminalShop
21
19
  #
22
20
  # @return [void]
23
21
  #
24
- def auto_paging_each(&blk) = (raise NotImplementedError)
22
+ def auto_paging_each(&) = (raise NotImplementedError)
25
23
 
26
24
  # @return [Enumerable]
27
25
  #
@@ -34,11 +32,9 @@ module TerminalShop
34
32
  # #
35
33
  # # @param client [TerminalShop::BaseClient]
36
34
  # # @param req [Hash{Symbol=>Object}]
37
- # # @param headers [Hash{String=>String}]
35
+ # # @param headers [Hash{String=>String}, Net::HTTPHeader]
38
36
  # # @param unwrapped [Object]
39
37
  # #
40
38
  # def initialize(client:, req:, headers:, unwrapped:); end
41
-
42
- # rubocop:enable Lint/UnusedMethodArgument
43
39
  end
44
40
  end
@@ -2,17 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # address_api => {
8
- # id: String,
9
- # city: String,
10
- # country: String,
11
- # name: String,
12
- # street1: String,
13
- # **_
14
- # }
15
- # ```
16
5
  class AddressAPI < TerminalShop::BaseModel
17
6
  # @!attribute id
18
7
  # Unique object identifier. The format and length of IDs may change over time.
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # address_create_response => {
8
- # data: String
9
- # }
10
- # ```
11
5
  class AddressCreateResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  # Shipping address ID.
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # address_delete_response => {
8
- # data: :ok
9
- # }
10
- # ```
11
5
  class AddressDeleteResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  #
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # address_list_response => {
8
- # data: -> { TerminalShop::ArrayOf[TerminalShop::Models::AddressAPI] === _1 }
9
- # }
10
- # ```
11
5
  class AddressListResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  # Shipping addresses.
@@ -2,14 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # app_api => {
8
- # id: String,
9
- # name: String,
10
- # redirect_uri: String
11
- # }
12
- # ```
13
5
  class AppAPI < TerminalShop::BaseModel
14
6
  # @!attribute id
15
7
  # Unique object identifier. The format and length of IDs may change over time.
@@ -29,14 +21,21 @@ module TerminalShop
29
21
  # @return [String]
30
22
  required :redirect_uri, String, api_name: :redirectURI
31
23
 
24
+ # @!attribute secret
25
+ # OAuth 2.0 client secret of the app (obfuscated).
26
+ #
27
+ # @return [String]
28
+ required :secret, String
29
+
32
30
  # @!parse
33
31
  # # A Terminal App used for configuring an OAuth 2.0 client.
34
32
  # #
35
33
  # # @param id [String]
36
34
  # # @param name [String]
37
35
  # # @param redirect_uri [String]
36
+ # # @param secret [String]
38
37
  # #
39
- # def initialize(id:, name:, redirect_uri:, **) = super
38
+ # def initialize(id:, name:, redirect_uri:, secret:, **) = super
40
39
 
41
40
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
42
41
  end
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # app_create_response => {
8
- # data: TerminalShop::Models::AppCreateResponse::Data
9
- # }
10
- # ```
11
5
  class AppCreateResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  #
@@ -21,13 +15,6 @@ module TerminalShop
21
15
 
22
16
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
23
17
 
24
- # @example
25
- # ```ruby
26
- # data => {
27
- # id: String,
28
- # secret: String
29
- # }
30
- # ```
31
18
  class Data < TerminalShop::BaseModel
32
19
  # @!attribute id
33
20
  # OAuth 2.0 client ID.
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # app_delete_response => {
8
- # data: :ok
9
- # }
10
- # ```
11
5
  class AppDeleteResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  #
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # app_get_response => {
8
- # data: TerminalShop::Models::AppAPI
9
- # }
10
- # ```
11
5
  class AppGetResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  # A Terminal App used for configuring an OAuth 2.0 client.
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # app_list_response => {
8
- # data: -> { TerminalShop::ArrayOf[TerminalShop::Models::AppAPI] === _1 }
9
- # }
10
- # ```
11
5
  class AppListResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  # List of apps.
@@ -2,15 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # card_api => {
8
- # id: String,
9
- # brand: String,
10
- # expiration: TerminalShop::Models::CardAPI::Expiration,
11
- # last4: String
12
- # }
13
- # ```
14
5
  class CardAPI < TerminalShop::BaseModel
15
6
  # @!attribute id
16
7
  # Unique object identifier. The format and length of IDs may change over time.
@@ -48,13 +39,6 @@ module TerminalShop
48
39
 
49
40
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
50
41
 
51
- # @example
52
- # ```ruby
53
- # expiration => {
54
- # month: Integer,
55
- # year: Integer
56
- # }
57
- # ```
58
42
  class Expiration < TerminalShop::BaseModel
59
43
  # @!attribute month
60
44
  # Expiration month of the card.
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # card_collect_response => {
8
- # data: TerminalShop::Models::CardCollectResponse::Data
9
- # }
10
- # ```
11
5
  class CardCollectResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  # URL for collecting card information.
@@ -22,12 +16,6 @@ module TerminalShop
22
16
 
23
17
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
24
18
 
25
- # @example
26
- # ```ruby
27
- # data => {
28
- # url: String
29
- # }
30
- # ```
31
19
  class Data < TerminalShop::BaseModel
32
20
  # @!attribute url
33
21
  # Temporary URL that allows a user to enter credit card details over https at
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # card_create_response => {
8
- # data: String
9
- # }
10
- # ```
11
5
  class CardCreateResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  # ID of the card.
@@ -2,12 +2,6 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- # @example
6
- # ```ruby
7
- # card_delete_response => {
8
- # data: :ok
9
- # }
10
- # ```
11
5
  class CardDeleteResponse < TerminalShop::BaseModel
12
6
  # @!attribute data
13
7
  #