terminal-shop 0.1.0.pre.alpha.6 → 0.1.0.pre.alpha.9

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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/terminal-shop/base_client.rb +11 -7
  4. data/lib/terminal-shop/base_model.rb +8 -8
  5. data/lib/terminal-shop/client.rb +5 -3
  6. data/lib/terminal-shop/models/subscription.rb +78 -1
  7. data/lib/terminal-shop/resources/subscription.rb +2 -0
  8. data/lib/terminal-shop/util.rb +13 -20
  9. data/lib/terminal-shop/version.rb +1 -1
  10. data/rbi/lib/terminal-shop/base_client.rbi +6 -3
  11. data/rbi/lib/terminal-shop/client.rbi +26 -14
  12. data/rbi/lib/terminal-shop/errors.rbi +14 -7
  13. data/rbi/lib/terminal-shop/models/address.rbi +51 -15
  14. data/rbi/lib/terminal-shop/models/address_create_params.rbi +45 -14
  15. data/rbi/lib/terminal-shop/models/address_create_response.rbi +6 -1
  16. data/rbi/lib/terminal-shop/models/address_delete_response.rbi +6 -1
  17. data/rbi/lib/terminal-shop/models/address_list_response.rbi +8 -1
  18. data/rbi/lib/terminal-shop/models/app.rbi +18 -3
  19. data/rbi/lib/terminal-shop/models/app_create_response.rbi +20 -3
  20. data/rbi/lib/terminal-shop/models/app_delete_response.rbi +6 -1
  21. data/rbi/lib/terminal-shop/models/app_get_response.rbi +6 -1
  22. data/rbi/lib/terminal-shop/models/app_list_response.rbi +8 -1
  23. data/rbi/lib/terminal-shop/models/card.rbi +38 -6
  24. data/rbi/lib/terminal-shop/models/card_collect_response.rbi +14 -2
  25. data/rbi/lib/terminal-shop/models/card_create_params.rbi +6 -1
  26. data/rbi/lib/terminal-shop/models/card_create_response.rbi +6 -1
  27. data/rbi/lib/terminal-shop/models/card_delete_response.rbi +6 -1
  28. data/rbi/lib/terminal-shop/models/card_list_response.rbi +8 -1
  29. data/rbi/lib/terminal-shop/models/cart.rbi +82 -26
  30. data/rbi/lib/terminal-shop/models/cart_convert_response.rbi +6 -1
  31. data/rbi/lib/terminal-shop/models/cart_get_response.rbi +6 -1
  32. data/rbi/lib/terminal-shop/models/cart_set_address_params.rbi +6 -1
  33. data/rbi/lib/terminal-shop/models/cart_set_address_response.rbi +6 -1
  34. data/rbi/lib/terminal-shop/models/cart_set_card_params.rbi +6 -1
  35. data/rbi/lib/terminal-shop/models/cart_set_card_response.rbi +6 -1
  36. data/rbi/lib/terminal-shop/models/cart_set_item_params.rbi +12 -2
  37. data/rbi/lib/terminal-shop/models/cart_set_item_response.rbi +6 -1
  38. data/rbi/lib/terminal-shop/models/email_create_params.rbi +6 -1
  39. data/rbi/lib/terminal-shop/models/email_create_response.rbi +6 -1
  40. data/rbi/lib/terminal-shop/models/order.rbi +143 -42
  41. data/rbi/lib/terminal-shop/models/order_get_response.rbi +6 -1
  42. data/rbi/lib/terminal-shop/models/order_list_response.rbi +8 -1
  43. data/rbi/lib/terminal-shop/models/product.rbi +47 -14
  44. data/rbi/lib/terminal-shop/models/product_list_response.rbi +8 -1
  45. data/rbi/lib/terminal-shop/models/product_variant.rbi +18 -3
  46. data/rbi/lib/terminal-shop/models/profile.rbi +38 -6
  47. data/rbi/lib/terminal-shop/models/profile_me_response.rbi +6 -1
  48. data/rbi/lib/terminal-shop/models/profile_update_params.rbi +12 -2
  49. data/rbi/lib/terminal-shop/models/profile_update_response.rbi +6 -1
  50. data/rbi/lib/terminal-shop/models/subscription.rbi +147 -12
  51. data/rbi/lib/terminal-shop/models/subscription_create_response.rbi +6 -1
  52. data/rbi/lib/terminal-shop/models/subscription_delete_response.rbi +6 -1
  53. data/rbi/lib/terminal-shop/models/subscription_list_response.rbi +8 -1
  54. data/rbi/lib/terminal-shop/models/token.rbi +24 -4
  55. data/rbi/lib/terminal-shop/models/token_create_response.rbi +20 -3
  56. data/rbi/lib/terminal-shop/models/token_delete_response.rbi +6 -1
  57. data/rbi/lib/terminal-shop/models/token_get_response.rbi +6 -1
  58. data/rbi/lib/terminal-shop/models/token_list_response.rbi +8 -1
  59. data/rbi/lib/terminal-shop/models/view_init_response.rbi +76 -10
  60. data/rbi/lib/terminal-shop/request_options.rbi +69 -7
  61. data/rbi/lib/terminal-shop/resources/subscription.rbi +5 -0
  62. data/rbi/lib/terminal-shop/util.rbi +6 -1
  63. data/rbi/lib/terminal-shop/version.rbi +1 -1
  64. data/sig/terminal-shop/base_client.rbs +13 -13
  65. data/sig/terminal-shop/base_model.rbs +26 -26
  66. data/sig/terminal-shop/base_page.rbs +1 -1
  67. data/sig/terminal-shop/client.rbs +3 -3
  68. data/sig/terminal-shop/models/address.rbs +3 -3
  69. data/sig/terminal-shop/models/address_create_params.rbs +3 -3
  70. data/sig/terminal-shop/models/address_list_response.rbs +3 -3
  71. data/sig/terminal-shop/models/app_list_response.rbs +3 -3
  72. data/sig/terminal-shop/models/card_list_response.rbs +3 -3
  73. data/sig/terminal-shop/models/cart.rbs +11 -9
  74. data/sig/terminal-shop/models/order.rbs +12 -12
  75. data/sig/terminal-shop/models/order_list_response.rbs +3 -3
  76. data/sig/terminal-shop/models/product.rbs +14 -14
  77. data/sig/terminal-shop/models/product_list_response.rbs +3 -3
  78. data/sig/terminal-shop/models/subscription.rbs +52 -4
  79. data/sig/terminal-shop/models/subscription_list_response.rbs +3 -3
  80. data/sig/terminal-shop/models/token_list_response.rbs +3 -3
  81. data/sig/terminal-shop/models/view_init_response.rbs +21 -21
  82. data/sig/terminal-shop/request_options.rbs +9 -9
  83. data/sig/terminal-shop/resources/address.rbs +4 -3
  84. data/sig/terminal-shop/resources/app.rbs +4 -4
  85. data/sig/terminal-shop/resources/card.rbs +4 -4
  86. data/sig/terminal-shop/resources/cart.rbs +6 -5
  87. data/sig/terminal-shop/resources/email.rbs +1 -1
  88. data/sig/terminal-shop/resources/order.rbs +2 -2
  89. data/sig/terminal-shop/resources/product.rbs +1 -1
  90. data/sig/terminal-shop/resources/profile.rbs +3 -2
  91. data/sig/terminal-shop/resources/subscription.rbs +4 -3
  92. data/sig/terminal-shop/resources/token.rbs +4 -4
  93. data/sig/terminal-shop/resources/view.rbs +1 -1
  94. data/sig/terminal-shop/util.rbs +12 -12
  95. data/sig/terminal-shop/version.rbs +1 -1
  96. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57c76c0706cc0ac7c7f3721e93f81a5736151f216a1c7d75d0ebd5208108a1b1
4
- data.tar.gz: 555e6ad0a93b697aea3913ba9dfe7405301326d6f8ad95fb04b89e53a671bd22
3
+ metadata.gz: a7302bc4cca8faceca8577dce4b9b10362963e1d51e24657389a8c663376299e
4
+ data.tar.gz: 2fd2e9b55fc3c9ba9f4038a44e6bf71e18a49d1d4186a44031ffbe2e43be1fe7
5
5
  SHA512:
6
- metadata.gz: 22e0a17d4bd138846272ee720cece9523b1e218119dfb316e58ba2b76f00994d702e5922a5fe2aa1e3755e85616d98a6b5b56675ac7d9b58758d066339bcde54
7
- data.tar.gz: f7e5686301b9ab66da74361d30cd073f21c1532265524ce63904b90932373a6dc1fe4b6938c7c78d5f8058ad203a0f664960eb5acffdcdf586265fc063ddffa5
6
+ metadata.gz: 0f8be58ee44eddefe127293b9423358e625982a33a00d83076f23acfcb5845bb27633e0ee6820fe1b7c7915bfdad29a9b40db3a971cf74490082e5cc0573189d
7
+ data.tar.gz: 6bff5193dcd2072b584d1a6ff52d4bf7173c66ff6d2568665fcd1c1a7a73e536718fd90c4f393574c579f8a368afeb547ff83bb2475493c25de5917a4d753280
data/README.md CHANGED
@@ -41,7 +41,7 @@ require "terminal-shop"
41
41
 
42
42
  terminal = TerminalShop::Client.new(
43
43
  bearer_token: "My Bearer Token", # defaults to ENV["TERMINAL_BEARER_TOKEN"]
44
- environment: "sandbox" # defaults to "production"
44
+ environment: "dev" # defaults to "production"
45
45
  )
46
46
 
47
47
  product = terminal.product.list
@@ -126,10 +126,16 @@ module TerminalShop
126
126
 
127
127
  path = TerminalShop::Util.interpolate_path(uninterpolated_path)
128
128
 
129
+ query = TerminalShop::Util.deep_merge(
130
+ req[:query].to_h,
131
+ opts[:extra_query].to_h
132
+ )
133
+
129
134
  headers = TerminalShop::Util.normalized_headers(
130
135
  @headers,
131
136
  auth_headers,
132
- *[req[:headers], opts[:extra_headers]].compact
137
+ req[:headers].to_h,
138
+ opts[:extra_headers].to_h
133
139
  )
134
140
 
135
141
  if @idempotency_header &&
@@ -157,7 +163,7 @@ module TerminalShop
157
163
  TerminalShop::Util.deep_merge(*[req[:body], opts[:extra_body]].compact)
158
164
  end
159
165
 
160
- url = TerminalShop::Util.join_parsed_uri(@base_url, {**req, path: path})
166
+ url = TerminalShop::Util.join_parsed_uri(@base_url, {**req, path: path, query: query})
161
167
  headers, encoded = TerminalShop::Util.encode_content(headers, body)
162
168
  max_retries = opts.fetch(:max_retries, @max_retries)
163
169
  {method: method, url: url, headers: headers, body: encoded, max_retries: max_retries, timeout: timeout}
@@ -387,12 +393,10 @@ module TerminalShop
387
393
  parsed = TerminalShop::Util.decode_content(response)
388
394
  unwrapped = TerminalShop::Util.dig(parsed, req[:unwrap])
389
395
 
390
- page = req[:page]
391
- model = req.fetch(:model, TerminalShop::Unknown)
392
- case [page, model]
393
- in [Class, Class | TerminalShop::Converter | nil]
396
+ case [req[:page], req.fetch(:model, TerminalShop::Unknown)]
397
+ in [Class => page, _]
394
398
  page.new(client: self, req: req, headers: response, unwrapped: unwrapped)
395
- in [nil, Class | TerminalShop::Converter]
399
+ in [nil, Class | TerminalShop::Converter => model]
396
400
  TerminalShop::Converter.coerce(model, unwrapped)
397
401
  in [nil, nil]
398
402
  unwrapped
@@ -586,7 +586,7 @@ module TerminalShop
586
586
  case other
587
587
  in Array
588
588
  # rubocop:disable Style/CaseEquality
589
- other.all? { |item| type === item }
589
+ other.all? { type === _1 }
590
590
  # rubocop:enable Style/CaseEquality
591
591
  else
592
592
  false
@@ -609,7 +609,7 @@ module TerminalShop
609
609
  type = item_type
610
610
  case value
611
611
  in Enumerable unless value.is_a?(Hash)
612
- value.map { |item| TerminalShop::Converter.coerce(type, item) }
612
+ value.map { TerminalShop::Converter.coerce(type, _1) }
613
613
  else
614
614
  value
615
615
  end
@@ -625,7 +625,7 @@ module TerminalShop
625
625
  type = item_type
626
626
  case value
627
627
  in Enumerable unless value.is_a?(Hash)
628
- value.map { |item| TerminalShop::Converter.dump(type, item) }.to_a
628
+ value.map { TerminalShop::Converter.dump(type, _1) }.to_a
629
629
  else
630
630
  value
631
631
  end
@@ -906,7 +906,7 @@ module TerminalShop
906
906
  setter = "#{name_sym}="
907
907
 
908
908
  if known_fields.key?(name_sym)
909
- [name_sym, setter].each { |name| undef_method(name) }
909
+ [name_sym, setter].each { undef_method(_1) }
910
910
  end
911
911
 
912
912
  known_fields[name_sym] = {mode: @mode, key: key, required: required, type_fn: type_fn}
@@ -1015,8 +1015,8 @@ module TerminalShop
1015
1015
  # @return [TerminalShop::BaseModel, Object]
1016
1016
  #
1017
1017
  def self.coerce(value)
1018
- case (coerced = TerminalShop::Util.coerce_hash(value))
1019
- in Hash
1018
+ case TerminalShop::Util.coerce_hash(value)
1019
+ in Hash => coerced
1020
1020
  new(coerced)
1021
1021
  else
1022
1022
  value
@@ -1166,8 +1166,8 @@ module TerminalShop
1166
1166
  # @param data [Hash{Symbol=>Object}, TerminalShop::BaseModel]
1167
1167
  #
1168
1168
  def initialize(data = {})
1169
- case (coerced = TerminalShop::Util.coerce_hash(data))
1170
- in Hash
1169
+ case TerminalShop::Util.coerce_hash(data)
1170
+ in Hash => coerced
1171
1171
  @data = coerced.transform_keys(&:to_sym)
1172
1172
  else
1173
1173
  raise ArgumentError.new("Expected a #{Hash} or #{TerminalShop::BaseModel}, got #{data.inspect}")
@@ -16,7 +16,7 @@ module TerminalShop
16
16
  DEFAULT_MAX_RETRY_DELAY = 8.0
17
17
 
18
18
  # rubocop:disable Style/MutableConstant
19
- ENVIRONMENTS = {production: "https://api.terminal.shop/", sandbox: "https://sandbox.terminal.shop/"}
19
+ ENVIRONMENTS = {production: "https://api.terminal.shop/", dev: "https://api.dev.terminal.shop/"}
20
20
  # rubocop:enable Style/MutableConstant
21
21
 
22
22
  # Client option
@@ -61,17 +61,19 @@ module TerminalShop
61
61
  # @return [Hash{String=>String}]
62
62
  #
63
63
  private def auth_headers
64
+ return {} if @bearer_token.nil?
65
+
64
66
  {"Authorization" => "Bearer #{@bearer_token}"}
65
67
  end
66
68
 
67
69
  # Creates and returns a new client for interacting with the API.
68
70
  #
69
- # @param environment [:production, :sandbox, nil] Specifies the environment to use for the API.
71
+ # @param environment [:production, :dev, nil] Specifies the environment to use for the API.
70
72
  #
71
73
  # Each environment maps to a different base URL:
72
74
  #
73
75
  # - `production` corresponds to `https://api.terminal.shop/`
74
- # - `sandbox` corresponds to `https://sandbox.terminal.shop/`
76
+ # - `dev` corresponds to `https://api.dev.terminal.shop/`
75
77
  #
76
78
  # @param base_url [String, nil] Override the default base URL for the API, e.g., `"https://api.example.com/v2/"`
77
79
  #
@@ -60,6 +60,16 @@ module TerminalShop
60
60
  # # @return [String]
61
61
  # attr_writer :next_
62
62
 
63
+ # @!attribute [r] schedule
64
+ # Schedule of the subscription.
65
+ #
66
+ # @return [TerminalShop::Models::SubscriptionAPI::Schedule::Fixed, TerminalShop::Models::SubscriptionAPI::Schedule::Weekly, nil]
67
+ optional :schedule, union: -> { TerminalShop::Models::SubscriptionAPI::Schedule }
68
+
69
+ # @!parse
70
+ # # @return [TerminalShop::Models::SubscriptionAPI::Schedule::Fixed, TerminalShop::Models::SubscriptionAPI::Schedule::Weekly]
71
+ # attr_writer :schedule
72
+
63
73
  # @!parse
64
74
  # # Subscription to a Terminal shop product.
65
75
  # #
@@ -70,8 +80,9 @@ module TerminalShop
70
80
  # # @param product_variant_id [String]
71
81
  # # @param quantity [Integer]
72
82
  # # @param next_ [String]
83
+ # # @param schedule [TerminalShop::Models::SubscriptionAPI::Schedule::Fixed, TerminalShop::Models::SubscriptionAPI::Schedule::Weekly]
73
84
  # #
74
- # def initialize(id:, address_id:, card_id:, frequency:, product_variant_id:, quantity:, next_: nil, **) = super
85
+ # def initialize(id:, address_id:, card_id:, frequency:, product_variant_id:, quantity:, next_: nil, schedule: nil, **) = super
75
86
 
76
87
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
77
88
 
@@ -108,6 +119,72 @@ module TerminalShop
108
119
  # #
109
120
  # def self.values; end
110
121
  end
122
+
123
+ # @abstract
124
+ #
125
+ # Schedule of the subscription.
126
+ #
127
+ # @example
128
+ # ```ruby
129
+ # case schedule
130
+ # in TerminalShop::Models::SubscriptionAPI::Schedule::Fixed
131
+ # # ...
132
+ # in TerminalShop::Models::SubscriptionAPI::Schedule::Weekly
133
+ # # ...
134
+ # end
135
+ # ```
136
+ class Schedule < TerminalShop::Union
137
+ variant -> { TerminalShop::Models::SubscriptionAPI::Schedule::Fixed }
138
+
139
+ variant -> { TerminalShop::Models::SubscriptionAPI::Schedule::Weekly }
140
+
141
+ # @example
142
+ # ```ruby
143
+ # fixed => {
144
+ # type: :fixed
145
+ # }
146
+ # ```
147
+ class Fixed < TerminalShop::BaseModel
148
+ # @!attribute type
149
+ #
150
+ # @return [Symbol, :fixed]
151
+ required :type, const: :fixed
152
+
153
+ # @!parse
154
+ # # @param type [Symbol, :fixed]
155
+ # #
156
+ # def initialize(type: :fixed, **) = super
157
+
158
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
159
+ end
160
+
161
+ # @example
162
+ # ```ruby
163
+ # weekly => {
164
+ # interval: Integer,
165
+ # type: :weekly
166
+ # }
167
+ # ```
168
+ class Weekly < TerminalShop::BaseModel
169
+ # @!attribute interval
170
+ #
171
+ # @return [Integer]
172
+ required :interval, Integer
173
+
174
+ # @!attribute type
175
+ #
176
+ # @return [Symbol, :weekly]
177
+ required :type, const: :weekly
178
+
179
+ # @!parse
180
+ # # @param interval [Integer]
181
+ # # @param type [Symbol, :weekly]
182
+ # #
183
+ # def initialize(interval:, type: :weekly, **) = super
184
+
185
+ # def initialize: (Hash | TerminalShop::BaseModel) -> void
186
+ end
187
+ end
111
188
  end
112
189
  end
113
190
  end
@@ -21,6 +21,8 @@ module TerminalShop
21
21
  #
22
22
  # @option params [String] :next_ Next shipment and billing date for the subscription.
23
23
  #
24
+ # @option params [TerminalShop::Models::SubscriptionAPI::Schedule::Fixed, TerminalShop::Models::SubscriptionAPI::Schedule::Weekly] :schedule Schedule of the subscription.
25
+ #
24
26
  # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
25
27
  #
26
28
  # @return [TerminalShop::Models::SubscriptionCreateResponse]
@@ -48,8 +48,8 @@ module TerminalShop
48
48
  # @return [Boolean, nil]
49
49
  #
50
50
  def self.coerce_boolean!(input)
51
- case (coerced = coerce_boolean(input))
52
- in true | false | nil
51
+ case coerce_boolean(input)
52
+ in true | false | nil => coerced
53
53
  coerced
54
54
  else
55
55
  raise ArgumentError.new("Unable to coerce #{input.inspect} into boolean value")
@@ -159,25 +159,20 @@ module TerminalShop
159
159
  # @return [Object]
160
160
  #
161
161
  private_class_method def self.deep_merge_lr(lhs, rhs, concat: false)
162
- rhs_cleaned =
163
- case rhs
164
- in Hash
165
- rhs.reject { |_, value| value == OMIT }
166
- else
167
- rhs
168
- end
169
-
170
- case [lhs, rhs_cleaned, concat]
162
+ case [lhs, rhs, concat]
171
163
  in [Hash, Hash, _]
164
+ # rubocop:disable Style/YodaCondition
165
+ rhs_cleaned = rhs.reject { |_, val| OMIT == val }
172
166
  lhs
173
- .reject { |key, _| rhs[key] == OMIT }
167
+ .reject { |key, _| OMIT == rhs[key] }
174
168
  .merge(rhs_cleaned) do |_, old_val, new_val|
175
169
  deep_merge_lr(old_val, new_val, concat: concat)
176
170
  end
171
+ # rubocop:enable Style/YodaCondition
177
172
  in [Array, Array, true]
178
- lhs.concat(rhs_cleaned)
173
+ lhs.concat(rhs)
179
174
  else
180
- rhs_cleaned
175
+ rhs
181
176
  end
182
177
  end
183
178
 
@@ -235,7 +230,7 @@ module TerminalShop
235
230
  in []
236
231
  ""
237
232
  in [String, *interpolations]
238
- encoded = interpolations.map { |v| ERB::Util.url_encode(v) }
233
+ encoded = interpolations.map { ERB::Util.url_encode(_1) }
239
234
  path.first % encoded
240
235
  end
241
236
  end
@@ -297,8 +292,6 @@ module TerminalShop
297
292
  #
298
293
  # @option rhs [Hash{String=>Array<String>}] :query
299
294
  #
300
- # @option rhs [Hash{String=>Array<String>}] :extra_query
301
- #
302
295
  # @return [URI::Generic]
303
296
  #
304
297
  def self.join_parsed_uri(lhs, rhs)
@@ -312,7 +305,7 @@ module TerminalShop
312
305
  query = deep_merge(
313
306
  joined.path == base_path ? base_query : {},
314
307
  parsed_query,
315
- *rhs.values_at(:query, :extra_query).compact,
308
+ rhs[:query].to_h,
316
309
  concat: true
317
310
  )
318
311
 
@@ -332,12 +325,12 @@ module TerminalShop
332
325
 
333
326
  # @private
334
327
  #
335
- # @param query [Hash{String=>Array<String>, String, nil}]
328
+ # @param query [Hash{String=>Array<String>, String, nil}, nil]
336
329
  #
337
330
  # @return [String, nil]
338
331
  #
339
332
  def self.encode_query(query)
340
- query.empty? ? nil : URI.encode_www_form(query)
333
+ query.to_h.empty? ? nil : URI.encode_www_form(query)
341
334
  end
342
335
 
343
336
  # @private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TerminalShop
4
- VERSION = "0.1.0-alpha.6"
4
+ VERSION = "0.1.0-alpha.9"
5
5
  end
@@ -35,10 +35,13 @@ module TerminalShop
35
35
  def self.validate!(req)
36
36
  end
37
37
 
38
- # @private
39
- #
40
38
  sig { returns(T.anything) }
41
- attr_accessor :requester
39
+ def requester
40
+ end
41
+
42
+ sig { params(_: T.anything).returns(T.anything) }
43
+ def requester=(_)
44
+ end
42
45
 
43
46
  sig do
44
47
  params(
@@ -11,47 +11,59 @@ module TerminalShop
11
11
  DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float)
12
12
 
13
13
  ENVIRONMENTS = T.let(
14
- {production: "https://api.terminal.shop/", sandbox: "https://sandbox.terminal.shop/"},
14
+ {production: "https://api.terminal.shop/", dev: "https://api.dev.terminal.shop/"},
15
15
  T::Hash[Symbol, String]
16
16
  )
17
17
 
18
18
  sig { returns(String) }
19
- attr_reader :bearer_token
19
+ def bearer_token
20
+ end
20
21
 
21
22
  sig { returns(TerminalShop::Resources::Product) }
22
- attr_reader :product
23
+ def product
24
+ end
23
25
 
24
26
  sig { returns(TerminalShop::Resources::Profile) }
25
- attr_reader :profile
27
+ def profile
28
+ end
26
29
 
27
30
  sig { returns(TerminalShop::Resources::Address) }
28
- attr_reader :address
31
+ def address
32
+ end
29
33
 
30
34
  sig { returns(TerminalShop::Resources::Card) }
31
- attr_reader :card
35
+ def card
36
+ end
32
37
 
33
38
  sig { returns(TerminalShop::Resources::Cart) }
34
- attr_reader :cart
39
+ def cart
40
+ end
35
41
 
36
42
  sig { returns(TerminalShop::Resources::Order) }
37
- attr_reader :order
43
+ def order
44
+ end
38
45
 
39
46
  sig { returns(TerminalShop::Resources::Subscription) }
40
- attr_reader :subscription
47
+ def subscription
48
+ end
41
49
 
42
50
  sig { returns(TerminalShop::Resources::Token) }
43
- attr_reader :token
51
+ def token
52
+ end
44
53
 
45
54
  sig { returns(TerminalShop::Resources::App) }
46
- attr_reader :app
55
+ def app
56
+ end
47
57
 
48
58
  sig { returns(TerminalShop::Resources::Email) }
49
- attr_reader :email
59
+ def email
60
+ end
50
61
 
51
62
  sig { returns(TerminalShop::Resources::View) }
52
- attr_reader :view
63
+ def view
64
+ end
53
65
 
54
- sig { returns(T::Hash[String, String]) }
66
+ sig { override.returns(T::Hash[String, String]) }
55
67
  private def auth_headers
56
68
  end
57
69
 
@@ -3,7 +3,8 @@
3
3
  module TerminalShop
4
4
  class Error < StandardError
5
5
  sig { returns(T.nilable(StandardError)) }
6
- attr_reader :cause
6
+ def cause
7
+ end
7
8
  end
8
9
 
9
10
  class ConversionError < TerminalShop::Error
@@ -11,13 +12,16 @@ module TerminalShop
11
12
 
12
13
  class APIError < TerminalShop::Error
13
14
  sig { returns(URI::Generic) }
14
- attr_reader :url
15
+ def url
16
+ end
15
17
 
16
18
  sig { returns(T.nilable(Integer)) }
17
- attr_reader :status
19
+ def status
20
+ end
18
21
 
19
22
  sig { returns(T.nilable(T.anything)) }
20
- attr_reader :body
23
+ def body
24
+ end
21
25
 
22
26
  sig do
23
27
  params(
@@ -35,10 +39,12 @@ module TerminalShop
35
39
 
36
40
  class APIConnectionError < TerminalShop::APIError
37
41
  sig { void }
38
- attr_reader :status
42
+ def status
43
+ end
39
44
 
40
45
  sig { void }
41
- attr_reader :body
46
+ def body
47
+ end
42
48
 
43
49
  sig do
44
50
  params(
@@ -83,7 +89,8 @@ module TerminalShop
83
89
  end
84
90
 
85
91
  sig { returns(Integer) }
86
- attr_reader :status
92
+ def status
93
+ end
87
94
 
88
95
  sig do
89
96
  params(
@@ -4,40 +4,76 @@ module TerminalShop
4
4
  module Models
5
5
  class AddressAPI < TerminalShop::BaseModel
6
6
  sig { returns(String) }
7
- attr_accessor :id
7
+ def id
8
+ end
9
+
10
+ sig { params(_: String).returns(String) }
11
+ def id=(_)
12
+ end
8
13
 
9
14
  sig { returns(String) }
10
- attr_accessor :city
15
+ def city
16
+ end
17
+
18
+ sig { params(_: String).returns(String) }
19
+ def city=(_)
20
+ end
11
21
 
12
22
  sig { returns(String) }
13
- attr_accessor :country
23
+ def country
24
+ end
25
+
26
+ sig { params(_: String).returns(String) }
27
+ def country=(_)
28
+ end
14
29
 
15
30
  sig { returns(String) }
16
- attr_accessor :name
31
+ def name
32
+ end
33
+
34
+ sig { params(_: String).returns(String) }
35
+ def name=(_)
36
+ end
17
37
 
18
38
  sig { returns(String) }
19
- attr_accessor :street1
39
+ def street1
40
+ end
41
+
42
+ sig { params(_: String).returns(String) }
43
+ def street1=(_)
44
+ end
20
45
 
21
46
  sig { returns(String) }
22
- attr_accessor :zip
47
+ def zip
48
+ end
49
+
50
+ sig { params(_: String).returns(String) }
51
+ def zip=(_)
52
+ end
23
53
 
24
54
  sig { returns(T.nilable(String)) }
25
- attr_reader :phone
55
+ def phone
56
+ end
26
57
 
27
- sig { params(phone: String).void }
28
- attr_writer :phone
58
+ sig { params(_: String).returns(String) }
59
+ def phone=(_)
60
+ end
29
61
 
30
62
  sig { returns(T.nilable(String)) }
31
- attr_reader :province
63
+ def province
64
+ end
32
65
 
33
- sig { params(province: String).void }
34
- attr_writer :province
66
+ sig { params(_: String).returns(String) }
67
+ def province=(_)
68
+ end
35
69
 
36
70
  sig { returns(T.nilable(String)) }
37
- attr_reader :street2
71
+ def street2
72
+ end
38
73
 
39
- sig { params(street2: String).void }
40
- attr_writer :street2
74
+ sig { params(_: String).returns(String) }
75
+ def street2=(_)
76
+ end
41
77
 
42
78
  sig do
43
79
  params(
@@ -7,37 +7,68 @@ module TerminalShop
7
7
  include TerminalShop::RequestParameters
8
8
 
9
9
  sig { returns(String) }
10
- attr_accessor :city
10
+ def city
11
+ end
12
+
13
+ sig { params(_: String).returns(String) }
14
+ def city=(_)
15
+ end
11
16
 
12
17
  sig { returns(String) }
13
- attr_accessor :country
18
+ def country
19
+ end
20
+
21
+ sig { params(_: String).returns(String) }
22
+ def country=(_)
23
+ end
14
24
 
15
25
  sig { returns(String) }
16
- attr_accessor :name
26
+ def name
27
+ end
28
+
29
+ sig { params(_: String).returns(String) }
30
+ def name=(_)
31
+ end
17
32
 
18
33
  sig { returns(String) }
19
- attr_accessor :street1
34
+ def street1
35
+ end
36
+
37
+ sig { params(_: String).returns(String) }
38
+ def street1=(_)
39
+ end
20
40
 
21
41
  sig { returns(String) }
22
- attr_accessor :zip
42
+ def zip
43
+ end
44
+
45
+ sig { params(_: String).returns(String) }
46
+ def zip=(_)
47
+ end
23
48
 
24
49
  sig { returns(T.nilable(String)) }
25
- attr_reader :phone
50
+ def phone
51
+ end
26
52
 
27
- sig { params(phone: String).void }
28
- attr_writer :phone
53
+ sig { params(_: String).returns(String) }
54
+ def phone=(_)
55
+ end
29
56
 
30
57
  sig { returns(T.nilable(String)) }
31
- attr_reader :province
58
+ def province
59
+ end
32
60
 
33
- sig { params(province: String).void }
34
- attr_writer :province
61
+ sig { params(_: String).returns(String) }
62
+ def province=(_)
63
+ end
35
64
 
36
65
  sig { returns(T.nilable(String)) }
37
- attr_reader :street2
66
+ def street2
67
+ end
38
68
 
39
- sig { params(street2: String).void }
40
- attr_writer :street2
69
+ sig { params(_: String).returns(String) }
70
+ def street2=(_)
71
+ end
41
72
 
42
73
  sig do
43
74
  params(