terminal-shop 1.6.0 → 1.8.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 (103) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/lib/terminal-shop/base_client.rb +36 -46
  4. data/lib/terminal-shop/base_model.rb +88 -128
  5. data/lib/terminal-shop/base_page.rb +18 -18
  6. data/lib/terminal-shop/client.rb +1 -3
  7. data/lib/terminal-shop/errors.rb +12 -17
  8. data/lib/terminal-shop/extern.rb +1 -4
  9. data/lib/terminal-shop/models/region.rb +15 -0
  10. data/lib/terminal-shop/models/subscription.rb +6 -0
  11. data/lib/terminal-shop/models/view_init_response.rb +3 -13
  12. data/lib/terminal-shop/pooled_net_requester.rb +19 -21
  13. data/lib/terminal-shop/request_options.rb +4 -11
  14. data/lib/terminal-shop/resources/address.rb +0 -5
  15. data/lib/terminal-shop/resources/app.rb +0 -5
  16. data/lib/terminal-shop/resources/card.rb +0 -6
  17. data/lib/terminal-shop/resources/cart.rb +0 -7
  18. data/lib/terminal-shop/resources/email.rb +0 -2
  19. data/lib/terminal-shop/resources/order.rb +0 -4
  20. data/lib/terminal-shop/resources/product.rb +0 -3
  21. data/lib/terminal-shop/resources/profile.rb +0 -3
  22. data/lib/terminal-shop/resources/subscription.rb +0 -5
  23. data/lib/terminal-shop/resources/token.rb +0 -5
  24. data/lib/terminal-shop/resources/view.rb +0 -2
  25. data/lib/terminal-shop/util.rb +44 -71
  26. data/lib/terminal-shop/version.rb +1 -1
  27. data/lib/terminal-shop.rb +2 -0
  28. data/manifest.yaml +1 -0
  29. data/rbi/lib/terminal-shop/base_client.rbi +23 -0
  30. data/rbi/lib/terminal-shop/base_model.rbi +178 -52
  31. data/rbi/lib/terminal-shop/base_page.rbi +1 -2
  32. data/rbi/lib/terminal-shop/client.rbi +11 -0
  33. data/rbi/lib/terminal-shop/errors.rbi +33 -0
  34. data/rbi/lib/terminal-shop/extern.rbi +1 -1
  35. data/rbi/lib/terminal-shop/models/address.rbi +10 -0
  36. data/rbi/lib/terminal-shop/models/address_create_params.rbi +8 -0
  37. data/rbi/lib/terminal-shop/models/address_create_response.rbi +1 -0
  38. data/rbi/lib/terminal-shop/models/address_get_response.rbi +1 -0
  39. data/rbi/lib/terminal-shop/models/address_list_response.rbi +1 -0
  40. data/rbi/lib/terminal-shop/models/app.rbi +5 -0
  41. data/rbi/lib/terminal-shop/models/app_create_response.rbi +2 -0
  42. data/rbi/lib/terminal-shop/models/app_get_response.rbi +1 -0
  43. data/rbi/lib/terminal-shop/models/app_list_response.rbi +1 -0
  44. data/rbi/lib/terminal-shop/models/card.rbi +8 -0
  45. data/rbi/lib/terminal-shop/models/card_collect_response.rbi +4 -0
  46. data/rbi/lib/terminal-shop/models/card_create_params.rbi +2 -0
  47. data/rbi/lib/terminal-shop/models/card_create_response.rbi +1 -0
  48. data/rbi/lib/terminal-shop/models/card_get_response.rbi +1 -0
  49. data/rbi/lib/terminal-shop/models/card_list_response.rbi +1 -0
  50. data/rbi/lib/terminal-shop/models/cart.rbi +19 -0
  51. data/rbi/lib/terminal-shop/models/cart_convert_response.rbi +1 -0
  52. data/rbi/lib/terminal-shop/models/cart_get_response.rbi +1 -0
  53. data/rbi/lib/terminal-shop/models/cart_set_address_params.rbi +1 -0
  54. data/rbi/lib/terminal-shop/models/cart_set_card_params.rbi +1 -0
  55. data/rbi/lib/terminal-shop/models/cart_set_item_params.rbi +2 -0
  56. data/rbi/lib/terminal-shop/models/cart_set_item_response.rbi +1 -0
  57. data/rbi/lib/terminal-shop/models/email_create_params.rbi +1 -0
  58. data/rbi/lib/terminal-shop/models/order.rbi +28 -0
  59. data/rbi/lib/terminal-shop/models/order_create_params.rbi +3 -0
  60. data/rbi/lib/terminal-shop/models/order_create_response.rbi +1 -0
  61. data/rbi/lib/terminal-shop/models/order_get_response.rbi +1 -0
  62. data/rbi/lib/terminal-shop/models/order_list_response.rbi +1 -0
  63. data/rbi/lib/terminal-shop/models/product.rbi +12 -6
  64. data/rbi/lib/terminal-shop/models/product_get_response.rbi +1 -0
  65. data/rbi/lib/terminal-shop/models/product_list_response.rbi +1 -0
  66. data/rbi/lib/terminal-shop/models/product_variant.rbi +4 -0
  67. data/rbi/lib/terminal-shop/models/profile.rbi +8 -0
  68. data/rbi/lib/terminal-shop/models/profile_me_response.rbi +1 -0
  69. data/rbi/lib/terminal-shop/models/profile_update_response.rbi +1 -0
  70. data/rbi/lib/terminal-shop/models/region.rbi +15 -0
  71. data/rbi/lib/terminal-shop/models/subscription.rbi +18 -11
  72. data/rbi/lib/terminal-shop/models/subscription_get_response.rbi +1 -0
  73. data/rbi/lib/terminal-shop/models/subscription_list_response.rbi +1 -0
  74. data/rbi/lib/terminal-shop/models/token.rbi +5 -0
  75. data/rbi/lib/terminal-shop/models/token_create_response.rbi +3 -0
  76. data/rbi/lib/terminal-shop/models/token_get_response.rbi +2 -0
  77. data/rbi/lib/terminal-shop/models/token_list_response.rbi +1 -0
  78. data/rbi/lib/terminal-shop/models/view_init_response.rbi +5 -13
  79. data/rbi/lib/terminal-shop/pooled_net_requester.rbi +10 -3
  80. data/rbi/lib/terminal-shop/request_options.rbi +21 -2
  81. data/rbi/lib/terminal-shop/resources/address.rbi +22 -2
  82. data/rbi/lib/terminal-shop/resources/app.rbi +14 -2
  83. data/rbi/lib/terminal-shop/resources/card.rbi +22 -3
  84. data/rbi/lib/terminal-shop/resources/cart.rbi +23 -3
  85. data/rbi/lib/terminal-shop/resources/email.rbi +6 -1
  86. data/rbi/lib/terminal-shop/resources/order.rbi +17 -2
  87. data/rbi/lib/terminal-shop/resources/product.rbi +7 -1
  88. data/rbi/lib/terminal-shop/resources/profile.rbi +2 -0
  89. data/rbi/lib/terminal-shop/resources/subscription.rbi +21 -2
  90. data/rbi/lib/terminal-shop/resources/token.rbi +14 -2
  91. data/rbi/lib/terminal-shop/resources/view.rbi +2 -0
  92. data/rbi/lib/terminal-shop/util.rbi +55 -8
  93. data/rbi/lib/terminal-shop/version.rbi +1 -1
  94. data/sig/terminal-shop/base_client.rbs +6 -1
  95. data/sig/terminal-shop/base_model.rbs +8 -6
  96. data/sig/terminal-shop/errors.rbs +4 -4
  97. data/sig/terminal-shop/models/region.rbs +12 -0
  98. data/sig/terminal-shop/models/subscription.rbs +1 -1
  99. data/sig/terminal-shop/models/view_init_response.rbs +3 -12
  100. data/sig/terminal-shop/pooled_net_requester.rbs +7 -2
  101. data/sig/terminal-shop/util.rbs +4 -4
  102. data/sig/terminal-shop/version.rbs +1 -1
  103. metadata +7 -4
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class OrderAPI < TerminalShop::BaseModel
6
+ # Unique object identifier. The format and length of IDs may change over time.
6
7
  sig { returns(String) }
7
8
  def id
8
9
  end
@@ -11,6 +12,7 @@ module TerminalShop
11
12
  def id=(_)
12
13
  end
13
14
 
15
+ # The subtotal and shipping amounts of the order.
14
16
  sig { returns(TerminalShop::Models::OrderAPI::Amount) }
15
17
  def amount
16
18
  end
@@ -19,6 +21,7 @@ module TerminalShop
19
21
  def amount=(_)
20
22
  end
21
23
 
24
+ # Items in the order.
22
25
  sig { returns(T::Array[TerminalShop::Models::OrderAPI::Item]) }
23
26
  def items
24
27
  end
@@ -30,6 +33,7 @@ module TerminalShop
30
33
  def items=(_)
31
34
  end
32
35
 
36
+ # Shipping address of the order.
33
37
  sig { returns(TerminalShop::Models::OrderAPI::Shipping) }
34
38
  def shipping
35
39
  end
@@ -38,6 +42,7 @@ module TerminalShop
38
42
  def shipping=(_)
39
43
  end
40
44
 
45
+ # Tracking information of the order.
41
46
  sig { returns(TerminalShop::Models::OrderAPI::Tracking) }
42
47
  def tracking
43
48
  end
@@ -46,6 +51,7 @@ module TerminalShop
46
51
  def tracking=(_)
47
52
  end
48
53
 
54
+ # Zero-based index of the order for this user only.
49
55
  sig { returns(T.nilable(Integer)) }
50
56
  def index
51
57
  end
@@ -54,6 +60,7 @@ module TerminalShop
54
60
  def index=(_)
55
61
  end
56
62
 
63
+ # An order from the Terminal shop.
57
64
  sig do
58
65
  params(
59
66
  id: String,
@@ -85,6 +92,7 @@ module TerminalShop
85
92
  end
86
93
 
87
94
  class Amount < TerminalShop::BaseModel
95
+ # Shipping amount of the order, in cents (USD).
88
96
  sig { returns(Integer) }
89
97
  def shipping
90
98
  end
@@ -93,6 +101,7 @@ module TerminalShop
93
101
  def shipping=(_)
94
102
  end
95
103
 
104
+ # Subtotal amount of the order, in cents (USD).
96
105
  sig { returns(Integer) }
97
106
  def subtotal
98
107
  end
@@ -101,6 +110,7 @@ module TerminalShop
101
110
  def subtotal=(_)
102
111
  end
103
112
 
113
+ # The subtotal and shipping amounts of the order.
104
114
  sig { params(shipping: Integer, subtotal: Integer).returns(T.attached_class) }
105
115
  def self.new(shipping:, subtotal:)
106
116
  end
@@ -111,6 +121,7 @@ module TerminalShop
111
121
  end
112
122
 
113
123
  class Item < TerminalShop::BaseModel
124
+ # Unique object identifier. The format and length of IDs may change over time.
114
125
  sig { returns(String) }
115
126
  def id
116
127
  end
@@ -119,6 +130,7 @@ module TerminalShop
119
130
  def id=(_)
120
131
  end
121
132
 
133
+ # Amount of the item in the order, in cents (USD).
122
134
  sig { returns(Integer) }
123
135
  def amount
124
136
  end
@@ -127,6 +139,7 @@ module TerminalShop
127
139
  def amount=(_)
128
140
  end
129
141
 
142
+ # Quantity of the item in the order.
130
143
  sig { returns(Integer) }
131
144
  def quantity
132
145
  end
@@ -135,6 +148,7 @@ module TerminalShop
135
148
  def quantity=(_)
136
149
  end
137
150
 
151
+ # Description of the item in the order.
138
152
  sig { returns(T.nilable(String)) }
139
153
  def description
140
154
  end
@@ -143,6 +157,7 @@ module TerminalShop
143
157
  def description=(_)
144
158
  end
145
159
 
160
+ # ID of the product variant of the item in the order.
146
161
  sig { returns(T.nilable(String)) }
147
162
  def product_variant_id
148
163
  end
@@ -179,6 +194,7 @@ module TerminalShop
179
194
  end
180
195
 
181
196
  class Shipping < TerminalShop::BaseModel
197
+ # City of the address.
182
198
  sig { returns(String) }
183
199
  def city
184
200
  end
@@ -187,6 +203,7 @@ module TerminalShop
187
203
  def city=(_)
188
204
  end
189
205
 
206
+ # ISO 3166-1 alpha-2 country code of the address.
190
207
  sig { returns(String) }
191
208
  def country
192
209
  end
@@ -195,6 +212,7 @@ module TerminalShop
195
212
  def country=(_)
196
213
  end
197
214
 
215
+ # The recipient's name.
198
216
  sig { returns(String) }
199
217
  def name
200
218
  end
@@ -203,6 +221,7 @@ module TerminalShop
203
221
  def name=(_)
204
222
  end
205
223
 
224
+ # Street of the address.
206
225
  sig { returns(String) }
207
226
  def street1
208
227
  end
@@ -211,6 +230,7 @@ module TerminalShop
211
230
  def street1=(_)
212
231
  end
213
232
 
233
+ # Zip code of the address.
214
234
  sig { returns(String) }
215
235
  def zip
216
236
  end
@@ -219,6 +239,7 @@ module TerminalShop
219
239
  def zip=(_)
220
240
  end
221
241
 
242
+ # Phone number of the recipient.
222
243
  sig { returns(T.nilable(String)) }
223
244
  def phone
224
245
  end
@@ -227,6 +248,7 @@ module TerminalShop
227
248
  def phone=(_)
228
249
  end
229
250
 
251
+ # Province or state of the address.
230
252
  sig { returns(T.nilable(String)) }
231
253
  def province
232
254
  end
@@ -235,6 +257,7 @@ module TerminalShop
235
257
  def province=(_)
236
258
  end
237
259
 
260
+ # Apartment, suite, etc. of the address.
238
261
  sig { returns(T.nilable(String)) }
239
262
  def street2
240
263
  end
@@ -243,6 +266,7 @@ module TerminalShop
243
266
  def street2=(_)
244
267
  end
245
268
 
269
+ # Shipping address of the order.
246
270
  sig do
247
271
  params(
248
272
  city: String,
@@ -279,6 +303,7 @@ module TerminalShop
279
303
  end
280
304
 
281
305
  class Tracking < TerminalShop::BaseModel
306
+ # Tracking number of the order.
282
307
  sig { returns(T.nilable(String)) }
283
308
  def number
284
309
  end
@@ -287,6 +312,7 @@ module TerminalShop
287
312
  def number=(_)
288
313
  end
289
314
 
315
+ # Shipping service of the order.
290
316
  sig { returns(T.nilable(String)) }
291
317
  def service
292
318
  end
@@ -295,6 +321,7 @@ module TerminalShop
295
321
  def service=(_)
296
322
  end
297
323
 
324
+ # Tracking URL of the order.
298
325
  sig { returns(T.nilable(String)) }
299
326
  def url
300
327
  end
@@ -303,6 +330,7 @@ module TerminalShop
303
330
  def url=(_)
304
331
  end
305
332
 
333
+ # Tracking information of the order.
306
334
  sig { params(number: String, service: String, url: String).returns(T.attached_class) }
307
335
  def self.new(number: nil, service: nil, url: nil)
308
336
  end
@@ -6,6 +6,7 @@ module TerminalShop
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
+ # Shipping address ID.
9
10
  sig { returns(String) }
10
11
  def address_id
11
12
  end
@@ -14,6 +15,7 @@ module TerminalShop
14
15
  def address_id=(_)
15
16
  end
16
17
 
18
+ # Card ID.
17
19
  sig { returns(String) }
18
20
  def card_id
19
21
  end
@@ -22,6 +24,7 @@ module TerminalShop
22
24
  def card_id=(_)
23
25
  end
24
26
 
27
+ # Product variants to include in the order, along with their quantities.
25
28
  sig { returns(T::Hash[Symbol, Integer]) }
26
29
  def variants
27
30
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class OrderCreateResponse < TerminalShop::BaseModel
6
+ # Order ID.
6
7
  sig { returns(String) }
7
8
  def data
8
9
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class OrderGetResponse < TerminalShop::BaseModel
6
+ # An order from the Terminal shop.
6
7
  sig { returns(TerminalShop::Models::OrderAPI) }
7
8
  def data
8
9
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class OrderListResponse < TerminalShop::BaseModel
6
+ # List of orders.
6
7
  sig { returns(T::Array[TerminalShop::Models::OrderAPI]) }
7
8
  def data
8
9
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class ProductAPI < TerminalShop::BaseModel
6
+ # Unique object identifier. The format and length of IDs may change over time.
6
7
  sig { returns(String) }
7
8
  def id
8
9
  end
@@ -11,6 +12,7 @@ module TerminalShop
11
12
  def id=(_)
12
13
  end
13
14
 
15
+ # Description of the product.
14
16
  sig { returns(String) }
15
17
  def description
16
18
  end
@@ -19,6 +21,7 @@ module TerminalShop
19
21
  def description=(_)
20
22
  end
21
23
 
24
+ # Name of the product.
22
25
  sig { returns(String) }
23
26
  def name
24
27
  end
@@ -27,6 +30,7 @@ module TerminalShop
27
30
  def name=(_)
28
31
  end
29
32
 
33
+ # List of variants of the product.
30
34
  sig { returns(T::Array[TerminalShop::Models::ProductVariant]) }
31
35
  def variants
32
36
  end
@@ -38,6 +42,7 @@ module TerminalShop
38
42
  def variants=(_)
39
43
  end
40
44
 
45
+ # Order of the product used when displaying a sorted list of products.
41
46
  sig { returns(T.nilable(Integer)) }
42
47
  def order
43
48
  end
@@ -46,6 +51,7 @@ module TerminalShop
46
51
  def order=(_)
47
52
  end
48
53
 
54
+ # Whether the product must be or can be subscribed to.
49
55
  sig { returns(T.nilable(Symbol)) }
50
56
  def subscription
51
57
  end
@@ -54,6 +60,7 @@ module TerminalShop
54
60
  def subscription=(_)
55
61
  end
56
62
 
63
+ # Tags for the product.
57
64
  sig { returns(T.nilable(TerminalShop::Models::ProductAPI::Tags)) }
58
65
  def tags
59
66
  end
@@ -62,6 +69,7 @@ module TerminalShop
62
69
  def tags=(_)
63
70
  end
64
71
 
72
+ # Product sold in the Terminal shop.
65
73
  sig do
66
74
  params(
67
75
  id: String,
@@ -94,17 +102,14 @@ module TerminalShop
94
102
  def to_hash
95
103
  end
96
104
 
105
+ # Whether the product must be or can be subscribed to.
97
106
  class Subscription < TerminalShop::Enum
98
107
  abstract!
99
108
 
109
+ Value = type_template(:out) { {fixed: Symbol} }
110
+
100
111
  ALLOWED = :allowed
101
112
  REQUIRED = :required
102
-
103
- class << self
104
- sig { override.returns(T::Array[Symbol]) }
105
- def values
106
- end
107
- end
108
113
  end
109
114
 
110
115
  class Tags < TerminalShop::BaseModel
@@ -148,6 +153,7 @@ module TerminalShop
148
153
  def market_na=(_)
149
154
  end
150
155
 
156
+ # Tags for the product.
151
157
  sig do
152
158
  params(
153
159
  app: String,
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class ProductGetResponse < TerminalShop::BaseModel
6
+ # Product sold in the Terminal shop.
6
7
  sig { returns(TerminalShop::Models::ProductAPI) }
7
8
  def data
8
9
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class ProductListResponse < TerminalShop::BaseModel
6
+ # A list of products.
6
7
  sig { returns(T::Array[TerminalShop::Models::ProductAPI]) }
7
8
  def data
8
9
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class ProductVariant < TerminalShop::BaseModel
6
+ # Unique object identifier. The format and length of IDs may change over time.
6
7
  sig { returns(String) }
7
8
  def id
8
9
  end
@@ -11,6 +12,7 @@ module TerminalShop
11
12
  def id=(_)
12
13
  end
13
14
 
15
+ # Name of the product variant.
14
16
  sig { returns(String) }
15
17
  def name
16
18
  end
@@ -19,6 +21,7 @@ module TerminalShop
19
21
  def name=(_)
20
22
  end
21
23
 
24
+ # Price of the product variant in cents (USD).
22
25
  sig { returns(Integer) }
23
26
  def price
24
27
  end
@@ -27,6 +30,7 @@ module TerminalShop
27
30
  def price=(_)
28
31
  end
29
32
 
33
+ # Variant of a product in the Terminal shop.
30
34
  sig { params(id: String, name: String, price: Integer).returns(T.attached_class) }
31
35
  def self.new(id:, name:, price:)
32
36
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class ProfileAPI < TerminalShop::BaseModel
6
+ # A Terminal shop user. (We have users, btw.)
6
7
  sig { returns(TerminalShop::Models::ProfileAPI::User) }
7
8
  def user
8
9
  end
@@ -11,6 +12,7 @@ module TerminalShop
11
12
  def user=(_)
12
13
  end
13
14
 
15
+ # A Terminal shop user's profile. (We have users, btw.)
14
16
  sig { params(user: TerminalShop::Models::ProfileAPI::User).returns(T.attached_class) }
15
17
  def self.new(user:)
16
18
  end
@@ -20,6 +22,7 @@ module TerminalShop
20
22
  end
21
23
 
22
24
  class User < TerminalShop::BaseModel
25
+ # Unique object identifier. The format and length of IDs may change over time.
23
26
  sig { returns(String) }
24
27
  def id
25
28
  end
@@ -28,6 +31,7 @@ module TerminalShop
28
31
  def id=(_)
29
32
  end
30
33
 
34
+ # Email address of the user.
31
35
  sig { returns(T.nilable(String)) }
32
36
  def email
33
37
  end
@@ -36,6 +40,7 @@ module TerminalShop
36
40
  def email=(_)
37
41
  end
38
42
 
43
+ # The user's fingerprint, derived from their public SSH key.
39
44
  sig { returns(T.nilable(String)) }
40
45
  def fingerprint
41
46
  end
@@ -44,6 +49,7 @@ module TerminalShop
44
49
  def fingerprint=(_)
45
50
  end
46
51
 
52
+ # Name of the user.
47
53
  sig { returns(T.nilable(String)) }
48
54
  def name
49
55
  end
@@ -52,6 +58,7 @@ module TerminalShop
52
58
  def name=(_)
53
59
  end
54
60
 
61
+ # Stripe customer ID of the user.
55
62
  sig { returns(String) }
56
63
  def stripe_customer_id
57
64
  end
@@ -60,6 +67,7 @@ module TerminalShop
60
67
  def stripe_customer_id=(_)
61
68
  end
62
69
 
70
+ # A Terminal shop user. (We have users, btw.)
63
71
  sig do
64
72
  params(
65
73
  id: String,
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class ProfileMeResponse < TerminalShop::BaseModel
6
+ # A Terminal shop user's profile. (We have users, btw.)
6
7
  sig { returns(TerminalShop::Models::ProfileAPI) }
7
8
  def data
8
9
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class ProfileUpdateResponse < TerminalShop::BaseModel
6
+ # A Terminal shop user's profile. (We have users, btw.)
6
7
  sig { returns(TerminalShop::Models::ProfileAPI) }
7
8
  def data
8
9
  end
@@ -0,0 +1,15 @@
1
+ # typed: strong
2
+
3
+ module TerminalShop
4
+ module Models
5
+ # A Terminal shop user's region.
6
+ class Region < TerminalShop::Enum
7
+ abstract!
8
+
9
+ Value = type_template(:out) { {fixed: Symbol} }
10
+
11
+ EU = :eu
12
+ NA = :na
13
+ end
14
+ end
15
+ end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class SubscriptionAPI < TerminalShop::BaseModel
6
+ # Unique object identifier. The format and length of IDs may change over time.
6
7
  sig { returns(String) }
7
8
  def id
8
9
  end
@@ -11,6 +12,7 @@ module TerminalShop
11
12
  def id=(_)
12
13
  end
13
14
 
15
+ # ID of the shipping address used for the subscription.
14
16
  sig { returns(String) }
15
17
  def address_id
16
18
  end
@@ -19,6 +21,7 @@ module TerminalShop
19
21
  def address_id=(_)
20
22
  end
21
23
 
24
+ # ID of the card used for the subscription.
22
25
  sig { returns(String) }
23
26
  def card_id
24
27
  end
@@ -27,6 +30,7 @@ module TerminalShop
27
30
  def card_id=(_)
28
31
  end
29
32
 
33
+ # ID of the product variant being subscribed to.
30
34
  sig { returns(String) }
31
35
  def product_variant_id
32
36
  end
@@ -35,6 +39,7 @@ module TerminalShop
35
39
  def product_variant_id=(_)
36
40
  end
37
41
 
42
+ # Quantity of the subscription.
38
43
  sig { returns(Integer) }
39
44
  def quantity
40
45
  end
@@ -43,6 +48,7 @@ module TerminalShop
43
48
  def quantity=(_)
44
49
  end
45
50
 
51
+ # Next shipment and billing date for the subscription.
46
52
  sig { returns(T.nilable(String)) }
47
53
  def next_
48
54
  end
@@ -51,6 +57,7 @@ module TerminalShop
51
57
  def next_=(_)
52
58
  end
53
59
 
60
+ # Schedule of the subscription.
54
61
  sig do
55
62
  returns(
56
63
  T.nilable(
@@ -81,6 +88,7 @@ module TerminalShop
81
88
  def schedule=(_)
82
89
  end
83
90
 
91
+ # Subscription to a Terminal shop product.
84
92
  sig do
85
93
  params(
86
94
  id: String,
@@ -119,9 +127,19 @@ module TerminalShop
119
127
  def to_hash
120
128
  end
121
129
 
130
+ # Schedule of the subscription.
122
131
  class Schedule < TerminalShop::Union
123
132
  abstract!
124
133
 
134
+ Variants = type_template(:out) do
135
+ {
136
+ fixed: T.any(
137
+ TerminalShop::Models::SubscriptionAPI::Schedule::Fixed,
138
+ TerminalShop::Models::SubscriptionAPI::Schedule::Weekly
139
+ )
140
+ }
141
+ end
142
+
125
143
  class Fixed < TerminalShop::BaseModel
126
144
  sig { returns(Symbol) }
127
145
  def type
@@ -165,17 +183,6 @@ module TerminalShop
165
183
  def to_hash
166
184
  end
167
185
  end
168
-
169
- class << self
170
- sig do
171
- override
172
- .returns(
173
- [[NilClass, TerminalShop::Models::SubscriptionAPI::Schedule::Fixed], [NilClass, TerminalShop::Models::SubscriptionAPI::Schedule::Weekly]]
174
- )
175
- end
176
- private def variants
177
- end
178
- end
179
186
  end
180
187
  end
181
188
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class SubscriptionGetResponse < TerminalShop::BaseModel
6
+ # Subscription to a Terminal shop product.
6
7
  sig { returns(TerminalShop::Models::SubscriptionAPI) }
7
8
  def data
8
9
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class SubscriptionListResponse < TerminalShop::BaseModel
6
+ # List of subscriptions.
6
7
  sig { returns(T::Array[TerminalShop::Models::SubscriptionAPI]) }
7
8
  def data
8
9
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class TokenAPI < TerminalShop::BaseModel
6
+ # Unique object identifier. The format and length of IDs may change over time.
6
7
  sig { returns(String) }
7
8
  def id
8
9
  end
@@ -11,6 +12,7 @@ module TerminalShop
11
12
  def id=(_)
12
13
  end
13
14
 
15
+ # Personal access token (obfuscated).
14
16
  sig { returns(String) }
15
17
  def token
16
18
  end
@@ -19,6 +21,7 @@ module TerminalShop
19
21
  def token=(_)
20
22
  end
21
23
 
24
+ # The created time for the token.
22
25
  sig { returns(String) }
23
26
  def created
24
27
  end
@@ -27,6 +30,8 @@ module TerminalShop
27
30
  def created=(_)
28
31
  end
29
32
 
33
+ # A personal access token used to access the Terminal API. If you leak this,
34
+ # expect large sums of coffee to be ordered on your credit card.
30
35
  sig { params(id: String, token: String, created: String).returns(T.attached_class) }
31
36
  def self.new(id:, token:, created:)
32
37
  end
@@ -23,6 +23,7 @@ module TerminalShop
23
23
  end
24
24
 
25
25
  class Data < TerminalShop::BaseModel
26
+ # Personal token ID.
26
27
  sig { returns(String) }
27
28
  def id
28
29
  end
@@ -31,6 +32,8 @@ module TerminalShop
31
32
  def id=(_)
32
33
  end
33
34
 
35
+ # Personal access token. Include this in the Authorization header
36
+ # (`Bearer <token>`) when accessing the Terminal API.
34
37
  sig { returns(String) }
35
38
  def token
36
39
  end
@@ -3,6 +3,8 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class TokenGetResponse < TerminalShop::BaseModel
6
+ # A personal access token used to access the Terminal API. If you leak this,
7
+ # expect large sums of coffee to be ordered on your credit card.
6
8
  sig { returns(TerminalShop::Models::TokenAPI) }
7
9
  def data
8
10
  end
@@ -3,6 +3,7 @@
3
3
  module TerminalShop
4
4
  module Models
5
5
  class TokenListResponse < TerminalShop::BaseModel
6
+ # List of personal access tokens.
6
7
  sig { returns(T::Array[TerminalShop::Models::TokenAPI]) }
7
8
  def data
8
9
  end