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.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -19
  3. data/lib/terminal-shop/base_model.rb +448 -438
  4. data/lib/terminal-shop/models/cart.rb +35 -2
  5. data/lib/terminal-shop/models/cart_convert_params.rb +11 -1
  6. data/lib/terminal-shop/models/cart_redeem_gift_card_params.rb +24 -0
  7. data/lib/terminal-shop/models/cart_redeem_gift_card_response.rb +48 -0
  8. data/lib/terminal-shop/models/cart_remove_gift_card_params.rb +18 -0
  9. data/lib/terminal-shop/models/cart_remove_gift_card_response.rb +19 -0
  10. data/lib/terminal-shop/models/product.rb +11 -6
  11. data/lib/terminal-shop/resources/cart.rb +43 -1
  12. data/lib/terminal-shop/util.rb +3 -3
  13. data/lib/terminal-shop/version.rb +1 -1
  14. data/lib/terminal-shop.rb +4 -0
  15. data/rbi/lib/terminal-shop/base_client.rbi +23 -21
  16. data/rbi/lib/terminal-shop/base_model.rbi +235 -217
  17. data/rbi/lib/terminal-shop/client.rbi +2 -2
  18. data/rbi/lib/terminal-shop/errors.rbi +8 -8
  19. data/rbi/lib/terminal-shop/models/address.rbi +2 -2
  20. data/rbi/lib/terminal-shop/models/address_create_params.rbi +3 -13
  21. data/rbi/lib/terminal-shop/models/address_create_response.rbi +2 -2
  22. data/rbi/lib/terminal-shop/models/address_delete_params.rbi +5 -2
  23. data/rbi/lib/terminal-shop/models/address_delete_response.rbi +2 -2
  24. data/rbi/lib/terminal-shop/models/address_get_params.rbi +5 -2
  25. data/rbi/lib/terminal-shop/models/address_get_response.rbi +2 -2
  26. data/rbi/lib/terminal-shop/models/address_list_params.rbi +5 -2
  27. data/rbi/lib/terminal-shop/models/address_list_response.rbi +2 -2
  28. data/rbi/lib/terminal-shop/models/app.rbi +2 -2
  29. data/rbi/lib/terminal-shop/models/app_create_params.rbi +2 -2
  30. data/rbi/lib/terminal-shop/models/app_create_response.rbi +4 -4
  31. data/rbi/lib/terminal-shop/models/app_delete_params.rbi +5 -2
  32. data/rbi/lib/terminal-shop/models/app_delete_response.rbi +2 -2
  33. data/rbi/lib/terminal-shop/models/app_get_params.rbi +5 -2
  34. data/rbi/lib/terminal-shop/models/app_get_response.rbi +2 -2
  35. data/rbi/lib/terminal-shop/models/app_list_params.rbi +5 -2
  36. data/rbi/lib/terminal-shop/models/app_list_response.rbi +2 -2
  37. data/rbi/lib/terminal-shop/models/card.rbi +4 -4
  38. data/rbi/lib/terminal-shop/models/card_collect_params.rbi +5 -2
  39. data/rbi/lib/terminal-shop/models/card_collect_response.rbi +4 -4
  40. data/rbi/lib/terminal-shop/models/card_create_params.rbi +2 -2
  41. data/rbi/lib/terminal-shop/models/card_create_response.rbi +2 -2
  42. data/rbi/lib/terminal-shop/models/card_delete_params.rbi +5 -2
  43. data/rbi/lib/terminal-shop/models/card_delete_response.rbi +2 -2
  44. data/rbi/lib/terminal-shop/models/card_get_params.rbi +5 -2
  45. data/rbi/lib/terminal-shop/models/card_get_response.rbi +2 -2
  46. data/rbi/lib/terminal-shop/models/card_list_params.rbi +5 -2
  47. data/rbi/lib/terminal-shop/models/card_list_response.rbi +2 -2
  48. data/rbi/lib/terminal-shop/models/cart.rbi +45 -9
  49. data/rbi/lib/terminal-shop/models/cart_convert_params.rbi +17 -3
  50. data/rbi/lib/terminal-shop/models/cart_convert_response.rbi +2 -2
  51. data/rbi/lib/terminal-shop/models/cart_get_params.rbi +5 -2
  52. data/rbi/lib/terminal-shop/models/cart_get_response.rbi +2 -2
  53. data/rbi/lib/terminal-shop/models/cart_redeem_gift_card_params.rbi +32 -0
  54. data/rbi/lib/terminal-shop/models/cart_redeem_gift_card_response.rbi +66 -0
  55. data/rbi/lib/terminal-shop/models/cart_remove_gift_card_params.rbi +21 -0
  56. data/rbi/lib/terminal-shop/models/cart_remove_gift_card_response.rbi +23 -0
  57. data/rbi/lib/terminal-shop/models/cart_set_address_params.rbi +2 -2
  58. data/rbi/lib/terminal-shop/models/cart_set_address_response.rbi +2 -2
  59. data/rbi/lib/terminal-shop/models/cart_set_card_params.rbi +2 -2
  60. data/rbi/lib/terminal-shop/models/cart_set_card_response.rbi +2 -2
  61. data/rbi/lib/terminal-shop/models/cart_set_item_params.rbi +2 -2
  62. data/rbi/lib/terminal-shop/models/cart_set_item_response.rbi +2 -2
  63. data/rbi/lib/terminal-shop/models/email_create_params.rbi +2 -2
  64. data/rbi/lib/terminal-shop/models/email_create_response.rbi +2 -2
  65. data/rbi/lib/terminal-shop/models/order.rbi +10 -10
  66. data/rbi/lib/terminal-shop/models/order_create_params.rbi +2 -2
  67. data/rbi/lib/terminal-shop/models/order_create_response.rbi +2 -2
  68. data/rbi/lib/terminal-shop/models/order_get_params.rbi +5 -2
  69. data/rbi/lib/terminal-shop/models/order_get_response.rbi +2 -2
  70. data/rbi/lib/terminal-shop/models/order_list_params.rbi +5 -2
  71. data/rbi/lib/terminal-shop/models/order_list_response.rbi +2 -2
  72. data/rbi/lib/terminal-shop/models/product.rbi +29 -14
  73. data/rbi/lib/terminal-shop/models/product_get_params.rbi +5 -2
  74. data/rbi/lib/terminal-shop/models/product_get_response.rbi +2 -2
  75. data/rbi/lib/terminal-shop/models/product_list_params.rbi +5 -2
  76. data/rbi/lib/terminal-shop/models/product_list_response.rbi +2 -2
  77. data/rbi/lib/terminal-shop/models/product_variant.rbi +2 -2
  78. data/rbi/lib/terminal-shop/models/profile.rbi +4 -4
  79. data/rbi/lib/terminal-shop/models/profile_me_params.rbi +5 -2
  80. data/rbi/lib/terminal-shop/models/profile_me_response.rbi +2 -2
  81. data/rbi/lib/terminal-shop/models/profile_update_params.rbi +2 -2
  82. data/rbi/lib/terminal-shop/models/profile_update_response.rbi +2 -2
  83. data/rbi/lib/terminal-shop/models/subscription.rbi +15 -13
  84. data/rbi/lib/terminal-shop/models/subscription_create_params.rbi +5 -2
  85. data/rbi/lib/terminal-shop/models/subscription_create_response.rbi +2 -2
  86. data/rbi/lib/terminal-shop/models/subscription_delete_params.rbi +5 -2
  87. data/rbi/lib/terminal-shop/models/subscription_delete_response.rbi +2 -2
  88. data/rbi/lib/terminal-shop/models/subscription_get_params.rbi +5 -2
  89. data/rbi/lib/terminal-shop/models/subscription_get_response.rbi +2 -2
  90. data/rbi/lib/terminal-shop/models/subscription_list_params.rbi +5 -2
  91. data/rbi/lib/terminal-shop/models/subscription_list_response.rbi +2 -2
  92. data/rbi/lib/terminal-shop/models/token.rbi +2 -2
  93. data/rbi/lib/terminal-shop/models/token_create_params.rbi +5 -2
  94. data/rbi/lib/terminal-shop/models/token_create_response.rbi +4 -4
  95. data/rbi/lib/terminal-shop/models/token_delete_params.rbi +5 -2
  96. data/rbi/lib/terminal-shop/models/token_delete_response.rbi +2 -2
  97. data/rbi/lib/terminal-shop/models/token_get_params.rbi +5 -2
  98. data/rbi/lib/terminal-shop/models/token_get_response.rbi +2 -2
  99. data/rbi/lib/terminal-shop/models/token_list_params.rbi +5 -2
  100. data/rbi/lib/terminal-shop/models/token_list_response.rbi +2 -2
  101. data/rbi/lib/terminal-shop/models/view_init_params.rbi +5 -2
  102. data/rbi/lib/terminal-shop/models/view_init_response.rbi +5 -15
  103. data/rbi/lib/terminal-shop/pooled_net_requester.rbi +12 -10
  104. data/rbi/lib/terminal-shop/request_options.rbi +4 -0
  105. data/rbi/lib/terminal-shop/resources/address.rbi +2 -2
  106. data/rbi/lib/terminal-shop/resources/app.rbi +2 -2
  107. data/rbi/lib/terminal-shop/resources/card.rbi +2 -2
  108. data/rbi/lib/terminal-shop/resources/cart.rbi +24 -4
  109. data/rbi/lib/terminal-shop/resources/email.rbi +2 -2
  110. data/rbi/lib/terminal-shop/resources/order.rbi +2 -2
  111. data/rbi/lib/terminal-shop/resources/product.rbi +2 -2
  112. data/rbi/lib/terminal-shop/resources/profile.rbi +2 -2
  113. data/rbi/lib/terminal-shop/resources/subscription.rbi +2 -2
  114. data/rbi/lib/terminal-shop/resources/token.rbi +2 -2
  115. data/rbi/lib/terminal-shop/resources/view.rbi +2 -2
  116. data/rbi/lib/terminal-shop/util.rbi +146 -126
  117. data/rbi/lib/terminal-shop/version.rbi +1 -1
  118. data/sig/terminal-shop/models/cart.rbs +27 -2
  119. data/sig/terminal-shop/models/cart_convert_params.rbs +10 -2
  120. data/sig/terminal-shop/models/cart_redeem_gift_card_params.rbs +25 -0
  121. data/sig/terminal-shop/models/cart_redeem_gift_card_response.rbs +47 -0
  122. data/sig/terminal-shop/models/cart_remove_gift_card_params.rbs +19 -0
  123. data/sig/terminal-shop/models/cart_remove_gift_card_response.rbs +18 -0
  124. data/sig/terminal-shop/models/product.rbs +8 -2
  125. data/sig/terminal-shop/request_options.rbs +4 -0
  126. data/sig/terminal-shop/resources/cart.rbs +20 -0
  127. data/sig/terminal-shop/version.rbs +1 -1
  128. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd3056ca007a3676c2e4252263dc95c4dd9be5f7d3ab71d38d103b1f3aaa7959
4
- data.tar.gz: a691229e58ecdd3d431ccd2fcd1b3c4b18a19d4d16384f849b18778667913e96
3
+ metadata.gz: 751da463435546aa646463c23f281021151b8416d6d96abd3fcb607cb4f1d2dd
4
+ data.tar.gz: 9b4b300351f7f8752b18fe11098c91b6c77fd805859f9d91aa90d85e04e4a5fe
5
5
  SHA512:
6
- metadata.gz: ac245487879b8e27da712e0c72574951d025f9ecd0f79973fce79062932dcae12abc5a9fce374d33556d013ae555751277737ee700825b79e9aea896b9ac392a
7
- data.tar.gz: 457fcb73956a5e4091fa6f4fbd25b78c1e06b6dcf770e4a6df3667d51e328b010eed9f1260a4c44bf4501c30725cf8d72ae5fe739e733d8740ba9a90a321a9ba
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
- exponential backoff. Connection errors (for example, due to a network
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
- Timeouts are applied separately to the initial connection and the overall request time,
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
- library is in initial development and has a major version of `0`, APIs may change
123
- at any time.
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.