terminal-shop 1.8.0 → 2.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 (220) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -0
  3. data/lib/terminal-shop/base_client.rb +11 -10
  4. data/lib/terminal-shop/base_model.rb +257 -244
  5. data/lib/terminal-shop/base_page.rb +19 -20
  6. data/lib/terminal-shop/client.rb +1 -0
  7. data/lib/terminal-shop/models/product.rb +7 -3
  8. data/lib/terminal-shop/models/region.rb +7 -3
  9. data/lib/terminal-shop/models/subscription.rb +5 -7
  10. data/lib/terminal-shop/pooled_net_requester.rb +12 -1
  11. data/lib/terminal-shop/request_options.rb +1 -1
  12. data/lib/terminal-shop/util.rb +16 -7
  13. data/lib/terminal-shop/version.rb +1 -1
  14. data/lib/terminal-shop.rb +15 -0
  15. data/rbi/lib/terminal-shop/base_client.rbi +40 -41
  16. data/rbi/lib/terminal-shop/base_model.rbi +139 -116
  17. data/rbi/lib/terminal-shop/base_page.rbi +0 -2
  18. data/rbi/lib/terminal-shop/client.rbi +18 -30
  19. data/rbi/lib/terminal-shop/errors.rbi +7 -42
  20. data/rbi/lib/terminal-shop/models/address.rbi +15 -51
  21. data/rbi/lib/terminal-shop/models/address_create_params.rbi +15 -46
  22. data/rbi/lib/terminal-shop/models/address_create_response.rbi +1 -6
  23. data/rbi/lib/terminal-shop/models/address_delete_params.rbi +1 -1
  24. data/rbi/lib/terminal-shop/models/address_delete_response.rbi +1 -6
  25. data/rbi/lib/terminal-shop/models/address_get_params.rbi +1 -1
  26. data/rbi/lib/terminal-shop/models/address_get_response.rbi +7 -6
  27. data/rbi/lib/terminal-shop/models/address_list_params.rbi +1 -1
  28. data/rbi/lib/terminal-shop/models/address_list_response.rbi +4 -6
  29. data/rbi/lib/terminal-shop/models/app.rbi +4 -24
  30. data/rbi/lib/terminal-shop/models/app_create_params.rbi +3 -13
  31. data/rbi/lib/terminal-shop/models/app_create_response.rbi +8 -20
  32. data/rbi/lib/terminal-shop/models/app_delete_params.rbi +1 -1
  33. data/rbi/lib/terminal-shop/models/app_delete_response.rbi +1 -6
  34. data/rbi/lib/terminal-shop/models/app_get_params.rbi +1 -1
  35. data/rbi/lib/terminal-shop/models/app_get_response.rbi +4 -6
  36. data/rbi/lib/terminal-shop/models/app_list_params.rbi +1 -1
  37. data/rbi/lib/terminal-shop/models/app_list_response.rbi +4 -6
  38. data/rbi/lib/terminal-shop/models/card.rbi +14 -36
  39. data/rbi/lib/terminal-shop/models/card_collect_params.rbi +1 -1
  40. data/rbi/lib/terminal-shop/models/card_collect_response.rbi +7 -14
  41. data/rbi/lib/terminal-shop/models/card_create_params.rbi +2 -7
  42. data/rbi/lib/terminal-shop/models/card_create_response.rbi +1 -6
  43. data/rbi/lib/terminal-shop/models/card_delete_params.rbi +1 -1
  44. data/rbi/lib/terminal-shop/models/card_delete_response.rbi +1 -6
  45. data/rbi/lib/terminal-shop/models/card_get_params.rbi +1 -1
  46. data/rbi/lib/terminal-shop/models/card_get_response.rbi +4 -6
  47. data/rbi/lib/terminal-shop/models/card_list_params.rbi +1 -1
  48. data/rbi/lib/terminal-shop/models/card_list_response.rbi +4 -6
  49. data/rbi/lib/terminal-shop/models/cart.rbi +34 -88
  50. data/rbi/lib/terminal-shop/models/cart_clear_params.rbi +1 -1
  51. data/rbi/lib/terminal-shop/models/cart_clear_response.rbi +1 -6
  52. data/rbi/lib/terminal-shop/models/cart_convert_params.rbi +1 -1
  53. data/rbi/lib/terminal-shop/models/cart_convert_response.rbi +4 -6
  54. data/rbi/lib/terminal-shop/models/cart_get_params.rbi +1 -1
  55. data/rbi/lib/terminal-shop/models/cart_get_response.rbi +4 -6
  56. data/rbi/lib/terminal-shop/models/cart_set_address_params.rbi +2 -7
  57. data/rbi/lib/terminal-shop/models/cart_set_address_response.rbi +1 -6
  58. data/rbi/lib/terminal-shop/models/cart_set_card_params.rbi +2 -7
  59. data/rbi/lib/terminal-shop/models/cart_set_card_response.rbi +1 -6
  60. data/rbi/lib/terminal-shop/models/cart_set_item_params.rbi +3 -13
  61. data/rbi/lib/terminal-shop/models/cart_set_item_response.rbi +4 -6
  62. data/rbi/lib/terminal-shop/models/email_create_params.rbi +2 -7
  63. data/rbi/lib/terminal-shop/models/email_create_response.rbi +1 -6
  64. data/rbi/lib/terminal-shop/models/order.rbi +52 -139
  65. data/rbi/lib/terminal-shop/models/order_create_params.rbi +4 -19
  66. data/rbi/lib/terminal-shop/models/order_create_response.rbi +1 -6
  67. data/rbi/lib/terminal-shop/models/order_get_params.rbi +1 -1
  68. data/rbi/lib/terminal-shop/models/order_get_response.rbi +4 -6
  69. data/rbi/lib/terminal-shop/models/order_list_params.rbi +1 -1
  70. data/rbi/lib/terminal-shop/models/order_list_response.rbi +4 -6
  71. data/rbi/lib/terminal-shop/models/product.rbi +43 -77
  72. data/rbi/lib/terminal-shop/models/product_get_params.rbi +1 -1
  73. data/rbi/lib/terminal-shop/models/product_get_response.rbi +7 -6
  74. data/rbi/lib/terminal-shop/models/product_list_params.rbi +1 -1
  75. data/rbi/lib/terminal-shop/models/product_list_response.rbi +4 -6
  76. data/rbi/lib/terminal-shop/models/product_variant.rbi +3 -18
  77. data/rbi/lib/terminal-shop/models/profile.rbi +12 -36
  78. data/rbi/lib/terminal-shop/models/profile_me_params.rbi +1 -1
  79. data/rbi/lib/terminal-shop/models/profile_me_response.rbi +7 -6
  80. data/rbi/lib/terminal-shop/models/profile_update_params.rbi +3 -13
  81. data/rbi/lib/terminal-shop/models/profile_update_response.rbi +7 -6
  82. data/rbi/lib/terminal-shop/models/region.rbi +10 -5
  83. data/rbi/lib/terminal-shop/models/subscription.rbi +28 -75
  84. data/rbi/lib/terminal-shop/models/subscription_create_params.rbi +1 -1
  85. data/rbi/lib/terminal-shop/models/subscription_create_response.rbi +1 -6
  86. data/rbi/lib/terminal-shop/models/subscription_delete_params.rbi +1 -1
  87. data/rbi/lib/terminal-shop/models/subscription_delete_response.rbi +1 -6
  88. data/rbi/lib/terminal-shop/models/subscription_get_params.rbi +1 -1
  89. data/rbi/lib/terminal-shop/models/subscription_get_response.rbi +7 -6
  90. data/rbi/lib/terminal-shop/models/subscription_list_params.rbi +1 -1
  91. data/rbi/lib/terminal-shop/models/subscription_list_response.rbi +3 -8
  92. data/rbi/lib/terminal-shop/models/token.rbi +3 -18
  93. data/rbi/lib/terminal-shop/models/token_create_params.rbi +1 -1
  94. data/rbi/lib/terminal-shop/models/token_create_response.rbi +8 -20
  95. data/rbi/lib/terminal-shop/models/token_delete_params.rbi +1 -1
  96. data/rbi/lib/terminal-shop/models/token_delete_response.rbi +1 -6
  97. data/rbi/lib/terminal-shop/models/token_get_params.rbi +1 -1
  98. data/rbi/lib/terminal-shop/models/token_get_response.rbi +4 -6
  99. data/rbi/lib/terminal-shop/models/token_list_params.rbi +1 -1
  100. data/rbi/lib/terminal-shop/models/token_list_response.rbi +4 -6
  101. data/rbi/lib/terminal-shop/models/view_init_params.rbi +1 -1
  102. data/rbi/lib/terminal-shop/models/view_init_response.rbi +32 -81
  103. data/rbi/lib/terminal-shop/pooled_net_requester.rbi +14 -3
  104. data/rbi/lib/terminal-shop/request_options.rbi +11 -55
  105. data/rbi/lib/terminal-shop/resources/address.rbi +4 -4
  106. data/rbi/lib/terminal-shop/resources/app.rbi +4 -4
  107. data/rbi/lib/terminal-shop/resources/card.rbi +5 -5
  108. data/rbi/lib/terminal-shop/resources/cart.rbi +6 -6
  109. data/rbi/lib/terminal-shop/resources/email.rbi +1 -1
  110. data/rbi/lib/terminal-shop/resources/order.rbi +3 -3
  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 +5 -4
  114. data/rbi/lib/terminal-shop/resources/token.rbi +4 -4
  115. data/rbi/lib/terminal-shop/resources/view.rbi +1 -1
  116. data/rbi/lib/terminal-shop/util.rbi +24 -13
  117. data/rbi/lib/terminal-shop/version.rbi +1 -1
  118. data/sig/terminal-shop/base_client.rbs +14 -14
  119. data/sig/terminal-shop/base_model.rbs +34 -18
  120. data/sig/terminal-shop/client.rbs +8 -8
  121. data/sig/terminal-shop/errors.rbs +17 -17
  122. data/sig/terminal-shop/models/address.rbs +11 -15
  123. data/sig/terminal-shop/models/address_create_params.rbs +11 -16
  124. data/sig/terminal-shop/models/address_create_response.rbs +1 -6
  125. data/sig/terminal-shop/models/address_delete_params.rbs +1 -6
  126. data/sig/terminal-shop/models/address_delete_response.rbs +1 -6
  127. data/sig/terminal-shop/models/address_get_params.rbs +1 -6
  128. data/sig/terminal-shop/models/address_get_response.rbs +1 -6
  129. data/sig/terminal-shop/models/address_list_params.rbs +1 -6
  130. data/sig/terminal-shop/models/address_list_response.rbs +1 -6
  131. data/sig/terminal-shop/models/app.rbs +6 -5
  132. data/sig/terminal-shop/models/app_create_params.rbs +5 -10
  133. data/sig/terminal-shop/models/app_create_response.rbs +4 -12
  134. data/sig/terminal-shop/models/app_delete_params.rbs +1 -6
  135. data/sig/terminal-shop/models/app_delete_response.rbs +1 -6
  136. data/sig/terminal-shop/models/app_get_params.rbs +1 -5
  137. data/sig/terminal-shop/models/app_get_response.rbs +1 -5
  138. data/sig/terminal-shop/models/app_list_params.rbs +1 -5
  139. data/sig/terminal-shop/models/app_list_response.rbs +1 -6
  140. data/sig/terminal-shop/models/card.rbs +7 -16
  141. data/sig/terminal-shop/models/card_collect_params.rbs +1 -6
  142. data/sig/terminal-shop/models/card_collect_response.rbs +4 -12
  143. data/sig/terminal-shop/models/card_create_params.rbs +4 -6
  144. data/sig/terminal-shop/models/card_create_response.rbs +1 -6
  145. data/sig/terminal-shop/models/card_delete_params.rbs +1 -6
  146. data/sig/terminal-shop/models/card_delete_response.rbs +1 -6
  147. data/sig/terminal-shop/models/card_get_params.rbs +1 -5
  148. data/sig/terminal-shop/models/card_get_response.rbs +1 -6
  149. data/sig/terminal-shop/models/card_list_params.rbs +1 -5
  150. data/sig/terminal-shop/models/card_list_response.rbs +1 -6
  151. data/sig/terminal-shop/models/cart.rbs +20 -34
  152. data/sig/terminal-shop/models/cart_clear_params.rbs +1 -6
  153. data/sig/terminal-shop/models/cart_clear_response.rbs +1 -6
  154. data/sig/terminal-shop/models/cart_convert_params.rbs +1 -6
  155. data/sig/terminal-shop/models/cart_convert_response.rbs +1 -6
  156. data/sig/terminal-shop/models/cart_get_params.rbs +1 -5
  157. data/sig/terminal-shop/models/cart_get_response.rbs +1 -6
  158. data/sig/terminal-shop/models/cart_set_address_params.rbs +4 -9
  159. data/sig/terminal-shop/models/cart_set_address_response.rbs +1 -6
  160. data/sig/terminal-shop/models/cart_set_card_params.rbs +4 -6
  161. data/sig/terminal-shop/models/cart_set_card_response.rbs +1 -6
  162. data/sig/terminal-shop/models/cart_set_item_params.rbs +5 -10
  163. data/sig/terminal-shop/models/cart_set_item_response.rbs +1 -6
  164. data/sig/terminal-shop/models/email_create_params.rbs +4 -6
  165. data/sig/terminal-shop/models/email_create_response.rbs +1 -6
  166. data/sig/terminal-shop/models/order.rbs +31 -50
  167. data/sig/terminal-shop/models/order_create_params.rbs +6 -11
  168. data/sig/terminal-shop/models/order_create_response.rbs +1 -6
  169. data/sig/terminal-shop/models/order_get_params.rbs +1 -5
  170. data/sig/terminal-shop/models/order_get_response.rbs +1 -6
  171. data/sig/terminal-shop/models/order_list_params.rbs +1 -6
  172. data/sig/terminal-shop/models/order_list_response.rbs +1 -6
  173. data/sig/terminal-shop/models/product.rbs +20 -27
  174. data/sig/terminal-shop/models/product_get_params.rbs +1 -6
  175. data/sig/terminal-shop/models/product_get_response.rbs +1 -6
  176. data/sig/terminal-shop/models/product_list_params.rbs +1 -6
  177. data/sig/terminal-shop/models/product_list_response.rbs +1 -6
  178. data/sig/terminal-shop/models/product_variant.rbs +1 -5
  179. data/sig/terminal-shop/models/profile.rbs +8 -17
  180. data/sig/terminal-shop/models/profile_me_params.rbs +1 -6
  181. data/sig/terminal-shop/models/profile_me_response.rbs +1 -6
  182. data/sig/terminal-shop/models/profile_update_params.rbs +5 -10
  183. data/sig/terminal-shop/models/profile_update_response.rbs +1 -6
  184. data/sig/terminal-shop/models/region.rbs +4 -2
  185. data/sig/terminal-shop/models/subscription.rbs +15 -27
  186. data/sig/terminal-shop/models/subscription_create_params.rbs +1 -6
  187. data/sig/terminal-shop/models/subscription_create_response.rbs +1 -6
  188. data/sig/terminal-shop/models/subscription_delete_params.rbs +1 -6
  189. data/sig/terminal-shop/models/subscription_delete_response.rbs +1 -6
  190. data/sig/terminal-shop/models/subscription_get_params.rbs +1 -6
  191. data/sig/terminal-shop/models/subscription_get_response.rbs +1 -6
  192. data/sig/terminal-shop/models/subscription_list_params.rbs +1 -6
  193. data/sig/terminal-shop/models/subscription_list_response.rbs +3 -6
  194. data/sig/terminal-shop/models/token.rbs +1 -5
  195. data/sig/terminal-shop/models/token_create_params.rbs +1 -6
  196. data/sig/terminal-shop/models/token_create_response.rbs +4 -12
  197. data/sig/terminal-shop/models/token_delete_params.rbs +1 -6
  198. data/sig/terminal-shop/models/token_delete_response.rbs +1 -6
  199. data/sig/terminal-shop/models/token_get_params.rbs +1 -5
  200. data/sig/terminal-shop/models/token_get_response.rbs +1 -6
  201. data/sig/terminal-shop/models/token_list_params.rbs +1 -6
  202. data/sig/terminal-shop/models/token_list_response.rbs +1 -6
  203. data/sig/terminal-shop/models/view_init_params.rbs +1 -5
  204. data/sig/terminal-shop/models/view_init_response.rbs +15 -23
  205. data/sig/terminal-shop/pooled_net_requester.rbs +3 -1
  206. data/sig/terminal-shop/request_options.rbs +2 -2
  207. data/sig/terminal-shop/resources/address.rbs +22 -41
  208. data/sig/terminal-shop/resources/app.rbs +16 -34
  209. data/sig/terminal-shop/resources/card.rbs +18 -40
  210. data/sig/terminal-shop/resources/cart.rbs +22 -47
  211. data/sig/terminal-shop/resources/email.rbs +4 -8
  212. data/sig/terminal-shop/resources/order.rbs +13 -26
  213. data/sig/terminal-shop/resources/product.rbs +7 -16
  214. data/sig/terminal-shop/resources/profile.rbs +8 -16
  215. data/sig/terminal-shop/resources/subscription.rbs +21 -43
  216. data/sig/terminal-shop/resources/token.rbs +14 -32
  217. data/sig/terminal-shop/resources/view.rbs +3 -7
  218. data/sig/terminal-shop/util.rbs +5 -5
  219. data/sig/terminal-shop/version.rbs +1 -1
  220. metadata +2 -2
@@ -3,6 +3,10 @@
3
3
  module TerminalShop
4
4
  # @api private
5
5
  module Util
6
+ # Due to the current WIP status of Shapes support in Sorbet, types referencing
7
+ # this alias might be refined in the future.
8
+ AnyHash = T.type_alias { T::Hash[Symbol, T.anything] }
9
+
6
10
  # @api private
7
11
  sig { returns(Float) }
8
12
  def self.monotonic_secs
@@ -52,6 +56,11 @@ module TerminalShop
52
56
  end
53
57
  end
54
58
 
59
+ # Use this to indicate that a value should be explicitly removed from a data
60
+ # structure when using `TerminalShop::Util.deep_merge`.
61
+ #
62
+ # e.g. merging `{a: 1}` and `{a: OMIT}` should produce `{}`, where merging
63
+ # `{a: 1}` and `{}` would produce `{a: 1}`.
55
64
  OMIT = T.let(T.anything, T.anything)
56
65
 
57
66
  class << self
@@ -80,7 +89,7 @@ module TerminalShop
80
89
  # @api private
81
90
  sig do
82
91
  params(
83
- data: T.any(T::Hash[Symbol, T.anything], T::Array[T.anything], T.anything),
92
+ data: T.any(TerminalShop::Util::AnyHash, T::Array[T.anything], T.anything),
84
93
  pick: T.nilable(T.any(Symbol, Integer, T::Array[T.any(Symbol, Integer)])),
85
94
  sentinel: T.nilable(T.anything),
86
95
  blk: T.nilable(T.proc.returns(T.anything))
@@ -118,15 +127,16 @@ module TerminalShop
118
127
  end
119
128
  end
120
129
 
121
- ParsedUriShape = T.type_alias do
122
- {
123
- scheme: T.nilable(String),
124
- host: T.nilable(String),
125
- port: T.nilable(Integer),
126
- path: T.nilable(String),
127
- query: T::Hash[String, T::Array[String]]
128
- }
129
- end
130
+ ParsedUriShape =
131
+ T.type_alias do
132
+ {
133
+ scheme: T.nilable(String),
134
+ host: T.nilable(String),
135
+ port: T.nilable(Integer),
136
+ path: T.nilable(String),
137
+ query: T::Hash[String, T::Array[String]]
138
+ }
139
+ end
130
140
 
131
141
  class << self
132
142
  # @api private
@@ -249,9 +259,10 @@ module TerminalShop
249
259
  end
250
260
  end
251
261
 
252
- ServerSentEvent = T.type_alias do
253
- {event: T.nilable(String), data: T.nilable(String), id: T.nilable(String), retry: T.nilable(Integer)}
254
- end
262
+ ServerSentEvent =
263
+ T.type_alias do
264
+ {event: T.nilable(String), data: T.nilable(String), id: T.nilable(String), retry: T.nilable(Integer)}
265
+ end
255
266
 
256
267
  class << self
257
268
  # @api private
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module TerminalShop
4
- VERSION = "1.8.0"
4
+ VERSION = "2.0.0"
5
5
  end
@@ -55,14 +55,14 @@ module TerminalShop
55
55
 
56
56
  def initialize: (
57
57
  base_url: String,
58
- timeout: Float,
59
- max_retries: Integer,
60
- initial_retry_delay: Float,
61
- max_retry_delay: Float,
62
- headers: ::Hash[String, (String
58
+ ?timeout: Float,
59
+ ?max_retries: Integer,
60
+ ?initial_retry_delay: Float,
61
+ ?max_retry_delay: Float,
62
+ ?headers: ::Hash[String, (String
63
63
  | Integer
64
64
  | ::Array[(String | Integer)?])?],
65
- idempotency_header: String?
65
+ ?idempotency_header: String?
66
66
  ) -> void
67
67
 
68
68
  private def auth_headers: -> ::Hash[String, String]
@@ -90,16 +90,16 @@ module TerminalShop
90
90
  (
91
91
  Symbol method,
92
92
  String | ::Array[String] path,
93
- query: ::Hash[String, (::Array[String] | String)?]?,
94
- headers: ::Hash[String, (String
93
+ ?query: ::Hash[String, (::Array[String] | String)?]?,
94
+ ?headers: ::Hash[String, (String
95
95
  | Integer
96
96
  | ::Array[(String | Integer)?])?]?,
97
- body: top?,
98
- unwrap: Symbol?,
99
- page: Class?,
100
- stream: Class?,
101
- model: TerminalShop::Converter::input?,
102
- options: TerminalShop::request_opts?
97
+ ?body: top?,
98
+ ?unwrap: Symbol?,
99
+ ?page: Class?,
100
+ ?stream: Class?,
101
+ ?model: TerminalShop::Converter::input?,
102
+ ?options: TerminalShop::request_opts?
103
103
  ) -> top
104
104
  | (TerminalShop::BaseClient::request_components req) -> top
105
105
 
@@ -62,28 +62,28 @@ module TerminalShop
62
62
  ) -> ([true, top, nil] | [false, bool, Integer])
63
63
  end
64
64
 
65
- class Enum
66
- extend TerminalShop::Converter
65
+ module Enum
66
+ include TerminalShop::Converter
67
67
 
68
68
  def self.values: -> ::Array[(nil | bool | Integer | Float | Symbol)]
69
69
 
70
70
  private def self.finalize!: -> void
71
71
 
72
- def self.===: (top other) -> bool
72
+ def ===: (top other) -> bool
73
73
 
74
- def self.==: (top other) -> bool
74
+ def ==: (top other) -> bool
75
75
 
76
- def self.coerce: (String | Symbol | top value) -> (Symbol | top)
76
+ def coerce: (String | Symbol | top value) -> (Symbol | top)
77
77
 
78
- def self.dump: (Symbol | top value) -> (Symbol | top)
78
+ def dump: (Symbol | top value) -> (Symbol | top)
79
79
 
80
- def self.try_strict_coerce: (
80
+ def try_strict_coerce: (
81
81
  top value
82
82
  ) -> ([true, top, nil] | [false, bool, Integer])
83
83
  end
84
84
 
85
- class Union
86
- extend TerminalShop::Converter
85
+ module Union
86
+ include TerminalShop::Converter
87
87
 
88
88
  private def self.known_variants: -> ::Array[[Symbol?, (^-> TerminalShop::Converter::input)]]
89
89
 
@@ -107,22 +107,29 @@ module TerminalShop
107
107
  top value
108
108
  ) -> TerminalShop::Converter::input?
109
109
 
110
- def self.===: (top other) -> bool
110
+ def ===: (top other) -> bool
111
111
 
112
- def self.==: (top other) -> bool
112
+ def ==: (top other) -> bool
113
113
 
114
- def self.coerce: (top value) -> top
114
+ def coerce: (top value) -> top
115
115
 
116
- def self.dump: (top value) -> top
116
+ def dump: (top value) -> top
117
117
 
118
- def self.try_strict_coerce: (
118
+ def try_strict_coerce: (
119
119
  top value
120
120
  ) -> ([true, top, nil] | [false, bool, Integer])
121
121
  end
122
122
 
123
- class ArrayOf[Elem]
123
+ class ArrayOf
124
124
  include TerminalShop::Converter
125
125
 
126
+ def self.[]: (
127
+ ::Hash[Symbol, top]
128
+ | ^-> TerminalShop::Converter::input
129
+ | TerminalShop::Converter::input type_info,
130
+ ?::Hash[Symbol, top] spec
131
+ ) -> instance
132
+
126
133
  def ===: (top other) -> bool
127
134
 
128
135
  def ==: (top other) -> bool
@@ -135,7 +142,7 @@ module TerminalShop
135
142
  top value
136
143
  ) -> ([true, top, nil] | [false, bool, Integer])
137
144
 
138
- def item_type: -> Elem
145
+ def item_type: -> top
139
146
 
140
147
  def initialize: (
141
148
  ::Hash[Symbol, top]
@@ -145,9 +152,16 @@ module TerminalShop
145
152
  ) -> void
146
153
  end
147
154
 
148
- class HashOf[Elem]
155
+ class HashOf
149
156
  include TerminalShop::Converter
150
157
 
158
+ def self.[]: (
159
+ ::Hash[Symbol, top]
160
+ | ^-> TerminalShop::Converter::input
161
+ | TerminalShop::Converter::input type_info,
162
+ ?::Hash[Symbol, top] spec
163
+ ) -> instance
164
+
151
165
  def ===: (top other) -> bool
152
166
 
153
167
  def ==: (top other) -> bool
@@ -160,7 +174,7 @@ module TerminalShop
160
174
  top value
161
175
  ) -> ([true, top, nil] | [false, bool, Integer])
162
176
 
163
- def item_type: -> Elem
177
+ def item_type: -> top
164
178
 
165
179
  def initialize: (
166
180
  ::Hash[Symbol, top]
@@ -178,6 +192,8 @@ module TerminalShop
178
192
  def self.known_fields: -> ::Hash[Symbol, (TerminalShop::BaseModel::known_field
179
193
  & { type_fn: (^-> TerminalShop::Converter::input) })]
180
194
 
195
+ def self.reverse_map: -> ::Hash[Symbol, Symbol]
196
+
181
197
  def self.fields: -> ::Hash[Symbol, (TerminalShop::BaseModel::known_field
182
198
  & { type: TerminalShop::Converter::input })]
183
199
 
@@ -42,14 +42,14 @@ module TerminalShop
42
42
  private def auth_headers: -> ::Hash[String, String]
43
43
 
44
44
  def initialize: (
45
- environment: :production | :dev | nil,
46
- base_url: String?,
47
- bearer_token: String?,
48
- app_id: String?,
49
- max_retries: Integer,
50
- timeout: Float,
51
- initial_retry_delay: Float,
52
- max_retry_delay: Float
45
+ ?environment: :production | :dev | nil,
46
+ ?base_url: String?,
47
+ ?bearer_token: String?,
48
+ ?app_id: String?,
49
+ ?max_retries: Integer,
50
+ ?timeout: Float,
51
+ ?initial_retry_delay: Float,
52
+ ?max_retry_delay: Float
53
53
  ) -> void
54
54
  end
55
55
  end
@@ -15,33 +15,33 @@ module TerminalShop
15
15
 
16
16
  def initialize: (
17
17
  url: URI::Generic,
18
- status: Integer?,
19
- body: Object?,
20
- request: nil,
21
- response: nil,
22
- message: String?
18
+ ?status: Integer?,
19
+ ?body: Object?,
20
+ ?request: nil,
21
+ ?response: nil,
22
+ ?message: String?
23
23
  ) -> void
24
24
  end
25
25
 
26
26
  class APIConnectionError < TerminalShop::APIError
27
27
  def initialize: (
28
28
  url: URI::Generic,
29
- status: nil,
30
- body: nil,
31
- request: nil,
32
- response: nil,
33
- message: String?
29
+ ?status: nil,
30
+ ?body: nil,
31
+ ?request: nil,
32
+ ?response: nil,
33
+ ?message: String?
34
34
  ) -> void
35
35
  end
36
36
 
37
37
  class APITimeoutError < TerminalShop::APIConnectionError
38
38
  def initialize: (
39
39
  url: URI::Generic,
40
- status: nil,
41
- body: nil,
42
- request: nil,
43
- response: nil,
44
- message: String?
40
+ ?status: nil,
41
+ ?body: nil,
42
+ ?request: nil,
43
+ ?response: nil,
44
+ ?message: String?
45
45
  ) -> void
46
46
  end
47
47
 
@@ -52,7 +52,7 @@ module TerminalShop
52
52
  body: Object?,
53
53
  request: nil,
54
54
  response: nil,
55
- message: String?
55
+ ?message: String?
56
56
  ) -> instance
57
57
 
58
58
  def initialize: (
@@ -61,7 +61,7 @@ module TerminalShop
61
61
  body: Object?,
62
62
  request: nil,
63
63
  response: nil,
64
- message: String?
64
+ ?message: String?
65
65
  ) -> void
66
66
  end
67
67
 
@@ -38,21 +38,17 @@ module TerminalShop
38
38
 
39
39
  def street2=: (String) -> String
40
40
 
41
- def initialize:
42
- (
43
- id: String,
44
- city: String,
45
- country: String,
46
- name: String,
47
- street1: String,
48
- zip: String,
49
- phone: String,
50
- province: String,
51
- street2: String
52
- ) -> void
53
- | (
54
- ?TerminalShop::Models::address_api | TerminalShop::BaseModel data
55
- ) -> void
41
+ def initialize: (
42
+ id: String,
43
+ city: String,
44
+ country: String,
45
+ name: String,
46
+ street1: String,
47
+ zip: String,
48
+ ?phone: String,
49
+ ?province: String,
50
+ ?street2: String
51
+ ) -> void
56
52
 
57
53
  def to_hash: -> TerminalShop::Models::address_api
58
54
  end
@@ -39,22 +39,17 @@ module TerminalShop
39
39
 
40
40
  def street2=: (String) -> String
41
41
 
42
- def initialize:
43
- (
44
- city: String,
45
- country: String,
46
- name: String,
47
- street1: String,
48
- zip: String,
49
- phone: String,
50
- province: String,
51
- street2: String,
52
- request_options: TerminalShop::request_opts
53
- ) -> void
54
- | (
55
- ?TerminalShop::Models::address_create_params
56
- | TerminalShop::BaseModel data
57
- ) -> void
42
+ def initialize: (
43
+ city: String,
44
+ country: String,
45
+ name: String,
46
+ street1: String,
47
+ zip: String,
48
+ ?phone: String,
49
+ ?province: String,
50
+ ?street2: String,
51
+ ?request_options: TerminalShop::request_opts
52
+ ) -> void
58
53
 
59
54
  def to_hash: -> TerminalShop::Models::address_create_params
60
55
  end
@@ -5,12 +5,7 @@ module TerminalShop
5
5
  class AddressCreateResponse < TerminalShop::BaseModel
6
6
  attr_accessor data: String
7
7
 
8
- def initialize:
9
- (data: String) -> void
10
- | (
11
- ?TerminalShop::Models::address_create_response
12
- | TerminalShop::BaseModel data
13
- ) -> void
8
+ def initialize: (data: String) -> void
14
9
 
15
10
  def to_hash: -> TerminalShop::Models::address_create_response
16
11
  end
@@ -6,12 +6,7 @@ module TerminalShop
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
- def initialize:
10
- (request_options: TerminalShop::request_opts) -> void
11
- | (
12
- ?TerminalShop::Models::address_delete_params
13
- | TerminalShop::BaseModel data
14
- ) -> void
9
+ def initialize: (?request_options: TerminalShop::request_opts) -> void
15
10
 
16
11
  def to_hash: -> TerminalShop::Models::address_delete_params
17
12
  end
@@ -5,12 +5,7 @@ module TerminalShop
5
5
  class AddressDeleteResponse < TerminalShop::BaseModel
6
6
  attr_accessor data: :ok
7
7
 
8
- def initialize:
9
- (data: :ok) -> void
10
- | (
11
- ?TerminalShop::Models::address_delete_response
12
- | TerminalShop::BaseModel data
13
- ) -> void
8
+ def initialize: (?data: :ok) -> void
14
9
 
15
10
  def to_hash: -> TerminalShop::Models::address_delete_response
16
11
  end
@@ -6,12 +6,7 @@ module TerminalShop
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
- def initialize:
10
- (request_options: TerminalShop::request_opts) -> void
11
- | (
12
- ?TerminalShop::Models::address_get_params
13
- | TerminalShop::BaseModel data
14
- ) -> void
9
+ def initialize: (?request_options: TerminalShop::request_opts) -> void
15
10
 
16
11
  def to_hash: -> TerminalShop::Models::address_get_params
17
12
  end
@@ -5,12 +5,7 @@ module TerminalShop
5
5
  class AddressGetResponse < TerminalShop::BaseModel
6
6
  attr_accessor data: TerminalShop::Models::AddressAPI
7
7
 
8
- def initialize:
9
- (data: TerminalShop::Models::AddressAPI) -> void
10
- | (
11
- ?TerminalShop::Models::address_get_response
12
- | TerminalShop::BaseModel data
13
- ) -> void
8
+ def initialize: (data: TerminalShop::Models::AddressAPI) -> void
14
9
 
15
10
  def to_hash: -> TerminalShop::Models::address_get_response
16
11
  end
@@ -6,12 +6,7 @@ module TerminalShop
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
- def initialize:
10
- (request_options: TerminalShop::request_opts) -> void
11
- | (
12
- ?TerminalShop::Models::address_list_params
13
- | TerminalShop::BaseModel data
14
- ) -> void
9
+ def initialize: (?request_options: TerminalShop::request_opts) -> void
15
10
 
16
11
  def to_hash: -> TerminalShop::Models::address_list_params
17
12
  end
@@ -6,12 +6,7 @@ module TerminalShop
6
6
  class AddressListResponse < TerminalShop::BaseModel
7
7
  attr_accessor data: ::Array[TerminalShop::Models::AddressAPI]
8
8
 
9
- def initialize:
10
- (data: ::Array[TerminalShop::Models::AddressAPI]) -> void
11
- | (
12
- ?TerminalShop::Models::address_list_response
13
- | TerminalShop::BaseModel data
14
- ) -> void
9
+ def initialize: (data: ::Array[TerminalShop::Models::AddressAPI]) -> void
15
10
 
16
11
  def to_hash: -> TerminalShop::Models::address_list_response
17
12
  end
@@ -12,11 +12,12 @@ module TerminalShop
12
12
 
13
13
  attr_accessor secret: String
14
14
 
15
- def initialize:
16
- (id: String, name: String, redirect_uri: String, secret: String) -> void
17
- | (
18
- ?TerminalShop::Models::app_api | TerminalShop::BaseModel data
19
- ) -> void
15
+ def initialize: (
16
+ id: String,
17
+ name: String,
18
+ redirect_uri: String,
19
+ secret: String
20
+ ) -> void
20
21
 
21
22
  def to_hash: -> TerminalShop::Models::app_api
22
23
  end
@@ -11,16 +11,11 @@ module TerminalShop
11
11
 
12
12
  attr_accessor redirect_uri: String
13
13
 
14
- def initialize:
15
- (
16
- name: String,
17
- redirect_uri: String,
18
- request_options: TerminalShop::request_opts
19
- ) -> void
20
- | (
21
- ?TerminalShop::Models::app_create_params
22
- | TerminalShop::BaseModel data
23
- ) -> void
14
+ def initialize: (
15
+ name: String,
16
+ redirect_uri: String,
17
+ ?request_options: TerminalShop::request_opts
18
+ ) -> void
24
19
 
25
20
  def to_hash: -> TerminalShop::Models::app_create_params
26
21
  end
@@ -6,12 +6,9 @@ module TerminalShop
6
6
  class AppCreateResponse < TerminalShop::BaseModel
7
7
  attr_accessor data: TerminalShop::Models::AppCreateResponse::Data
8
8
 
9
- def initialize:
10
- (data: TerminalShop::Models::AppCreateResponse::Data) -> void
11
- | (
12
- ?TerminalShop::Models::app_create_response
13
- | TerminalShop::BaseModel data
14
- ) -> void
9
+ def initialize: (
10
+ data: TerminalShop::Models::AppCreateResponse::Data
11
+ ) -> void
15
12
 
16
13
  def to_hash: -> TerminalShop::Models::app_create_response
17
14
 
@@ -22,12 +19,7 @@ module TerminalShop
22
19
 
23
20
  attr_accessor secret: String
24
21
 
25
- def initialize:
26
- (id: String, secret: String) -> void
27
- | (
28
- ?TerminalShop::Models::AppCreateResponse::data
29
- | TerminalShop::BaseModel data
30
- ) -> void
22
+ def initialize: (id: String, secret: String) -> void
31
23
 
32
24
  def to_hash: -> TerminalShop::Models::AppCreateResponse::data
33
25
  end
@@ -6,12 +6,7 @@ module TerminalShop
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
- def initialize:
10
- (request_options: TerminalShop::request_opts) -> void
11
- | (
12
- ?TerminalShop::Models::app_delete_params
13
- | TerminalShop::BaseModel data
14
- ) -> void
9
+ def initialize: (?request_options: TerminalShop::request_opts) -> void
15
10
 
16
11
  def to_hash: -> TerminalShop::Models::app_delete_params
17
12
  end
@@ -5,12 +5,7 @@ module TerminalShop
5
5
  class AppDeleteResponse < TerminalShop::BaseModel
6
6
  attr_accessor data: :ok
7
7
 
8
- def initialize:
9
- (data: :ok) -> void
10
- | (
11
- ?TerminalShop::Models::app_delete_response
12
- | TerminalShop::BaseModel data
13
- ) -> void
8
+ def initialize: (?data: :ok) -> void
14
9
 
15
10
  def to_hash: -> TerminalShop::Models::app_delete_response
16
11
  end
@@ -6,11 +6,7 @@ module TerminalShop
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
- def initialize:
10
- (request_options: TerminalShop::request_opts) -> void
11
- | (
12
- ?TerminalShop::Models::app_get_params | TerminalShop::BaseModel data
13
- ) -> void
9
+ def initialize: (?request_options: TerminalShop::request_opts) -> void
14
10
 
15
11
  def to_hash: -> TerminalShop::Models::app_get_params
16
12
  end
@@ -5,11 +5,7 @@ module TerminalShop
5
5
  class AppGetResponse < TerminalShop::BaseModel
6
6
  attr_accessor data: TerminalShop::Models::AppAPI
7
7
 
8
- def initialize:
9
- (data: TerminalShop::Models::AppAPI) -> void
10
- | (
11
- ?TerminalShop::Models::app_get_response | TerminalShop::BaseModel data
12
- ) -> void
8
+ def initialize: (data: TerminalShop::Models::AppAPI) -> void
13
9
 
14
10
  def to_hash: -> TerminalShop::Models::app_get_response
15
11
  end
@@ -6,11 +6,7 @@ module TerminalShop
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
- def initialize:
10
- (request_options: TerminalShop::request_opts) -> void
11
- | (
12
- ?TerminalShop::Models::app_list_params | TerminalShop::BaseModel data
13
- ) -> void
9
+ def initialize: (?request_options: TerminalShop::request_opts) -> void
14
10
 
15
11
  def to_hash: -> TerminalShop::Models::app_list_params
16
12
  end
@@ -5,12 +5,7 @@ module TerminalShop
5
5
  class AppListResponse < TerminalShop::BaseModel
6
6
  attr_accessor data: ::Array[TerminalShop::Models::AppAPI]
7
7
 
8
- def initialize:
9
- (data: ::Array[TerminalShop::Models::AppAPI]) -> void
10
- | (
11
- ?TerminalShop::Models::app_list_response
12
- | TerminalShop::BaseModel data
13
- ) -> void
8
+ def initialize: (data: ::Array[TerminalShop::Models::AppAPI]) -> void
14
9
 
15
10
  def to_hash: -> TerminalShop::Models::app_list_response
16
11
  end