terminal-shop 3.5.0 → 3.6.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/CHANGELOG.md +28 -0
- data/README.md +5 -5
- data/lib/terminal_shop/errors.rb +9 -9
- data/lib/terminal_shop/internal/transport/base_client.rb +3 -3
- data/lib/terminal_shop/internal/type/base_model.rb +1 -9
- data/lib/terminal_shop/internal/type/boolean.rb +10 -11
- data/lib/terminal_shop/internal/type/enum.rb +10 -11
- data/lib/terminal_shop/internal/type/request_parameters.rb +2 -8
- data/lib/terminal_shop/internal/type/unknown.rb +10 -11
- data/lib/terminal_shop/internal/util.rb +20 -4
- data/lib/terminal_shop/models.rb +99 -0
- data/lib/terminal_shop/request_options.rb +4 -5
- data/lib/terminal_shop/version.rb +1 -1
- data/rbi/{lib/terminal_shop → terminal_shop}/errors.rbi +1 -1
- data/rbi/{lib/terminal_shop → terminal_shop}/internal/transport/base_client.rbi +2 -2
- data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/request_parameters.rbi +1 -1
- data/rbi/{lib/terminal_shop → terminal_shop}/internal/util.rbi +5 -1
- data/rbi/terminal_shop/models.rbi +99 -0
- data/rbi/{lib/terminal_shop → terminal_shop}/request_options.rbi +2 -0
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/address.rbi +4 -20
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/app.rbi +4 -24
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/card.rbi +5 -34
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/cart.rbi +6 -46
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/email.rbi +1 -4
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/order.rbi +3 -16
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/product.rbi +2 -15
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/profile.rbi +2 -16
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/subscription.rbi +5 -21
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/token.rbi +4 -30
- data/rbi/{lib/terminal_shop → terminal_shop}/resources/view.rbi +1 -11
- data/sig/terminal_shop/internal/util.rbs +2 -0
- data/sig/terminal_shop/models.rbs +97 -0
- metadata +123 -120
- /data/rbi/{lib/terminal_shop → terminal_shop}/client.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/file_part.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/transport/pooled_net_requester.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/array_of.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/base_model.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/base_page.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/boolean.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/converter.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/enum.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/file_input.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/hash_of.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/union.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal/type/unknown.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/internal.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address_create_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address_create_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address_delete_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address_delete_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address_get_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address_get_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address_list_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/address_list_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app_create_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app_create_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app_delete_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app_delete_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app_get_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app_get_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app_list_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/app_list_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_collect_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_collect_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_create_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_create_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_delete_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_delete_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_get_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_get_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_list_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/card_list_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_clear_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_clear_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_convert_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_convert_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_get_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_get_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_set_address_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_set_address_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_set_card_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_set_card_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_set_item_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/cart_set_item_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/email_create_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/email_create_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/order.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/order_create_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/order_create_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/order_get_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/order_get_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/order_list_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/order_list_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/product.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/product_get_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/product_get_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/product_list_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/product_list_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/product_variant.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/profile.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/profile_me_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/profile_me_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/profile_update_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/profile_update_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/region.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_create_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_create_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_delete_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_delete_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_get_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_get_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_list_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_list_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_update_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/subscription_update_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token_create_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token_create_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token_delete_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token_delete_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token_get_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token_get_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token_list_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/token_list_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/view_init_params.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/models/view_init_response.rbi +0 -0
- /data/rbi/{lib/terminal_shop → terminal_shop}/version.rbi +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc0479939e95aa687fda067b94d569d46523c34733d086cdf097130e456889f3
|
4
|
+
data.tar.gz: ac2c7202e2c6fa2b01a4924e6e3183949d94e998eaa063e0986244c0226482aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc4b7532f4a5ad77586e7dfa9aa7d06360f3439554e2876323bbab003f1dc87e9b710c572e7d0b44090b172a9c1b05af00aaf41be292324415087372e4a370d0
|
7
|
+
data.tar.gz: 0cfdf3b9ea2c19eacab42061b28d68807396acff5d5d14f5440b98a30862f338211d568cb07ce6392bd57a6edf2264eafa23db190dc9d5dbd88a06775d384de0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,33 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.6.0 (2025-05-06)
|
4
|
+
|
5
|
+
Full Changelog: [v3.5.0...v3.6.0](https://github.com/terminaldotshop/terminal-sdk-ruby/compare/v3.5.0...v3.6.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** manual updates ([7e38ac6](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/7e38ac6016b5c475c03a7cdddd9169aa4b8fda3f))
|
10
|
+
|
11
|
+
|
12
|
+
### Chores
|
13
|
+
|
14
|
+
* accept all nd-json mimetype variants ([eff73e0](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/eff73e0f8215f55c8455193891dbe9a5c28cc825))
|
15
|
+
* add generator safe directory ([44215e0](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/44215e0adfaf3ee818d03584bcbf9b87eee98a4c))
|
16
|
+
* **internal:** annotate request options with type aliases in sorbet ([3b7e0d0](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/3b7e0d05e1f6b0f4a5fc71c95ffde379b77b83af))
|
17
|
+
* **internal:** codegen related update ([5808227](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/580822724b6fe3dcb7061f6bbbac5d5a09d24713))
|
18
|
+
* **internal:** codegen related update ([e11bb76](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/e11bb7657fda2f3aff6c0fb7510e8844d865b051))
|
19
|
+
* **internal:** remove unnecessary `rbi/lib` folder ([b27aba4](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/b27aba431115bb8236725d3c00b144b990a810b7))
|
20
|
+
* loosen rubocop rules that don't always make sense ([c4bbb53](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/c4bbb53755be82037edcd40c413fe659628ce241))
|
21
|
+
* more accurate type annotations and aliases ([e957025](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/e957025f3031eb1044363d9ddd7a1d4ce7057d21))
|
22
|
+
* re-export top level models under library namespace ([36d326e](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/36d326ea8861bc14a1e75552dfaaa8e70bf13235))
|
23
|
+
* remove Gemfile.lock during bootstrap ([5f4d256](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/5f4d256c3429fd3c8ff15473bf73bb94f9e5aef1))
|
24
|
+
* validate request option coercion correctness ([0d21861](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/0d21861585dc0297ac3d27f3b0a84ac64a0ca0ac))
|
25
|
+
|
26
|
+
|
27
|
+
### Documentation
|
28
|
+
|
29
|
+
* illustrate environmental defaults for auth variables ([35a00a8](https://github.com/terminaldotshop/terminal-sdk-ruby/commit/35a00a8f7ec1e109009075c02ab8920ceba84393))
|
30
|
+
|
3
31
|
## 3.5.0 (2025-04-26)
|
4
32
|
|
5
33
|
Full Changelog: [v3.4.0...v3.5.0](https://github.com/terminaldotshop/terminal-sdk-ruby/compare/v3.4.0...v3.5.0)
|
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.
|
3
|
+
The Terminal Ruby library provides convenient access to the Terminal REST API from any Ruby 3.2.0+ application.
|
4
4
|
|
5
5
|
It is generated with [Stainless](https://www.stainless.com/).
|
6
6
|
|
@@ -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.
|
20
|
+
gem "terminal-shop", "~> 3.6.0"
|
21
21
|
```
|
22
22
|
|
23
23
|
<!-- x-release-please-end -->
|
@@ -29,7 +29,7 @@ require "bundler/setup"
|
|
29
29
|
require "terminal_shop"
|
30
30
|
|
31
31
|
terminal = TerminalShop::Client.new(
|
32
|
-
bearer_token: "
|
32
|
+
bearer_token: ENV["TERMINAL_BEARER_TOKEN"], # This is the default and can be omitted
|
33
33
|
environment: "dev" # defaults to "production"
|
34
34
|
)
|
35
35
|
|
@@ -60,7 +60,7 @@ rescue TerminalShop::Errors::APIError => e
|
|
60
60
|
end
|
61
61
|
```
|
62
62
|
|
63
|
-
Error codes are as
|
63
|
+
Error codes are as follows:
|
64
64
|
|
65
65
|
| Cause | Error Type |
|
66
66
|
| ---------------- | -------------------------- |
|
@@ -198,7 +198,7 @@ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` typ
|
|
198
198
|
|
199
199
|
## Requirements
|
200
200
|
|
201
|
-
Ruby 3.
|
201
|
+
Ruby 3.2.0 or higher.
|
202
202
|
|
203
203
|
## Contributing
|
204
204
|
|
data/lib/terminal_shop/errors.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Errors
|
5
5
|
class Error < StandardError
|
6
|
-
# @!
|
7
|
-
#
|
8
|
-
#
|
6
|
+
# @!attribute cause
|
7
|
+
#
|
8
|
+
# @return [StandardError, nil]
|
9
9
|
end
|
10
10
|
|
11
11
|
class ConversionError < TerminalShop::Errors::Error
|
@@ -40,13 +40,13 @@ module TerminalShop
|
|
40
40
|
end
|
41
41
|
|
42
42
|
class APIConnectionError < TerminalShop::Errors::APIError
|
43
|
-
# @!
|
44
|
-
#
|
45
|
-
#
|
43
|
+
# @!attribute status
|
44
|
+
#
|
45
|
+
# @return [nil]
|
46
46
|
|
47
|
-
# @!
|
48
|
-
#
|
49
|
-
#
|
47
|
+
# @!attribute body
|
48
|
+
#
|
49
|
+
# @return [nil]
|
50
50
|
|
51
51
|
# @api private
|
52
52
|
#
|
@@ -261,7 +261,7 @@ module TerminalShop
|
|
261
261
|
headers["x-stainless-retry-count"] = "0"
|
262
262
|
end
|
263
263
|
|
264
|
-
timeout = opts.fetch(:timeout, @timeout).to_f.clamp(
|
264
|
+
timeout = opts.fetch(:timeout, @timeout).to_f.clamp(0..)
|
265
265
|
unless headers.key?("x-stainless-timeout") || timeout.zero?
|
266
266
|
headers["x-stainless-timeout"] = timeout.to_s
|
267
267
|
end
|
@@ -461,9 +461,9 @@ module TerminalShop
|
|
461
461
|
|
462
462
|
decoded = TerminalShop::Internal::Util.decode_content(response, stream: stream)
|
463
463
|
case req
|
464
|
-
in {
|
464
|
+
in {stream: Class => st}
|
465
465
|
st.new(model: model, url: url, status: status, response: response, stream: decoded)
|
466
|
-
in {
|
466
|
+
in {page: Class => page}
|
467
467
|
page.new(client: self, req: req, headers: response, page_data: decoded)
|
468
468
|
else
|
469
469
|
unwrapped = TerminalShop::Internal::Util.dig(decoded, req[:unwrap])
|
@@ -395,15 +395,7 @@ module TerminalShop
|
|
395
395
|
# Create a new instance of a model.
|
396
396
|
#
|
397
397
|
# @param data [Hash{Symbol=>Object}, self]
|
398
|
-
def initialize(data = {})
|
399
|
-
case TerminalShop::Internal::Util.coerce_hash(data)
|
400
|
-
in Hash => coerced
|
401
|
-
@data = coerced
|
402
|
-
else
|
403
|
-
message = "Expected a #{Hash} or #{TerminalShop::Internal::Type::BaseModel}, got #{data.inspect}"
|
404
|
-
raise ArgumentError.new(message)
|
405
|
-
end
|
406
|
-
end
|
398
|
+
def initialize(data = {}) = (@data = TerminalShop::Internal::Util.coerce_hash!(data).to_h)
|
407
399
|
|
408
400
|
class << self
|
409
401
|
# @api private
|
@@ -46,17 +46,16 @@ module TerminalShop
|
|
46
46
|
value
|
47
47
|
end
|
48
48
|
|
49
|
-
# @!
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
# def dump(value, state:) = super
|
49
|
+
# @!method dump(value, state:)
|
50
|
+
# @api private
|
51
|
+
#
|
52
|
+
# @param value [Boolean, Object]
|
53
|
+
#
|
54
|
+
# @param state [Hash{Symbol=>Object}] .
|
55
|
+
#
|
56
|
+
# @option state [Boolean] :can_retry
|
57
|
+
#
|
58
|
+
# @return [Boolean, Object]
|
60
59
|
end
|
61
60
|
end
|
62
61
|
end
|
@@ -100,17 +100,16 @@ module TerminalShop
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
# @!
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
113
|
-
# def dump(value, state:) = super
|
103
|
+
# @!method dump(value, state:)
|
104
|
+
# @api private
|
105
|
+
#
|
106
|
+
# @param value [Symbol, Object]
|
107
|
+
#
|
108
|
+
# @param state [Hash{Symbol=>Object}] .
|
109
|
+
#
|
110
|
+
# @option state [Boolean] :can_retry
|
111
|
+
#
|
112
|
+
# @return [Symbol, Object]
|
114
113
|
|
115
114
|
# @api private
|
116
115
|
#
|
@@ -28,14 +28,8 @@ module TerminalShop
|
|
28
28
|
state = {can_retry: true}
|
29
29
|
case (dumped = dump(params, state: state))
|
30
30
|
in Hash
|
31
|
-
options = TerminalShop::Internal::Util.coerce_hash(dumped[:request_options])
|
32
|
-
request_options =
|
33
|
-
case [options, state.fetch(:can_retry)]
|
34
|
-
in [Hash | nil, false]
|
35
|
-
{**options.to_h, max_retries: 0}
|
36
|
-
else
|
37
|
-
options
|
38
|
-
end
|
31
|
+
options = TerminalShop::Internal::Util.coerce_hash!(dumped[:request_options]).to_h
|
32
|
+
request_options = state.fetch(:can_retry) ? options : {**options, max_retries: 0}
|
39
33
|
[dumped.except(:request_options), request_options]
|
40
34
|
else
|
41
35
|
[dumped, nil]
|
@@ -48,17 +48,16 @@ module TerminalShop
|
|
48
48
|
value
|
49
49
|
end
|
50
50
|
|
51
|
-
# @!
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
# def dump(value, state:) = super
|
51
|
+
# @!method dump(value, state:)
|
52
|
+
# @api private
|
53
|
+
#
|
54
|
+
# @param value [Object]
|
55
|
+
#
|
56
|
+
# @param state [Hash{Symbol=>Object}] .
|
57
|
+
#
|
58
|
+
# @option state [Boolean] :can_retry
|
59
|
+
#
|
60
|
+
# @return [Object]
|
62
61
|
end
|
63
62
|
|
64
63
|
# rubocop:enable Lint/UnusedMethodArgument
|
@@ -128,6 +128,22 @@ module TerminalShop
|
|
128
128
|
input.respond_to?(:to_h) ? input.to_h : input
|
129
129
|
end
|
130
130
|
end
|
131
|
+
|
132
|
+
# @api private
|
133
|
+
#
|
134
|
+
# @param input [Object]
|
135
|
+
#
|
136
|
+
# @raise [ArgumentError]
|
137
|
+
# @return [Hash{Object=>Object}, nil]
|
138
|
+
def coerce_hash!(input)
|
139
|
+
case coerce_hash(input)
|
140
|
+
in Hash | nil => coerced
|
141
|
+
coerced
|
142
|
+
else
|
143
|
+
message = "Expected a #{Hash} or #{TerminalShop::Internal::Type::BaseModel}, got #{data.inspect}"
|
144
|
+
raise ArgumentError.new(message)
|
145
|
+
end
|
146
|
+
end
|
131
147
|
end
|
132
148
|
|
133
149
|
class << self
|
@@ -454,7 +470,7 @@ module TerminalShop
|
|
454
470
|
# @type [Regexp]
|
455
471
|
JSON_CONTENT = %r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}
|
456
472
|
# @type [Regexp]
|
457
|
-
JSONL_CONTENT = %r{^application/(?:x-)?jsonl}
|
473
|
+
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
|
458
474
|
|
459
475
|
class << self
|
460
476
|
# @api private
|
@@ -493,7 +509,7 @@ module TerminalShop
|
|
493
509
|
y << val.to_s
|
494
510
|
else
|
495
511
|
y << "Content-Type: application/json\r\n\r\n"
|
496
|
-
y << JSON.
|
512
|
+
y << JSON.generate(val)
|
497
513
|
end
|
498
514
|
y << "\r\n"
|
499
515
|
end
|
@@ -570,9 +586,9 @@ module TerminalShop
|
|
570
586
|
content_type = headers["content-type"]
|
571
587
|
case [content_type, body]
|
572
588
|
in [TerminalShop::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }]
|
573
|
-
[headers, JSON.
|
589
|
+
[headers, JSON.generate(body)]
|
574
590
|
in [TerminalShop::Internal::Util::JSONL_CONTENT, Enumerable] unless body.is_a?(TerminalShop::Internal::Type::FileInput)
|
575
|
-
[headers, body.lazy.map { JSON.
|
591
|
+
[headers, body.lazy.map { JSON.generate(_1) }]
|
576
592
|
in [%r{^multipart/form-data}, Hash | TerminalShop::Internal::Type::FileInput]
|
577
593
|
boundary, strio = encode_multipart_streaming(body)
|
578
594
|
headers = {**headers, "content-type" => "#{content_type}; boundary=#{boundary}"}
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TerminalShop
|
4
|
+
AddressAPI = TerminalShop::Models::AddressAPI
|
5
|
+
|
6
|
+
AddressCreateParams = TerminalShop::Models::AddressCreateParams
|
7
|
+
|
8
|
+
AddressDeleteParams = TerminalShop::Models::AddressDeleteParams
|
9
|
+
|
10
|
+
AddressGetParams = TerminalShop::Models::AddressGetParams
|
11
|
+
|
12
|
+
AddressListParams = TerminalShop::Models::AddressListParams
|
13
|
+
|
14
|
+
AppAPI = TerminalShop::Models::AppAPI
|
15
|
+
|
16
|
+
AppCreateParams = TerminalShop::Models::AppCreateParams
|
17
|
+
|
18
|
+
AppDeleteParams = TerminalShop::Models::AppDeleteParams
|
19
|
+
|
20
|
+
AppGetParams = TerminalShop::Models::AppGetParams
|
21
|
+
|
22
|
+
AppListParams = TerminalShop::Models::AppListParams
|
23
|
+
|
24
|
+
CardAPI = TerminalShop::Models::CardAPI
|
25
|
+
|
26
|
+
CardCollectParams = TerminalShop::Models::CardCollectParams
|
27
|
+
|
28
|
+
CardCreateParams = TerminalShop::Models::CardCreateParams
|
29
|
+
|
30
|
+
CardDeleteParams = TerminalShop::Models::CardDeleteParams
|
31
|
+
|
32
|
+
CardGetParams = TerminalShop::Models::CardGetParams
|
33
|
+
|
34
|
+
CardListParams = TerminalShop::Models::CardListParams
|
35
|
+
|
36
|
+
CartAPI = TerminalShop::Models::CartAPI
|
37
|
+
|
38
|
+
CartClearParams = TerminalShop::Models::CartClearParams
|
39
|
+
|
40
|
+
CartConvertParams = TerminalShop::Models::CartConvertParams
|
41
|
+
|
42
|
+
CartGetParams = TerminalShop::Models::CartGetParams
|
43
|
+
|
44
|
+
CartSetAddressParams = TerminalShop::Models::CartSetAddressParams
|
45
|
+
|
46
|
+
CartSetCardParams = TerminalShop::Models::CartSetCardParams
|
47
|
+
|
48
|
+
CartSetItemParams = TerminalShop::Models::CartSetItemParams
|
49
|
+
|
50
|
+
EmailCreateParams = TerminalShop::Models::EmailCreateParams
|
51
|
+
|
52
|
+
OrderAPI = TerminalShop::Models::OrderAPI
|
53
|
+
|
54
|
+
OrderCreateParams = TerminalShop::Models::OrderCreateParams
|
55
|
+
|
56
|
+
OrderGetParams = TerminalShop::Models::OrderGetParams
|
57
|
+
|
58
|
+
OrderListParams = TerminalShop::Models::OrderListParams
|
59
|
+
|
60
|
+
ProductAPI = TerminalShop::Models::ProductAPI
|
61
|
+
|
62
|
+
ProductGetParams = TerminalShop::Models::ProductGetParams
|
63
|
+
|
64
|
+
ProductListParams = TerminalShop::Models::ProductListParams
|
65
|
+
|
66
|
+
ProductVariant = TerminalShop::Models::ProductVariant
|
67
|
+
|
68
|
+
ProfileAPI = TerminalShop::Models::ProfileAPI
|
69
|
+
|
70
|
+
ProfileMeParams = TerminalShop::Models::ProfileMeParams
|
71
|
+
|
72
|
+
ProfileUpdateParams = TerminalShop::Models::ProfileUpdateParams
|
73
|
+
|
74
|
+
Region = TerminalShop::Models::Region
|
75
|
+
|
76
|
+
SubscriptionAPI = TerminalShop::Models::SubscriptionAPI
|
77
|
+
|
78
|
+
SubscriptionCreateParams = TerminalShop::Models::SubscriptionCreateParams
|
79
|
+
|
80
|
+
SubscriptionDeleteParams = TerminalShop::Models::SubscriptionDeleteParams
|
81
|
+
|
82
|
+
SubscriptionGetParams = TerminalShop::Models::SubscriptionGetParams
|
83
|
+
|
84
|
+
SubscriptionListParams = TerminalShop::Models::SubscriptionListParams
|
85
|
+
|
86
|
+
SubscriptionUpdateParams = TerminalShop::Models::SubscriptionUpdateParams
|
87
|
+
|
88
|
+
TokenAPI = TerminalShop::Models::TokenAPI
|
89
|
+
|
90
|
+
TokenCreateParams = TerminalShop::Models::TokenCreateParams
|
91
|
+
|
92
|
+
TokenDeleteParams = TerminalShop::Models::TokenDeleteParams
|
93
|
+
|
94
|
+
TokenGetParams = TerminalShop::Models::TokenGetParams
|
95
|
+
|
96
|
+
TokenListParams = TerminalShop::Models::TokenListParams
|
97
|
+
|
98
|
+
ViewInitParams = TerminalShop::Models::ViewInitParams
|
99
|
+
end
|
@@ -65,10 +65,9 @@ module TerminalShop
|
|
65
65
|
# @return [Float, nil]
|
66
66
|
optional :timeout, Float
|
67
67
|
|
68
|
-
# @!
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
# # @param values [Hash{Symbol=>Object}]
|
68
|
+
# @!method initialize(values = {})
|
69
|
+
# Returns a new instance of RequestOptions.
|
70
|
+
#
|
71
|
+
# @param values [Hash{Symbol=>Object}]
|
73
72
|
end
|
74
73
|
end
|
@@ -35,7 +35,7 @@ module TerminalShop
|
|
35
35
|
page: T.nilable(T::Class[TerminalShop::Internal::Type::BasePage[TerminalShop::Internal::Type::BaseModel]]),
|
36
36
|
stream: T.nilable(T::Class[T.anything]),
|
37
37
|
model: T.nilable(TerminalShop::Internal::Type::Converter::Input),
|
38
|
-
options: T.nilable(
|
38
|
+
options: T.nilable(TerminalShop::RequestOpts)
|
39
39
|
}
|
40
40
|
end
|
41
41
|
|
@@ -188,7 +188,7 @@ module TerminalShop
|
|
188
188
|
page: T.nilable(T::Class[TerminalShop::Internal::Type::BasePage[TerminalShop::Internal::Type::BaseModel]]),
|
189
189
|
stream: T.nilable(T::Class[T.anything]),
|
190
190
|
model: T.nilable(TerminalShop::Internal::Type::Converter::Input),
|
191
|
-
options: T.nilable(
|
191
|
+
options: T.nilable(TerminalShop::RequestOpts)
|
192
192
|
)
|
193
193
|
.returns(T.anything)
|
194
194
|
end
|
@@ -6,7 +6,7 @@ module TerminalShop
|
|
6
6
|
# @api private
|
7
7
|
module RequestParameters
|
8
8
|
# Options to specify HTTP behaviour for this request.
|
9
|
-
sig { returns(
|
9
|
+
sig { returns(TerminalShop::RequestOpts) }
|
10
10
|
attr_accessor :request_options
|
11
11
|
|
12
12
|
# @api private
|
@@ -42,6 +42,10 @@ module TerminalShop
|
|
42
42
|
# @api private
|
43
43
|
sig { params(input: T.anything).returns(T.any(T::Hash[T.anything, T.anything], T.anything)) }
|
44
44
|
def coerce_hash(input); end
|
45
|
+
|
46
|
+
# @api private
|
47
|
+
sig { params(input: T.anything).returns(T.nilable(T::Hash[T.anything, T.anything])) }
|
48
|
+
def coerce_hash!(input); end
|
45
49
|
end
|
46
50
|
|
47
51
|
class << self
|
@@ -186,7 +190,7 @@ module TerminalShop
|
|
186
190
|
end
|
187
191
|
|
188
192
|
JSON_CONTENT = T.let(%r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}, Regexp)
|
189
|
-
JSONL_CONTENT = T.let(%r{^application/(?:x-)?jsonl}, Regexp)
|
193
|
+
JSONL_CONTENT = T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)
|
190
194
|
|
191
195
|
class << self
|
192
196
|
# @api private
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module TerminalShop
|
4
|
+
AddressAPI = TerminalShop::Models::AddressAPI
|
5
|
+
|
6
|
+
AddressCreateParams = TerminalShop::Models::AddressCreateParams
|
7
|
+
|
8
|
+
AddressDeleteParams = TerminalShop::Models::AddressDeleteParams
|
9
|
+
|
10
|
+
AddressGetParams = TerminalShop::Models::AddressGetParams
|
11
|
+
|
12
|
+
AddressListParams = TerminalShop::Models::AddressListParams
|
13
|
+
|
14
|
+
AppAPI = TerminalShop::Models::AppAPI
|
15
|
+
|
16
|
+
AppCreateParams = TerminalShop::Models::AppCreateParams
|
17
|
+
|
18
|
+
AppDeleteParams = TerminalShop::Models::AppDeleteParams
|
19
|
+
|
20
|
+
AppGetParams = TerminalShop::Models::AppGetParams
|
21
|
+
|
22
|
+
AppListParams = TerminalShop::Models::AppListParams
|
23
|
+
|
24
|
+
CardAPI = TerminalShop::Models::CardAPI
|
25
|
+
|
26
|
+
CardCollectParams = TerminalShop::Models::CardCollectParams
|
27
|
+
|
28
|
+
CardCreateParams = TerminalShop::Models::CardCreateParams
|
29
|
+
|
30
|
+
CardDeleteParams = TerminalShop::Models::CardDeleteParams
|
31
|
+
|
32
|
+
CardGetParams = TerminalShop::Models::CardGetParams
|
33
|
+
|
34
|
+
CardListParams = TerminalShop::Models::CardListParams
|
35
|
+
|
36
|
+
CartAPI = TerminalShop::Models::CartAPI
|
37
|
+
|
38
|
+
CartClearParams = TerminalShop::Models::CartClearParams
|
39
|
+
|
40
|
+
CartConvertParams = TerminalShop::Models::CartConvertParams
|
41
|
+
|
42
|
+
CartGetParams = TerminalShop::Models::CartGetParams
|
43
|
+
|
44
|
+
CartSetAddressParams = TerminalShop::Models::CartSetAddressParams
|
45
|
+
|
46
|
+
CartSetCardParams = TerminalShop::Models::CartSetCardParams
|
47
|
+
|
48
|
+
CartSetItemParams = TerminalShop::Models::CartSetItemParams
|
49
|
+
|
50
|
+
EmailCreateParams = TerminalShop::Models::EmailCreateParams
|
51
|
+
|
52
|
+
OrderAPI = TerminalShop::Models::OrderAPI
|
53
|
+
|
54
|
+
OrderCreateParams = TerminalShop::Models::OrderCreateParams
|
55
|
+
|
56
|
+
OrderGetParams = TerminalShop::Models::OrderGetParams
|
57
|
+
|
58
|
+
OrderListParams = TerminalShop::Models::OrderListParams
|
59
|
+
|
60
|
+
ProductAPI = TerminalShop::Models::ProductAPI
|
61
|
+
|
62
|
+
ProductGetParams = TerminalShop::Models::ProductGetParams
|
63
|
+
|
64
|
+
ProductListParams = TerminalShop::Models::ProductListParams
|
65
|
+
|
66
|
+
ProductVariant = TerminalShop::Models::ProductVariant
|
67
|
+
|
68
|
+
ProfileAPI = TerminalShop::Models::ProfileAPI
|
69
|
+
|
70
|
+
ProfileMeParams = TerminalShop::Models::ProfileMeParams
|
71
|
+
|
72
|
+
ProfileUpdateParams = TerminalShop::Models::ProfileUpdateParams
|
73
|
+
|
74
|
+
Region = TerminalShop::Models::Region
|
75
|
+
|
76
|
+
SubscriptionAPI = TerminalShop::Models::SubscriptionAPI
|
77
|
+
|
78
|
+
SubscriptionCreateParams = TerminalShop::Models::SubscriptionCreateParams
|
79
|
+
|
80
|
+
SubscriptionDeleteParams = TerminalShop::Models::SubscriptionDeleteParams
|
81
|
+
|
82
|
+
SubscriptionGetParams = TerminalShop::Models::SubscriptionGetParams
|
83
|
+
|
84
|
+
SubscriptionListParams = TerminalShop::Models::SubscriptionListParams
|
85
|
+
|
86
|
+
SubscriptionUpdateParams = TerminalShop::Models::SubscriptionUpdateParams
|
87
|
+
|
88
|
+
TokenAPI = TerminalShop::Models::TokenAPI
|
89
|
+
|
90
|
+
TokenCreateParams = TerminalShop::Models::TokenCreateParams
|
91
|
+
|
92
|
+
TokenDeleteParams = TerminalShop::Models::TokenDeleteParams
|
93
|
+
|
94
|
+
TokenGetParams = TerminalShop::Models::TokenGetParams
|
95
|
+
|
96
|
+
TokenListParams = TerminalShop::Models::TokenListParams
|
97
|
+
|
98
|
+
ViewInitParams = TerminalShop::Models::ViewInitParams
|
99
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# typed: strong
|
2
2
|
|
3
3
|
module TerminalShop
|
4
|
+
RequestOpts = T.type_alias { T.any(TerminalShop::RequestOptions, TerminalShop::Internal::AnyHash) }
|
5
|
+
|
4
6
|
# Specify HTTP behaviour to use for a specific request. These options supplement
|
5
7
|
# or override those provided at the client level.
|
6
8
|
#
|
@@ -14,7 +14,7 @@ module TerminalShop
|
|
14
14
|
phone: String,
|
15
15
|
province: String,
|
16
16
|
street2: String,
|
17
|
-
request_options:
|
17
|
+
request_options: TerminalShop::RequestOpts
|
18
18
|
)
|
19
19
|
.returns(TerminalShop::Models::AddressCreateResponse)
|
20
20
|
end
|
@@ -38,25 +38,12 @@ module TerminalShop
|
|
38
38
|
request_options: {}
|
39
39
|
); end
|
40
40
|
# Get the shipping addresses associated with the current user.
|
41
|
-
sig
|
42
|
-
params(
|
43
|
-
request_options: T.nilable(
|
44
|
-
T.any(
|
45
|
-
TerminalShop::RequestOptions,
|
46
|
-
TerminalShop::Internal::AnyHash
|
47
|
-
)
|
48
|
-
)
|
49
|
-
)
|
50
|
-
.returns(TerminalShop::Models::AddressListResponse)
|
51
|
-
end
|
41
|
+
sig { params(request_options: TerminalShop::RequestOpts).returns(TerminalShop::Models::AddressListResponse) }
|
52
42
|
def list(request_options: {}); end
|
53
43
|
|
54
44
|
# Delete a shipping address from the current user.
|
55
45
|
sig do
|
56
|
-
params(
|
57
|
-
id: String,
|
58
|
-
request_options: T.nilable(T.any(TerminalShop::RequestOptions, TerminalShop::Internal::AnyHash))
|
59
|
-
)
|
46
|
+
params(id: String, request_options: TerminalShop::RequestOpts)
|
60
47
|
.returns(TerminalShop::Models::AddressDeleteResponse)
|
61
48
|
end
|
62
49
|
def delete(
|
@@ -66,10 +53,7 @@ module TerminalShop
|
|
66
53
|
); end
|
67
54
|
# Get the shipping address with the given ID.
|
68
55
|
sig do
|
69
|
-
params(
|
70
|
-
id: String,
|
71
|
-
request_options: T.nilable(T.any(TerminalShop::RequestOptions, TerminalShop::Internal::AnyHash))
|
72
|
-
)
|
56
|
+
params(id: String, request_options: TerminalShop::RequestOpts)
|
73
57
|
.returns(TerminalShop::Models::AddressGetResponse)
|
74
58
|
end
|
75
59
|
def get(
|