terminal-shop 0.1.0.pre.alpha.12 → 0.1.0.pre.alpha.14

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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TerminalShop
4
- VERSION = "0.1.0-alpha.12"
4
+ VERSION = "0.1.0-alpha.14"
5
5
  end
data/lib/terminal-shop.rb CHANGED
@@ -68,6 +68,8 @@ require_relative "terminal-shop/models/cart_set_item_response"
68
68
  require_relative "terminal-shop/models/email_create_params"
69
69
  require_relative "terminal-shop/models/email_create_response"
70
70
  require_relative "terminal-shop/models/order"
71
+ require_relative "terminal-shop/models/order_create_params"
72
+ require_relative "terminal-shop/models/order_create_response"
71
73
  require_relative "terminal-shop/models/order_get_params"
72
74
  require_relative "terminal-shop/models/order_get_response"
73
75
  require_relative "terminal-shop/models/order_list_params"
@@ -19,6 +19,10 @@ module TerminalShop
19
19
  def bearer_token
20
20
  end
21
21
 
22
+ sig { returns(T.nilable(String)) }
23
+ def app_id
24
+ end
25
+
22
26
  sig { returns(TerminalShop::Resources::Product) }
23
27
  def product
24
28
  end
@@ -72,6 +76,7 @@ module TerminalShop
72
76
  environment: NilClass,
73
77
  base_url: T.nilable(String),
74
78
  bearer_token: T.nilable(String),
79
+ app_id: T.nilable(String),
75
80
  max_retries: Integer,
76
81
  timeout: Float,
77
82
  initial_retry_delay: Float,
@@ -83,6 +88,7 @@ module TerminalShop
83
88
  environment: nil,
84
89
  base_url: nil,
85
90
  bearer_token: ENV["TERMINAL_BEARER_TOKEN"],
91
+ app_id: nil,
86
92
  max_retries: DEFAULT_MAX_RETRIES,
87
93
  timeout: DEFAULT_TIMEOUT_IN_SECONDS,
88
94
  initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
@@ -0,0 +1,60 @@
1
+ # typed: strong
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class OrderCreateParams < TerminalShop::BaseModel
6
+ extend TerminalShop::RequestParameters::Converter
7
+ include TerminalShop::RequestParameters
8
+
9
+ sig { returns(String) }
10
+ def address_id
11
+ end
12
+
13
+ sig { params(_: String).returns(String) }
14
+ def address_id=(_)
15
+ end
16
+
17
+ sig { returns(String) }
18
+ def card_id
19
+ end
20
+
21
+ sig { params(_: String).returns(String) }
22
+ def card_id=(_)
23
+ end
24
+
25
+ sig { returns(T::Hash[Symbol, Integer]) }
26
+ def variants
27
+ end
28
+
29
+ sig { params(_: T::Hash[Symbol, Integer]).returns(T::Hash[Symbol, Integer]) }
30
+ def variants=(_)
31
+ end
32
+
33
+ sig do
34
+ params(
35
+ address_id: String,
36
+ card_id: String,
37
+ variants: T::Hash[Symbol, Integer],
38
+ request_options: T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])
39
+ )
40
+ .void
41
+ end
42
+ def initialize(address_id:, card_id:, variants:, request_options: {})
43
+ end
44
+
45
+ sig do
46
+ override
47
+ .returns(
48
+ {
49
+ address_id: String,
50
+ card_id: String,
51
+ variants: T::Hash[Symbol, Integer],
52
+ request_options: TerminalShop::RequestOptions
53
+ }
54
+ )
55
+ end
56
+ def to_hash
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,23 @@
1
+ # typed: strong
2
+
3
+ module TerminalShop
4
+ module Models
5
+ class OrderCreateResponse < TerminalShop::BaseModel
6
+ sig { returns(String) }
7
+ def data
8
+ end
9
+
10
+ sig { params(_: String).returns(String) }
11
+ def data=(_)
12
+ end
13
+
14
+ sig { params(data: String).void }
15
+ def initialize(data:)
16
+ end
17
+
18
+ sig { override.returns({data: String}) }
19
+ def to_hash
20
+ end
21
+ end
22
+ end
23
+ end
@@ -18,9 +18,7 @@ module TerminalShop
18
18
  def self.build_request(request)
19
19
  end
20
20
 
21
- sig do
22
- params(url: URI::Generic, blk: T.proc.params(arg0: Net::HTTP, arg1: Enumerator::Yielder).void).void
23
- end
21
+ sig { params(url: URI::Generic, blk: T.proc.params(arg0: Net::HTTP).void).void }
24
22
  private def with_pool(url, &blk)
25
23
  end
26
24
 
@@ -3,6 +3,18 @@
3
3
  module TerminalShop
4
4
  module Resources
5
5
  class Order
6
+ sig do
7
+ params(
8
+ address_id: String,
9
+ card_id: String,
10
+ variants: T::Hash[Symbol, Integer],
11
+ request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything]))
12
+ )
13
+ .returns(TerminalShop::Models::OrderCreateResponse)
14
+ end
15
+ def create(address_id:, card_id:, variants:, request_options: {})
16
+ end
17
+
6
18
  sig do
7
19
  params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
8
20
  .returns(TerminalShop::Models::OrderListResponse)
@@ -2,6 +2,10 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Util
5
+ sig { returns(Float) }
6
+ def self.monotonic_secs
7
+ end
8
+
5
9
  sig { returns(String) }
6
10
  def self.arch
7
11
  end
@@ -34,23 +38,12 @@ module TerminalShop
34
38
  def self.coerce_hash(input)
35
39
  end
36
40
 
37
- sig { returns(Float) }
38
- def self.monotonic_secs
39
- end
41
+ OMIT = T.let(T.anything, T.anything)
40
42
 
41
- sig do
42
- params(
43
- exceptions: T::Array[Exception],
44
- sentinel: T.nilable(T.anything),
45
- blk: T.nilable(T.proc.returns(T.anything))
46
- )
47
- .returns(T.nilable(T.anything))
48
- end
49
- def self.suppress(*exceptions, sentinel: nil, &blk)
43
+ sig { params(lhs: T.anything, rhs: T.anything, concat: T::Boolean).returns(T.anything) }
44
+ private_class_method def self.deep_merge_lr(lhs, rhs, concat: false)
50
45
  end
51
46
 
52
- OMIT = T.let(T.anything, T.anything)
53
-
54
47
  sig do
55
48
  params(values: T::Array[T.anything], sentinel: T.nilable(T.anything), concat: T::Boolean)
56
49
  .returns(T.anything)
@@ -78,6 +71,17 @@ module TerminalShop
78
71
  def self.interpolate_path(path)
79
72
  end
80
73
 
74
+ sig { params(query: T.nilable(String)).returns(T::Hash[String, T::Array[String]]) }
75
+ def self.decode_query(query)
76
+ end
77
+
78
+ sig do
79
+ params(query: T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))]))
80
+ .returns(T.nilable(String))
81
+ end
82
+ def self.encode_query(query)
83
+ end
84
+
81
85
  ParsedUriShape = T.type_alias do
82
86
  {
83
87
  scheme: T.nilable(String),
@@ -103,17 +107,6 @@ module TerminalShop
103
107
  def self.join_parsed_uri(lhs, rhs)
104
108
  end
105
109
 
106
- sig { params(query: T.nilable(String)).returns(T::Hash[String, T::Array[String]]) }
107
- def self.decode_query(query)
108
- end
109
-
110
- sig do
111
- params(query: T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))]))
112
- .returns(T.nilable(String))
113
- end
114
- def self.encode_query(query)
115
- end
116
-
117
110
  sig do
118
111
  params(headers: T::Array[T::Hash[String, T.nilable(T.any(String, Integer))]])
119
112
  .returns(T::Hash[String, String])
@@ -121,6 +114,10 @@ module TerminalShop
121
114
  def self.normalized_headers(*headers)
122
115
  end
123
116
 
117
+ sig { params(io: StringIO, boundary: String, key: T.any(Symbol, String), val: T.anything).void }
118
+ private_class_method def self.encode_multipart_formdata(io, boundary:, key:, val:)
119
+ end
120
+
124
121
  sig { params(headers: T::Hash[String, String], body: T.anything).returns(T.anything) }
125
122
  def self.encode_content(headers, body)
126
123
  end
@@ -135,9 +132,5 @@ module TerminalShop
135
132
  end
136
133
  def self.decode_content(headers, stream:, suppress_error: false)
137
134
  end
138
-
139
- sig { params(io: StringIO, boundary: String, key: T.any(Symbol, String), val: T.anything).void }
140
- private_class_method def self.encode_multipart_formdata(io, boundary:, key:, val:)
141
- end
142
135
  end
143
136
  end
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module TerminalShop
4
- VERSION = "0.1.0-alpha.12"
4
+ VERSION = "0.1.0-alpha.14"
5
5
  end
@@ -15,6 +15,8 @@ module TerminalShop
15
15
 
16
16
  attr_reader bearer_token: String
17
17
 
18
+ attr_reader app_id: String?
19
+
18
20
  attr_reader product: TerminalShop::Resources::Product
19
21
 
20
22
  attr_reader profile: TerminalShop::Resources::Profile
@@ -43,6 +45,7 @@ module TerminalShop
43
45
  environment: :production | :dev | nil,
44
46
  base_url: String?,
45
47
  bearer_token: String?,
48
+ app_id: String?,
46
49
  max_retries: Integer,
47
50
  timeout: Float,
48
51
  initial_retry_delay: Float,
@@ -0,0 +1,32 @@
1
+ module TerminalShop
2
+ module Models
3
+ type order_create_params =
4
+ { address_id: String, card_id: String, variants: ::Hash[Symbol, Integer] }
5
+ & TerminalShop::request_parameters
6
+
7
+ class OrderCreateParams < TerminalShop::BaseModel
8
+ extend TerminalShop::RequestParameters::Converter
9
+ include TerminalShop::RequestParameters
10
+
11
+ attr_accessor address_id: String
12
+
13
+ attr_accessor card_id: String
14
+
15
+ attr_accessor variants: ::Hash[Symbol, Integer]
16
+
17
+ def initialize:
18
+ (
19
+ address_id: String,
20
+ card_id: String,
21
+ variants: ::Hash[Symbol, Integer],
22
+ request_options: TerminalShop::request_opts
23
+ ) -> void
24
+ | (
25
+ ?TerminalShop::Models::order_create_params
26
+ | TerminalShop::BaseModel data
27
+ ) -> void
28
+
29
+ def to_hash: -> TerminalShop::Models::order_create_params
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,18 @@
1
+ module TerminalShop
2
+ module Models
3
+ type order_create_response = { data: String }
4
+
5
+ class OrderCreateResponse < TerminalShop::BaseModel
6
+ attr_accessor data: String
7
+
8
+ def initialize:
9
+ (data: String) -> void
10
+ | (
11
+ ?TerminalShop::Models::order_create_response
12
+ | TerminalShop::BaseModel data
13
+ ) -> void
14
+
15
+ def to_hash: -> TerminalShop::Models::order_create_response
16
+ end
17
+ end
18
+ end
@@ -17,11 +17,7 @@ module TerminalShop
17
17
  TerminalShop::PooledNetRequester::request request
18
18
  ) -> top
19
19
 
20
- private def with_pool: (
21
- URI::Generic url
22
- ) {
23
- (top arg0, Enumerator::Yielder arg1) -> void
24
- } -> void
20
+ private def with_pool: (URI::Generic url) { (top arg0) -> void } -> void
25
21
 
26
22
  def execute: (
27
23
  TerminalShop::PooledNetRequester::request request
@@ -1,6 +1,17 @@
1
1
  module TerminalShop
2
2
  module Resources
3
3
  class Order
4
+ def create:
5
+ (
6
+ TerminalShop::Models::OrderCreateParams | ::Hash[Symbol, top] params
7
+ ) -> TerminalShop::Models::OrderCreateResponse
8
+ | (
9
+ address_id: String,
10
+ card_id: String,
11
+ variants: ::Hash[Symbol, Integer],
12
+ request_options: TerminalShop::request_opts
13
+ ) -> TerminalShop::Models::OrderCreateResponse
14
+
4
15
  def list:
5
16
  (
6
17
  ?TerminalShop::Models::OrderListParams | ::Hash[Symbol, top] params
@@ -1,5 +1,7 @@
1
1
  module TerminalShop
2
2
  module Util
3
+ def self?.monotonic_secs: -> Float
4
+
3
5
  def self?.arch: -> String
4
6
 
5
7
  def self?.os: -> String
@@ -16,17 +18,10 @@ module TerminalShop
16
18
 
17
19
  def self?.coerce_hash: (top input) -> (::Hash[top, top] | top)
18
20
 
19
- def self?.monotonic_secs: -> Float
20
-
21
- def self?.suppress: (
22
- *::Array[Exception] exceptions,
23
- sentinel: top?
24
- ) {
25
- -> top?
26
- } -> top?
27
-
28
21
  OMIT: top
29
22
 
23
+ def self?.deep_merge_lr: (top lhs, top rhs, concat: bool) -> top
24
+
30
25
  def self?.deep_merge: (
31
26
  *::Array[top] values,
32
27
  sentinel: top?,
@@ -45,6 +40,12 @@ module TerminalShop
45
40
 
46
41
  def self?.interpolate_path: (String | ::Array[String] path) -> String
47
42
 
43
+ def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
44
+
45
+ def self?.encode_query: (
46
+ ::Hash[String, (::Array[String] | String)?]? query
47
+ ) -> String?
48
+
48
49
  type parsed_uri =
49
50
  {
50
51
  scheme: String?,
@@ -67,16 +68,17 @@ module TerminalShop
67
68
  TerminalShop::Util::parsed_uri rhs
68
69
  ) -> URI::Generic
69
70
 
70
- def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
71
-
72
- def self?.encode_query: (
73
- ::Hash[String, (::Array[String] | String)?]? query
74
- ) -> String?
75
-
76
71
  def self?.normalized_headers: (
77
72
  *::Array[::Hash[String, (String | Integer)?]] headers
78
73
  ) -> ::Hash[String, String]
79
74
 
75
+ def self?.encode_multipart_formdata: (
76
+ StringIO io,
77
+ boundary: String,
78
+ key: Symbol | String,
79
+ val: top
80
+ ) -> void
81
+
80
82
  def self?.encode_content: (::Hash[String, String] headers, top body) -> top
81
83
 
82
84
  def self?.decode_content: (
@@ -84,12 +86,5 @@ module TerminalShop
84
86
  stream: Enumerable[String],
85
87
  suppress_error: bool
86
88
  ) -> top
87
-
88
- def self?.encode_multipart_formdata: (
89
- StringIO io,
90
- boundary: String,
91
- key: Symbol | String,
92
- val: top
93
- ) -> void
94
89
  end
95
90
  end
@@ -1,3 +1,3 @@
1
1
  module TerminalShop
2
- VERSION: "0.1.0-alpha.11"
2
+ VERSION: "0.1.0-alpha.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-shop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.alpha.12
4
+ version: 0.1.0.pre.alpha.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terminal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-26 00:00:00.000000000 Z
11
+ date: 2025-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -78,6 +78,8 @@ files:
78
78
  - lib/terminal-shop/models/email_create_params.rb
79
79
  - lib/terminal-shop/models/email_create_response.rb
80
80
  - lib/terminal-shop/models/order.rb
81
+ - lib/terminal-shop/models/order_create_params.rb
82
+ - lib/terminal-shop/models/order_create_response.rb
81
83
  - lib/terminal-shop/models/order_get_params.rb
82
84
  - lib/terminal-shop/models/order_get_response.rb
83
85
  - lib/terminal-shop/models/order_list_params.rb
@@ -170,6 +172,8 @@ files:
170
172
  - rbi/lib/terminal-shop/models/email_create_params.rbi
171
173
  - rbi/lib/terminal-shop/models/email_create_response.rbi
172
174
  - rbi/lib/terminal-shop/models/order.rbi
175
+ - rbi/lib/terminal-shop/models/order_create_params.rbi
176
+ - rbi/lib/terminal-shop/models/order_create_response.rbi
173
177
  - rbi/lib/terminal-shop/models/order_get_params.rbi
174
178
  - rbi/lib/terminal-shop/models/order_get_response.rbi
175
179
  - rbi/lib/terminal-shop/models/order_list_params.rbi
@@ -261,6 +265,8 @@ files:
261
265
  - sig/terminal-shop/models/email_create_params.rbs
262
266
  - sig/terminal-shop/models/email_create_response.rbs
263
267
  - sig/terminal-shop/models/order.rbs
268
+ - sig/terminal-shop/models/order_create_params.rbs
269
+ - sig/terminal-shop/models/order_create_response.rbs
264
270
  - sig/terminal-shop/models/order_get_params.rbs
265
271
  - sig/terminal-shop/models/order_get_response.rbs
266
272
  - sig/terminal-shop/models/order_list_params.rbs