terminal-shop 1.0.0 → 1.1.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/README.md +27 -19
- data/lib/terminal-shop/base_model.rb +448 -438
- data/lib/terminal-shop/models/cart.rb +35 -2
- data/lib/terminal-shop/models/cart_convert_params.rb +11 -1
- data/lib/terminal-shop/models/cart_redeem_gift_card_params.rb +24 -0
- data/lib/terminal-shop/models/cart_redeem_gift_card_response.rb +48 -0
- data/lib/terminal-shop/models/cart_remove_gift_card_params.rb +18 -0
- data/lib/terminal-shop/models/cart_remove_gift_card_response.rb +19 -0
- data/lib/terminal-shop/models/product.rb +11 -6
- data/lib/terminal-shop/resources/cart.rb +43 -1
- data/lib/terminal-shop/util.rb +3 -3
- data/lib/terminal-shop/version.rb +1 -1
- data/lib/terminal-shop.rb +4 -0
- data/rbi/lib/terminal-shop/base_client.rbi +23 -21
- data/rbi/lib/terminal-shop/base_model.rbi +235 -217
- data/rbi/lib/terminal-shop/client.rbi +2 -2
- data/rbi/lib/terminal-shop/errors.rbi +8 -8
- data/rbi/lib/terminal-shop/models/address.rbi +2 -2
- data/rbi/lib/terminal-shop/models/address_create_params.rbi +3 -13
- data/rbi/lib/terminal-shop/models/address_create_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/address_delete_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/address_delete_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/address_get_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/address_get_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/address_list_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/address_list_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/app.rbi +2 -2
- data/rbi/lib/terminal-shop/models/app_create_params.rbi +2 -2
- data/rbi/lib/terminal-shop/models/app_create_response.rbi +4 -4
- data/rbi/lib/terminal-shop/models/app_delete_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/app_delete_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/app_get_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/app_get_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/app_list_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/app_list_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/card.rbi +4 -4
- data/rbi/lib/terminal-shop/models/card_collect_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/card_collect_response.rbi +4 -4
- data/rbi/lib/terminal-shop/models/card_create_params.rbi +2 -2
- data/rbi/lib/terminal-shop/models/card_create_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/card_delete_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/card_delete_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/card_get_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/card_get_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/card_list_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/card_list_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/cart.rbi +45 -9
- data/rbi/lib/terminal-shop/models/cart_convert_params.rbi +17 -3
- data/rbi/lib/terminal-shop/models/cart_convert_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/cart_get_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/cart_get_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/cart_redeem_gift_card_params.rbi +32 -0
- data/rbi/lib/terminal-shop/models/cart_redeem_gift_card_response.rbi +66 -0
- data/rbi/lib/terminal-shop/models/cart_remove_gift_card_params.rbi +21 -0
- data/rbi/lib/terminal-shop/models/cart_remove_gift_card_response.rbi +23 -0
- data/rbi/lib/terminal-shop/models/cart_set_address_params.rbi +2 -2
- data/rbi/lib/terminal-shop/models/cart_set_address_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/cart_set_card_params.rbi +2 -2
- data/rbi/lib/terminal-shop/models/cart_set_card_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/cart_set_item_params.rbi +2 -2
- data/rbi/lib/terminal-shop/models/cart_set_item_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/email_create_params.rbi +2 -2
- data/rbi/lib/terminal-shop/models/email_create_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/order.rbi +10 -10
- data/rbi/lib/terminal-shop/models/order_create_params.rbi +2 -2
- data/rbi/lib/terminal-shop/models/order_create_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/order_get_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/order_get_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/order_list_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/order_list_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/product.rbi +29 -14
- data/rbi/lib/terminal-shop/models/product_get_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/product_get_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/product_list_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/product_list_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/product_variant.rbi +2 -2
- data/rbi/lib/terminal-shop/models/profile.rbi +4 -4
- data/rbi/lib/terminal-shop/models/profile_me_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/profile_me_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/profile_update_params.rbi +2 -2
- data/rbi/lib/terminal-shop/models/profile_update_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/subscription.rbi +15 -13
- data/rbi/lib/terminal-shop/models/subscription_create_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/subscription_create_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/subscription_delete_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/subscription_delete_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/subscription_get_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/subscription_get_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/subscription_list_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/subscription_list_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/token.rbi +2 -2
- data/rbi/lib/terminal-shop/models/token_create_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/token_create_response.rbi +4 -4
- data/rbi/lib/terminal-shop/models/token_delete_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/token_delete_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/token_get_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/token_get_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/token_list_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/token_list_response.rbi +2 -2
- data/rbi/lib/terminal-shop/models/view_init_params.rbi +5 -2
- data/rbi/lib/terminal-shop/models/view_init_response.rbi +5 -15
- data/rbi/lib/terminal-shop/pooled_net_requester.rbi +12 -10
- data/rbi/lib/terminal-shop/request_options.rbi +4 -0
- data/rbi/lib/terminal-shop/resources/address.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/app.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/card.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/cart.rbi +24 -4
- data/rbi/lib/terminal-shop/resources/email.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/order.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/product.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/profile.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/subscription.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/token.rbi +2 -2
- data/rbi/lib/terminal-shop/resources/view.rbi +2 -2
- data/rbi/lib/terminal-shop/util.rbi +146 -126
- data/rbi/lib/terminal-shop/version.rbi +1 -1
- data/sig/terminal-shop/models/cart.rbs +27 -2
- data/sig/terminal-shop/models/cart_convert_params.rbs +10 -2
- data/sig/terminal-shop/models/cart_redeem_gift_card_params.rbs +25 -0
- data/sig/terminal-shop/models/cart_redeem_gift_card_response.rbs +47 -0
- data/sig/terminal-shop/models/cart_remove_gift_card_params.rbs +19 -0
- data/sig/terminal-shop/models/cart_remove_gift_card_response.rbs +18 -0
- data/sig/terminal-shop/models/product.rbs +8 -2
- data/sig/terminal-shop/request_options.rbs +4 -0
- data/sig/terminal-shop/resources/cart.rbs +20 -0
- data/sig/terminal-shop/version.rbs +1 -1
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 751da463435546aa646463c23f281021151b8416d6d96abd3fcb607cb4f1d2dd
|
4
|
+
data.tar.gz: 9b4b300351f7f8752b18fe11098c91b6c77fd805859f9d91aa90d85e04e4a5fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 200d08ede71db6dc925f78727b3e15474e825400e8ef73da2affa1ad6991b4f2832cdfe363c3b3348d308ccd5a6127288d9beea6263f819c232cbbbb82c28a6a
|
7
|
+
data.tar.gz: 433ff5cef723e81a8fef27c0d48a8e6a7cf30a3f051b1ad454cc2fc9d1e7b05e0bf70f7a995254ec265c0f2c48a980ab0a809122b885cba976de93bcf0066d7f
|
data/README.md
CHANGED
@@ -1,7 +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.0+
|
4
|
-
application.
|
3
|
+
The Terminal Ruby library provides convenient access to the Terminal REST API from any Ruby 3.0.0+ application.
|
5
4
|
|
6
5
|
It is generated with [Stainless](https://www.stainless.com/).
|
7
6
|
|
@@ -13,8 +12,7 @@ The underlying REST API documentation can be found on [terminal.shop](https://te
|
|
13
12
|
|
14
13
|
## Installation
|
15
14
|
|
16
|
-
To use this gem during the beta, install directly from GitHub with Bundler by
|
17
|
-
adding the following to your application's `Gemfile`:
|
15
|
+
To use this gem during the beta, install directly from GitHub with Bundler by adding the following to your application's `Gemfile`:
|
18
16
|
|
19
17
|
```ruby
|
20
18
|
gem "terminal-shop", git: "https://github.com/terminaldotshop/terminal-sdk-ruby", branch: "main"
|
@@ -26,8 +24,7 @@ To fetch an initial copy of the gem:
|
|
26
24
|
bundle install
|
27
25
|
```
|
28
26
|
|
29
|
-
To update the version used by your application when updates are pushed to
|
30
|
-
GitHub:
|
27
|
+
To update the version used by your application when updates are pushed to GitHub:
|
31
28
|
|
32
29
|
```sh
|
33
30
|
bundle update terminal-shop
|
@@ -51,9 +48,7 @@ puts(product.data)
|
|
51
48
|
|
52
49
|
### Errors
|
53
50
|
|
54
|
-
When the library is unable to connect to the API, or if the API returns a
|
55
|
-
non-success status code (i.e., 4xx or 5xx response), a subclass of
|
56
|
-
`TerminalShop::Error` will be thrown:
|
51
|
+
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `TerminalShop::Error` will be thrown:
|
57
52
|
|
58
53
|
```ruby
|
59
54
|
begin
|
@@ -81,10 +76,9 @@ Error codes are as followed:
|
|
81
76
|
|
82
77
|
### Retries
|
83
78
|
|
84
|
-
Certain errors will be automatically retried 2 times by default, with a short
|
85
|
-
|
86
|
-
connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors,
|
87
|
-
and timeouts will all be retried by default.
|
79
|
+
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
|
80
|
+
|
81
|
+
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.
|
88
82
|
|
89
83
|
You can use the `max_retries` option to configure or disable this:
|
90
84
|
|
@@ -101,8 +95,8 @@ terminal.product.list(request_options: {max_retries: 5})
|
|
101
95
|
### Timeouts
|
102
96
|
|
103
97
|
By default, requests will time out after 60 seconds.
|
104
|
-
|
105
|
-
so in some cases a request could wait 2\*timeout seconds before it fails.
|
98
|
+
|
99
|
+
Timeouts are applied separately to the initial connection and the overall request time, so in some cases a request could wait 2\*timeout seconds before it fails.
|
106
100
|
|
107
101
|
You can use the `timeout` option to configure or disable this:
|
108
102
|
|
@@ -116,12 +110,26 @@ terminal = TerminalShop::Client.new(
|
|
116
110
|
terminal.product.list(request_options: {timeout: 5})
|
117
111
|
```
|
118
112
|
|
113
|
+
## Sorbet Support
|
114
|
+
|
115
|
+
This library is written with [Sorbet type definitions](https://sorbet.org/docs/rbi). However, there is no runtime dependency on the `sorbet-runtime`.
|
116
|
+
|
117
|
+
What this means is that while you can use Sorbet to type check your code statically, and benefit from the [Sorbet Language Server](https://sorbet.org/docs/lsp) in your editor, there is no runtime type checking and execution overhead from Sorbet itself.
|
118
|
+
|
119
|
+
Due to limitations with the Sorbet type system, where a method otherwise can take an instance of `TerminalShop::BaseModel` class, you will need to use the `**` splat operator to pass the arguments:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
model = ProductListParams.new
|
123
|
+
|
124
|
+
terminal.product.list(**model)
|
125
|
+
```
|
126
|
+
|
119
127
|
## Versioning
|
120
128
|
|
121
|
-
This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the
|
122
|
-
|
123
|
-
|
129
|
+
This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.
|
130
|
+
|
131
|
+
This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.
|
124
132
|
|
125
133
|
## Requirements
|
126
134
|
|
127
|
-
Ruby 3.0 or higher.
|
135
|
+
Ruby 3.0.0 or higher.
|