terminal-shop 0.1.0.pre.alpha.14 → 1.0.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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/terminal-shop/base_client.rb +38 -58
  3. data/lib/terminal-shop/base_model.rb +9 -0
  4. data/lib/terminal-shop/base_page.rb +2 -2
  5. data/lib/terminal-shop/client.rb +1 -1
  6. data/lib/terminal-shop/errors.rb +3 -2
  7. data/lib/terminal-shop/models/address_get_params.rb +18 -0
  8. data/lib/terminal-shop/models/address_get_response.rb +20 -0
  9. data/lib/terminal-shop/models/app_create_params.rb +14 -2
  10. data/lib/terminal-shop/models/card_get_params.rb +18 -0
  11. data/lib/terminal-shop/models/card_get_response.rb +20 -0
  12. data/lib/terminal-shop/models/product.rb +63 -42
  13. data/lib/terminal-shop/models/product_get_params.rb +18 -0
  14. data/lib/terminal-shop/models/product_get_response.rb +20 -0
  15. data/lib/terminal-shop/models/profile_update_params.rb +7 -9
  16. data/lib/terminal-shop/models/subscription.rb +0 -10
  17. data/lib/terminal-shop/models/subscription_get_params.rb +18 -0
  18. data/lib/terminal-shop/models/subscription_get_response.rb +20 -0
  19. data/lib/terminal-shop/pooled_net_requester.rb +14 -9
  20. data/lib/terminal-shop/resources/address.rb +19 -0
  21. data/lib/terminal-shop/resources/app.rb +2 -6
  22. data/lib/terminal-shop/resources/card.rb +19 -0
  23. data/lib/terminal-shop/resources/product.rb +19 -0
  24. data/lib/terminal-shop/resources/profile.rb +3 -3
  25. data/lib/terminal-shop/resources/subscription.rb +19 -0
  26. data/lib/terminal-shop/util.rb +143 -3
  27. data/lib/terminal-shop/version.rb +1 -1
  28. data/lib/terminal-shop.rb +9 -1
  29. data/rbi/lib/terminal-shop/base_client.rbi +28 -17
  30. data/rbi/lib/terminal-shop/base_page.rbi +2 -2
  31. data/rbi/lib/terminal-shop/errors.rbi +3 -2
  32. data/rbi/lib/terminal-shop/models/address_get_params.rbi +18 -0
  33. data/rbi/lib/terminal-shop/models/address_get_response.rbi +23 -0
  34. data/rbi/lib/terminal-shop/models/app_create_params.rbi +29 -4
  35. data/rbi/lib/terminal-shop/models/card_get_params.rbi +18 -0
  36. data/rbi/lib/terminal-shop/models/card_get_response.rbi +23 -0
  37. data/rbi/lib/terminal-shop/models/product.rbi +70 -24
  38. data/rbi/lib/terminal-shop/models/product_get_params.rbi +18 -0
  39. data/rbi/lib/terminal-shop/models/product_get_response.rbi +23 -0
  40. data/rbi/lib/terminal-shop/models/profile_update_params.rbi +8 -13
  41. data/rbi/lib/terminal-shop/models/subscription_get_params.rbi +18 -0
  42. data/rbi/lib/terminal-shop/models/subscription_get_response.rbi +23 -0
  43. data/rbi/lib/terminal-shop/resources/address.rbi +10 -0
  44. data/rbi/lib/terminal-shop/resources/app.rbi +1 -3
  45. data/rbi/lib/terminal-shop/resources/card.rbi +10 -0
  46. data/rbi/lib/terminal-shop/resources/product.rbi +10 -0
  47. data/rbi/lib/terminal-shop/resources/profile.rbi +3 -3
  48. data/rbi/lib/terminal-shop/resources/subscription.rbi +10 -0
  49. data/rbi/lib/terminal-shop/util.rbi +33 -1
  50. data/rbi/lib/terminal-shop/version.rbi +1 -1
  51. data/sig/terminal-shop/base_client.rbs +12 -10
  52. data/sig/terminal-shop/base_page.rbs +1 -1
  53. data/sig/terminal-shop/errors.rbs +2 -1
  54. data/sig/terminal-shop/models/address_get_params.rbs +19 -0
  55. data/sig/terminal-shop/models/address_get_response.rbs +18 -0
  56. data/sig/terminal-shop/models/app_create_params.rbs +12 -3
  57. data/sig/terminal-shop/models/card_get_params.rbs +18 -0
  58. data/sig/terminal-shop/models/card_get_response.rbs +18 -0
  59. data/sig/terminal-shop/models/product.rbs +52 -17
  60. data/sig/terminal-shop/models/product_get_params.rbs +19 -0
  61. data/sig/terminal-shop/models/product_get_response.rbs +18 -0
  62. data/sig/terminal-shop/models/profile_update_params.rbs +5 -5
  63. data/sig/terminal-shop/models/subscription_get_params.rbs +19 -0
  64. data/sig/terminal-shop/models/subscription_get_response.rbs +19 -0
  65. data/sig/terminal-shop/resources/address.rbs +10 -0
  66. data/sig/terminal-shop/resources/app.rbs +0 -2
  67. data/sig/terminal-shop/resources/card.rbs +10 -0
  68. data/sig/terminal-shop/resources/product.rbs +10 -0
  69. data/sig/terminal-shop/resources/profile.rbs +3 -4
  70. data/sig/terminal-shop/resources/subscription.rbs +11 -0
  71. data/sig/terminal-shop/util.rbs +22 -1
  72. data/sig/terminal-shop/version.rbs +1 -1
  73. metadata +28 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9c9d4d0d855f9efb7d17ece8f3146f44c37931771161692ba1b5a300d1554e5
4
- data.tar.gz: adc5f6e291d1236cd3ed0413719e9723c134a03a3c885711aff315f54bafc6ae
3
+ metadata.gz: fd3056ca007a3676c2e4252263dc95c4dd9be5f7d3ab71d38d103b1f3aaa7959
4
+ data.tar.gz: a691229e58ecdd3d431ccd2fcd1b3c4b18a19d4d16384f849b18778667913e96
5
5
  SHA512:
6
- metadata.gz: c53cdb0cb66a612e7011afa8142555dbdde8de69c524df7374f3cf3b97d0c1ab2c25c3a5b88cf178c9a34042ca5f55c47a0e645b506c01bdc3581e8cae4927fa
7
- data.tar.gz: b24e9ab0c30622e874a80461fe84589f07afb94657be500051b3535bc76cd2cbe4997d1ae500bd0dbaefafd8c3bd7a0b96855895d4d4e568693eabefe4c63786
6
+ metadata.gz: ac245487879b8e27da712e0c72574951d025f9ecd0f79973fce79062932dcae12abc5a9fce374d33556d013ae555751277737ee700825b79e9aea896b9ac392a
7
+ data.tar.gz: 457fcb73956a5e4091fa6f4fbd25b78c1e06b6dcf770e4a6df3667d51e328b010eed9f1260a4c44bf4501c30725cf8d72ae5fe739e733d8740ba9a90a321a9ba
@@ -28,7 +28,7 @@ module TerminalShop
28
28
  # @raise [ArgumentError]
29
29
  #
30
30
  def validate!(req)
31
- keys = [:method, :path, :query, :headers, :body, :unwrap, :page, :model, :options]
31
+ keys = [:method, :path, :query, :headers, :body, :unwrap, :page, :stream, :model, :options]
32
32
  case req
33
33
  in Hash
34
34
  req.each_key do |k|
@@ -142,7 +142,7 @@ module TerminalShop
142
142
  # @param max_retries [Integer]
143
143
  # @param initial_retry_delay [Float]
144
144
  # @param max_retry_delay [Float]
145
- # @param headers [Hash{String=>String, nil}]
145
+ # @param headers [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}]
146
146
  # @param idempotency_header [String, nil]
147
147
  #
148
148
  def initialize(
@@ -193,7 +193,7 @@ module TerminalShop
193
193
  #
194
194
  # @option req [Hash{String=>Array<String>, String, nil}, nil] :query
195
195
  #
196
- # @option req [Hash{String=>String, nil}, nil] :headers
196
+ # @option req [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}, nil] :headers
197
197
  #
198
198
  # @option req [Object, nil] :body
199
199
  #
@@ -201,6 +201,8 @@ module TerminalShop
201
201
  #
202
202
  # @option req [Class, nil] :page
203
203
  #
204
+ # @option req [Class, nil] :stream
205
+ #
204
206
  # @option req [TerminalShop::Converter, Class, nil] :model
205
207
  #
206
208
  # @param opts [Hash{Symbol=>Object}] .
@@ -244,8 +246,8 @@ module TerminalShop
244
246
  end
245
247
 
246
248
  timeout = opts.fetch(:timeout, @timeout).to_f.clamp((0..))
247
- unless headers.key?("x-stainless-read-timeout") || timeout.zero?
248
- headers["x-stainless-read-timeout"] = timeout.to_s
249
+ unless headers.key?("x-stainless-timeout") || timeout.zero?
250
+ headers["x-stainless-timeout"] = timeout.to_s
249
251
  end
250
252
 
251
253
  headers.reject! { |_, v| v.to_s.empty? }
@@ -319,7 +321,7 @@ module TerminalShop
319
321
  # @param send_retry_header [Boolean]
320
322
  #
321
323
  # @raise [TerminalShop::APIError]
322
- # @return [Array(Net::HTTPResponse, Enumerable)]
324
+ # @return [Array(Integer, Net::HTTPResponse, Enumerable)]
323
325
  #
324
326
  private def send_request(request, redirect_count:, retry_count:, send_retry_header:)
325
327
  url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
@@ -342,7 +344,7 @@ module TerminalShop
342
344
 
343
345
  case status
344
346
  in ..299
345
- [response, stream]
347
+ [status, response, stream]
346
348
  in 300..399 if redirect_count >= self.class::MAX_REDIRECTS
347
349
  message = "Failed to complete the request within #{self.class::MAX_REDIRECTS} redirects."
348
350
 
@@ -360,13 +362,15 @@ module TerminalShop
360
362
  )
361
363
  in TerminalShop::APIConnectionError if retry_count >= max_retries
362
364
  raise status
363
- in (400..) if retry_count >= max_retries || (response && !self.class.should_retry?(
364
- status,
365
- headers: response
366
- ))
365
+ in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: response)
367
366
  decoded = TerminalShop::Util.decode_content(response, stream: stream, suppress_error: true)
368
367
 
369
- stream.each { srv_fault ? break : next }
368
+ if srv_fault
369
+ TerminalShop::Util.close_fused!(stream)
370
+ else
371
+ stream.each { next }
372
+ end
373
+
370
374
  raise TerminalShop::APIStatusError.for(
371
375
  url: url,
372
376
  status: status,
@@ -377,7 +381,11 @@ module TerminalShop
377
381
  in (400..) | TerminalShop::APIConnectionError
378
382
  delay = retry_delay(response, retry_count: retry_count)
379
383
 
380
- stream&.each { srv_fault ? break : next }
384
+ if srv_fault
385
+ TerminalShop::Util.close_fused!(stream)
386
+ else
387
+ stream&.each { next }
388
+ end
381
389
  sleep(delay)
382
390
 
383
391
  send_request(
@@ -389,48 +397,6 @@ module TerminalShop
389
397
  end
390
398
  end
391
399
 
392
- # @private
393
- #
394
- # @param req [Hash{Symbol=>Object}] .
395
- #
396
- # @option req [Symbol] :method
397
- #
398
- # @option req [String, Array<String>] :path
399
- #
400
- # @option req [Hash{String=>Array<String>, String, nil}, nil] :query
401
- #
402
- # @option req [Hash{String=>String, nil}, nil] :headers
403
- #
404
- # @option req [Object, nil] :body
405
- #
406
- # @option req [Symbol, nil] :unwrap
407
- #
408
- # @option req [Class, nil] :page
409
- #
410
- # @option req [TerminalShop::Converter, Class, nil] :model
411
- #
412
- # @option req [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :options
413
- #
414
- # @param headers [Hash{String=>String}, Net::HTTPHeader]
415
- #
416
- # @param stream [Enumerable]
417
- #
418
- # @return [Object]
419
- #
420
- private def parse_response(req, headers:, stream:)
421
- decoded = TerminalShop::Util.decode_content(headers, stream: stream)
422
- unwrapped = TerminalShop::Util.dig(decoded, req[:unwrap])
423
-
424
- case [req[:page], req.fetch(:model, TerminalShop::Unknown)]
425
- in [Class => page, _]
426
- page.new(client: self, req: req, headers: headers, unwrapped: unwrapped)
427
- in [nil, Class | TerminalShop::Converter => model]
428
- TerminalShop::Converter.coerce(model, unwrapped)
429
- in [nil, nil]
430
- unwrapped
431
- end
432
- end
433
-
434
400
  # Execute the request specified by `req`. This is the method that all resource
435
401
  # methods call into.
436
402
  #
@@ -442,7 +408,7 @@ module TerminalShop
442
408
  #
443
409
  # @option req [Hash{String=>Array<String>, String, nil}, nil] :query
444
410
  #
445
- # @option req [Hash{String=>String, nil}, nil] :headers
411
+ # @option req [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}, nil] :headers
446
412
  #
447
413
  # @option req [Object, nil] :body
448
414
  #
@@ -450,6 +416,8 @@ module TerminalShop
450
416
  #
451
417
  # @option req [Class, nil] :page
452
418
  #
419
+ # @option req [Class, nil] :stream
420
+ #
453
421
  # @option req [TerminalShop::Converter, Class, nil] :model
454
422
  #
455
423
  # @option req [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :options
@@ -459,19 +427,31 @@ module TerminalShop
459
427
  #
460
428
  def request(req)
461
429
  self.class.validate!(req)
430
+ model = req.fetch(:model) { TerminalShop::Unknown }
462
431
  opts = req[:options].to_h
463
432
  TerminalShop::RequestOptions.validate!(opts)
464
433
  request = build_request(req.except(:options), opts)
434
+ url = request.fetch(:url)
465
435
 
466
436
  # Don't send the current retry count in the headers if the caller modified the header defaults.
467
437
  send_retry_header = request.fetch(:headers)["x-stainless-retry-count"] == "0"
468
- response, stream = send_request(
438
+ status, response, stream = send_request(
469
439
  request,
470
440
  redirect_count: 0,
471
441
  retry_count: 0,
472
442
  send_retry_header: send_retry_header
473
443
  )
474
- parse_response(req, headers: response, stream: stream)
444
+
445
+ decoded = TerminalShop::Util.decode_content(response, stream: stream)
446
+ case req
447
+ in { stream: Class => st }
448
+ st.new(model: model, url: url, status: status, response: response, messages: decoded)
449
+ in { page: Class => page }
450
+ page.new(client: self, req: req, headers: response, page_data: decoded)
451
+ else
452
+ unwrapped = TerminalShop::Util.dig(decoded, req[:unwrap])
453
+ TerminalShop::Converter.coerce(model, unwrapped)
454
+ end
475
455
  end
476
456
 
477
457
  # @return [String]
@@ -839,6 +839,15 @@ module TerminalShop
839
839
  #
840
840
  # @abstract
841
841
  #
842
+ # @example
843
+ # ```ruby
844
+ # # `product_api` is a `TerminalShop::Models::ProductAPI`
845
+ # product_api => {
846
+ # id: id,
847
+ # description: description,
848
+ # name: name
849
+ # }
850
+ # ```
842
851
  class BaseModel
843
852
  extend TerminalShop::Converter
844
853
 
@@ -33,8 +33,8 @@ module TerminalShop
33
33
  # # @param client [TerminalShop::BaseClient]
34
34
  # # @param req [Hash{Symbol=>Object}]
35
35
  # # @param headers [Hash{String=>String}, Net::HTTPHeader]
36
- # # @param unwrapped [Object]
36
+ # # @param page_data [Object]
37
37
  # #
38
- # def initialize(client:, req:, headers:, unwrapped:); end
38
+ # def initialize(client:, req:, headers:, page_data:); end
39
39
  end
40
40
  end
@@ -65,7 +65,7 @@ module TerminalShop
65
65
  private def auth_headers
66
66
  return {} if @bearer_token.nil?
67
67
 
68
- {"Authorization" => "Bearer #{@bearer_token}"}
68
+ {"authorization" => "Bearer #{@bearer_token}"}
69
69
  end
70
70
 
71
71
  # Creates and returns a new client for interacting with the API.
@@ -99,11 +99,12 @@ module TerminalShop
99
99
  # @param body [Object, nil]
100
100
  # @param request [nil]
101
101
  # @param response [nil]
102
+ # @param message [String, nil]
102
103
  #
103
104
  # @return [TerminalShop::APIStatusError]
104
105
  #
105
- def self.for(url:, status:, body:, request:, response:)
106
- kwargs = {url: url, status: status, body: body, request: request, response: response}
106
+ def self.for(url:, status:, body:, request:, response:, message: nil)
107
+ kwargs = {url: url, status: status, body: body, request: request, response: response, message: message}
107
108
 
108
109
  case status
109
110
  in 400
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class AddressGetParams < TerminalShop::BaseModel
6
+ # @!parse
7
+ # extend TerminalShop::RequestParameters::Converter
8
+ include TerminalShop::RequestParameters
9
+
10
+ # @!parse
11
+ # # @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
12
+ # #
13
+ # def initialize(request_options: {}, **) = super
14
+
15
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class AddressGetResponse < TerminalShop::BaseModel
6
+ # @!attribute data
7
+ # Physical address associated with a Terminal shop user.
8
+ #
9
+ # @return [TerminalShop::Models::AddressAPI]
10
+ required :data, -> { TerminalShop::Models::AddressAPI }
11
+
12
+ # @!parse
13
+ # # @param data [TerminalShop::Models::AddressAPI]
14
+ # #
15
+ # def initialize(data:, **) = super
16
+
17
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
18
+ end
19
+ end
20
+ end
@@ -2,15 +2,27 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- class AppCreateParams < TerminalShop::Models::AppAPI
5
+ class AppCreateParams < TerminalShop::BaseModel
6
6
  # @!parse
7
7
  # extend TerminalShop::RequestParameters::Converter
8
8
  include TerminalShop::RequestParameters
9
9
 
10
+ # @!attribute name
11
+ #
12
+ # @return [String]
13
+ required :name, String
14
+
15
+ # @!attribute redirect_uri
16
+ #
17
+ # @return [String]
18
+ required :redirect_uri, String, api_name: :redirectURI
19
+
10
20
  # @!parse
21
+ # # @param name [String]
22
+ # # @param redirect_uri [String]
11
23
  # # @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
12
24
  # #
13
- # def initialize(request_options: {}, **) = super
25
+ # def initialize(name:, redirect_uri:, request_options: {}, **) = super
14
26
 
15
27
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
16
28
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class CardGetParams < TerminalShop::BaseModel
6
+ # @!parse
7
+ # extend TerminalShop::RequestParameters::Converter
8
+ include TerminalShop::RequestParameters
9
+
10
+ # @!parse
11
+ # # @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
12
+ # #
13
+ # def initialize(request_options: {}, **) = super
14
+
15
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class CardGetResponse < TerminalShop::BaseModel
6
+ # @!attribute data
7
+ # Credit card used for payments in the Terminal shop.
8
+ #
9
+ # @return [TerminalShop::Models::CardAPI]
10
+ required :data, -> { TerminalShop::Models::CardAPI }
11
+
12
+ # @!parse
13
+ # # @param data [TerminalShop::Models::CardAPI]
14
+ # #
15
+ # def initialize(data:, **) = super
16
+
17
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
18
+ end
19
+ end
20
+ end
@@ -15,11 +15,6 @@ module TerminalShop
15
15
  # @return [String]
16
16
  required :description, String
17
17
 
18
- # @!attribute filters
19
- #
20
- # @return [Array<Symbol, TerminalShop::Models::ProductAPI::Filter>]
21
- required :filters, -> { TerminalShop::ArrayOf[enum: TerminalShop::Models::ProductAPI::Filter] }
22
-
23
18
  # @!attribute name
24
19
  # Name of the product.
25
20
  #
@@ -55,11 +50,11 @@ module TerminalShop
55
50
  # @!attribute [r] tags
56
51
  # Tags for the product.
57
52
  #
58
- # @return [Hash{Symbol=>String}, nil]
59
- optional :tags, TerminalShop::HashOf[String]
53
+ # @return [TerminalShop::Models::ProductAPI::Tags, nil]
54
+ optional :tags, -> { TerminalShop::Models::ProductAPI::Tags }
60
55
 
61
56
  # @!parse
62
- # # @return [Hash{Symbol=>String}]
57
+ # # @return [TerminalShop::Models::ProductAPI::Tags]
63
58
  # attr_writer :tags
64
59
 
65
60
  # @!parse
@@ -67,31 +62,22 @@ module TerminalShop
67
62
  # #
68
63
  # # @param id [String]
69
64
  # # @param description [String]
70
- # # @param filters [Array<Symbol, TerminalShop::Models::ProductAPI::Filter>]
71
65
  # # @param name [String]
72
66
  # # @param variants [Array<TerminalShop::Models::ProductVariant>]
73
67
  # # @param order [Integer]
74
68
  # # @param subscription [Symbol, TerminalShop::Models::ProductAPI::Subscription]
75
- # # @param tags [Hash{Symbol=>String}]
69
+ # # @param tags [TerminalShop::Models::ProductAPI::Tags]
76
70
  # #
77
- # def initialize(id:, description:, filters:, name:, variants:, order: nil, subscription: nil, tags: nil, **) = super
71
+ # def initialize(id:, description:, name:, variants:, order: nil, subscription: nil, tags: nil, **) = super
78
72
 
79
73
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
80
74
 
81
75
  # @abstract
82
76
  #
83
- # @example
84
- # ```ruby
85
- # case filter
86
- # in :eu
87
- # # ...
88
- # in :na
89
- # # ...
90
- # end
91
- # ```
92
- class Filter < TerminalShop::Enum
93
- EU = :eu
94
- NA = :na
77
+ # Whether the product must be or can be subscribed to.
78
+ class Subscription < TerminalShop::Enum
79
+ ALLOWED = :allowed
80
+ REQUIRED = :required
95
81
 
96
82
  finalize!
97
83
 
@@ -101,29 +87,64 @@ module TerminalShop
101
87
  # def self.values; end
102
88
  end
103
89
 
104
- # @abstract
105
- #
106
- # Whether the product must be or can be subscribed to.
107
- #
108
- # @example
109
- # ```ruby
110
- # case subscription
111
- # in :allowed
112
- # # ...
113
- # in :required
114
- # # ...
115
- # end
116
- # ```
117
- class Subscription < TerminalShop::Enum
118
- ALLOWED = :allowed
119
- REQUIRED = :required
90
+ class Tags < TerminalShop::BaseModel
91
+ # @!attribute [r] app
92
+ #
93
+ # @return [String, nil]
94
+ optional :app, String
120
95
 
121
- finalize!
96
+ # @!parse
97
+ # # @return [String]
98
+ # attr_writer :app
99
+
100
+ # @!attribute [r] color
101
+ #
102
+ # @return [String, nil]
103
+ optional :color, String
122
104
 
123
105
  # @!parse
124
- # # @return [Array<Symbol>]
106
+ # # @return [String]
107
+ # attr_writer :color
108
+
109
+ # @!attribute [r] featured
110
+ #
111
+ # @return [Boolean, nil]
112
+ optional :featured, TerminalShop::BooleanModel
113
+
114
+ # @!parse
115
+ # # @return [Boolean]
116
+ # attr_writer :featured
117
+
118
+ # @!attribute [r] market_eu
119
+ #
120
+ # @return [Boolean, nil]
121
+ optional :market_eu, TerminalShop::BooleanModel
122
+
123
+ # @!parse
124
+ # # @return [Boolean]
125
+ # attr_writer :market_eu
126
+
127
+ # @!attribute [r] market_na
128
+ #
129
+ # @return [Boolean, nil]
130
+ optional :market_na, TerminalShop::BooleanModel
131
+
132
+ # @!parse
133
+ # # @return [Boolean]
134
+ # attr_writer :market_na
135
+
136
+ # @!parse
137
+ # # Tags for the product.
125
138
  # #
126
- # def self.values; end
139
+ # # @param app [String]
140
+ # # @param color [String]
141
+ # # @param featured [Boolean]
142
+ # # @param market_eu [Boolean]
143
+ # # @param market_na [Boolean]
144
+ # #
145
+ # def initialize(app: nil, color: nil, featured: nil, market_eu: nil, market_na: nil, **) = super
146
+
147
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
127
148
  end
128
149
  end
129
150
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class ProductGetParams < TerminalShop::BaseModel
6
+ # @!parse
7
+ # extend TerminalShop::RequestParameters::Converter
8
+ include TerminalShop::RequestParameters
9
+
10
+ # @!parse
11
+ # # @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
12
+ # #
13
+ # def initialize(request_options: {}, **) = super
14
+
15
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class ProductGetResponse < TerminalShop::BaseModel
6
+ # @!attribute data
7
+ # Product sold in the Terminal shop.
8
+ #
9
+ # @return [TerminalShop::Models::ProductAPI]
10
+ required :data, -> { TerminalShop::Models::ProductAPI }
11
+
12
+ # @!parse
13
+ # # @param data [TerminalShop::Models::ProductAPI]
14
+ # #
15
+ # def initialize(data:, **) = super
16
+
17
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
18
+ end
19
+ end
20
+ end
@@ -8,23 +8,21 @@ module TerminalShop
8
8
  include TerminalShop::RequestParameters
9
9
 
10
10
  # @!attribute email
11
- # Email address of the user.
12
11
  #
13
- # @return [String, nil]
14
- optional :email, String, nil?: true
12
+ # @return [String]
13
+ required :email, String
15
14
 
16
15
  # @!attribute name
17
- # Name of the user.
18
16
  #
19
- # @return [String, nil]
20
- optional :name, String, nil?: true
17
+ # @return [String]
18
+ required :name, String
21
19
 
22
20
  # @!parse
23
- # # @param email [String, nil]
24
- # # @param name [String, nil]
21
+ # # @param email [String]
22
+ # # @param name [String]
25
23
  # # @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
26
24
  # #
27
- # def initialize(email: nil, name: nil, request_options: {}, **) = super
25
+ # def initialize(email:, name:, request_options: {}, **) = super
28
26
 
29
27
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
30
28
  end
@@ -71,16 +71,6 @@ module TerminalShop
71
71
  # @abstract
72
72
  #
73
73
  # Schedule of the subscription.
74
- #
75
- # @example
76
- # ```ruby
77
- # case schedule
78
- # in TerminalShop::Models::SubscriptionAPI::Schedule::Fixed
79
- # # ...
80
- # in TerminalShop::Models::SubscriptionAPI::Schedule::Weekly
81
- # # ...
82
- # end
83
- # ```
84
74
  class Schedule < TerminalShop::Union
85
75
  variant -> { TerminalShop::Models::SubscriptionAPI::Schedule::Fixed }
86
76
 
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class SubscriptionGetParams < TerminalShop::BaseModel
6
+ # @!parse
7
+ # extend TerminalShop::RequestParameters::Converter
8
+ include TerminalShop::RequestParameters
9
+
10
+ # @!parse
11
+ # # @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
12
+ # #
13
+ # def initialize(request_options: {}, **) = super
14
+
15
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class SubscriptionGetResponse < TerminalShop::BaseModel
6
+ # @!attribute data
7
+ # Subscription to a Terminal shop product.
8
+ #
9
+ # @return [TerminalShop::Models::SubscriptionAPI]
10
+ required :data, -> { TerminalShop::Models::SubscriptionAPI }
11
+
12
+ # @!parse
13
+ # # @param data [TerminalShop::Models::SubscriptionAPI]
14
+ # #
15
+ # def initialize(data:, **) = super
16
+
17
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
18
+ end
19
+ end
20
+ end