terminal-shop 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/terminal-shop/base_client.rb +36 -46
- data/lib/terminal-shop/base_model.rb +65 -130
- data/lib/terminal-shop/base_page.rb +18 -18
- data/lib/terminal-shop/client.rb +1 -3
- data/lib/terminal-shop/errors.rb +12 -17
- data/lib/terminal-shop/extern.rb +1 -4
- data/lib/terminal-shop/models/subscription.rb +6 -0
- data/lib/terminal-shop/pooled_net_requester.rb +19 -21
- data/lib/terminal-shop/request_options.rb +4 -11
- data/lib/terminal-shop/resources/address.rb +0 -5
- data/lib/terminal-shop/resources/app.rb +0 -5
- data/lib/terminal-shop/resources/card.rb +0 -6
- data/lib/terminal-shop/resources/cart.rb +0 -7
- data/lib/terminal-shop/resources/email.rb +0 -2
- data/lib/terminal-shop/resources/order.rb +0 -4
- data/lib/terminal-shop/resources/product.rb +0 -3
- data/lib/terminal-shop/resources/profile.rb +0 -3
- data/lib/terminal-shop/resources/subscription.rb +0 -5
- data/lib/terminal-shop/resources/token.rb +0 -5
- data/lib/terminal-shop/resources/view.rb +0 -2
- data/lib/terminal-shop/util.rb +44 -71
- data/lib/terminal-shop/version.rb +1 -1
- data/lib/terminal-shop.rb +1 -0
- data/manifest.yaml +1 -0
- data/rbi/lib/terminal-shop/base_client.rbi +23 -0
- data/rbi/lib/terminal-shop/base_model.rbi +178 -52
- data/rbi/lib/terminal-shop/base_page.rbi +1 -2
- data/rbi/lib/terminal-shop/client.rbi +11 -0
- data/rbi/lib/terminal-shop/errors.rbi +33 -0
- data/rbi/lib/terminal-shop/extern.rbi +1 -1
- data/rbi/lib/terminal-shop/models/address.rbi +10 -0
- data/rbi/lib/terminal-shop/models/address_create_params.rbi +8 -0
- data/rbi/lib/terminal-shop/models/address_create_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/address_get_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/address_list_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/app.rbi +5 -0
- data/rbi/lib/terminal-shop/models/app_create_response.rbi +2 -0
- data/rbi/lib/terminal-shop/models/app_get_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/app_list_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/card.rbi +8 -0
- data/rbi/lib/terminal-shop/models/card_collect_response.rbi +4 -0
- data/rbi/lib/terminal-shop/models/card_create_params.rbi +2 -0
- data/rbi/lib/terminal-shop/models/card_create_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/card_get_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/card_list_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/cart.rbi +19 -0
- data/rbi/lib/terminal-shop/models/cart_convert_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/cart_get_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/cart_set_address_params.rbi +1 -0
- data/rbi/lib/terminal-shop/models/cart_set_card_params.rbi +1 -0
- data/rbi/lib/terminal-shop/models/cart_set_item_params.rbi +2 -0
- data/rbi/lib/terminal-shop/models/cart_set_item_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/email_create_params.rbi +1 -0
- data/rbi/lib/terminal-shop/models/order.rbi +28 -0
- data/rbi/lib/terminal-shop/models/order_create_params.rbi +3 -0
- data/rbi/lib/terminal-shop/models/order_create_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/order_get_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/order_list_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/product.rbi +12 -6
- data/rbi/lib/terminal-shop/models/product_get_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/product_list_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/product_variant.rbi +4 -0
- data/rbi/lib/terminal-shop/models/profile.rbi +8 -0
- data/rbi/lib/terminal-shop/models/profile_me_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/profile_update_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/region.rbi +3 -6
- data/rbi/lib/terminal-shop/models/subscription.rbi +18 -11
- data/rbi/lib/terminal-shop/models/subscription_get_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/subscription_list_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/token.rbi +5 -0
- data/rbi/lib/terminal-shop/models/token_create_response.rbi +3 -0
- data/rbi/lib/terminal-shop/models/token_get_response.rbi +2 -0
- data/rbi/lib/terminal-shop/models/token_list_response.rbi +1 -0
- data/rbi/lib/terminal-shop/models/view_init_response.rbi +5 -0
- data/rbi/lib/terminal-shop/pooled_net_requester.rbi +10 -3
- data/rbi/lib/terminal-shop/request_options.rbi +21 -2
- data/rbi/lib/terminal-shop/resources/address.rbi +22 -2
- data/rbi/lib/terminal-shop/resources/app.rbi +14 -2
- data/rbi/lib/terminal-shop/resources/card.rbi +22 -3
- data/rbi/lib/terminal-shop/resources/cart.rbi +23 -3
- data/rbi/lib/terminal-shop/resources/email.rbi +6 -1
- data/rbi/lib/terminal-shop/resources/order.rbi +17 -2
- data/rbi/lib/terminal-shop/resources/product.rbi +7 -1
- data/rbi/lib/terminal-shop/resources/profile.rbi +2 -0
- data/rbi/lib/terminal-shop/resources/subscription.rbi +21 -2
- data/rbi/lib/terminal-shop/resources/token.rbi +14 -2
- data/rbi/lib/terminal-shop/resources/view.rbi +2 -0
- data/rbi/lib/terminal-shop/util.rbi +55 -8
- data/rbi/lib/terminal-shop/version.rbi +1 -1
- data/sig/terminal-shop/base_client.rbs +6 -1
- data/sig/terminal-shop/base_model.rbs +8 -6
- data/sig/terminal-shop/errors.rbs +4 -4
- data/sig/terminal-shop/models/subscription.rbs +1 -1
- data/sig/terminal-shop/pooled_net_requester.rbs +7 -2
- data/sig/terminal-shop/util.rbs +4 -4
- data/sig/terminal-shop/version.rbs +1 -1
- metadata +4 -4
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Models
|
5
5
|
class ViewInitResponse < TerminalShop::BaseModel
|
6
|
+
# Initial app data.
|
6
7
|
sig { returns(TerminalShop::Models::ViewInitResponse::Data) }
|
7
8
|
def data
|
8
9
|
end
|
@@ -47,6 +48,7 @@ module TerminalShop
|
|
47
48
|
def cards=(_)
|
48
49
|
end
|
49
50
|
|
51
|
+
# The current Terminal shop user's cart.
|
50
52
|
sig { returns(TerminalShop::Models::CartAPI) }
|
51
53
|
def cart
|
52
54
|
end
|
@@ -71,6 +73,7 @@ module TerminalShop
|
|
71
73
|
def products=(_)
|
72
74
|
end
|
73
75
|
|
76
|
+
# A Terminal shop user's profile. (We have users, btw.)
|
74
77
|
sig { returns(TerminalShop::Models::ProfileAPI) }
|
75
78
|
def profile
|
76
79
|
end
|
@@ -79,6 +82,7 @@ module TerminalShop
|
|
79
82
|
def profile=(_)
|
80
83
|
end
|
81
84
|
|
85
|
+
# A Terminal shop user's region.
|
82
86
|
sig { returns(Symbol) }
|
83
87
|
def region
|
84
88
|
end
|
@@ -106,6 +110,7 @@ module TerminalShop
|
|
106
110
|
def tokens=(_)
|
107
111
|
end
|
108
112
|
|
113
|
+
# Initial app data.
|
109
114
|
sig do
|
110
115
|
params(
|
111
116
|
addresses: T::Array[TerminalShop::Models::AddressAPI],
|
@@ -1,20 +1,24 @@
|
|
1
1
|
# typed: strong
|
2
2
|
|
3
3
|
module TerminalShop
|
4
|
+
# @api private
|
4
5
|
class PooledNetRequester
|
5
6
|
RequestShape = T.type_alias do
|
6
7
|
{method: Symbol, url: URI::Generic, headers: T::Hash[String, String], body: T.anything, deadline: Float}
|
7
8
|
end
|
8
9
|
|
9
10
|
class << self
|
11
|
+
# @api private
|
10
12
|
sig { params(url: URI::Generic).returns(Net::HTTP) }
|
11
13
|
def connect(url)
|
12
14
|
end
|
13
15
|
|
16
|
+
# @api private
|
14
17
|
sig { params(conn: Net::HTTP, deadline: Float).void }
|
15
18
|
def calibrate_socket_timeout(conn, deadline)
|
16
19
|
end
|
17
20
|
|
21
|
+
# @api private
|
18
22
|
sig do
|
19
23
|
params(request: TerminalShop::PooledNetRequester::RequestShape, blk: T.proc.params(arg0: String).void)
|
20
24
|
.returns(Net::HTTPGenericRequest)
|
@@ -23,17 +27,20 @@ module TerminalShop
|
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
26
|
-
|
27
|
-
|
30
|
+
# @api private
|
31
|
+
sig { params(url: URI::Generic, deadline: Float, blk: T.proc.params(arg0: Net::HTTP).void).void }
|
32
|
+
private def with_pool(url, deadline:, &blk)
|
28
33
|
end
|
29
34
|
|
35
|
+
# @api private
|
30
36
|
sig do
|
31
37
|
params(request: TerminalShop::PooledNetRequester::RequestShape)
|
32
|
-
.returns([Net::HTTPResponse, T::Enumerable[String]])
|
38
|
+
.returns([Integer, Net::HTTPResponse, T::Enumerable[String]])
|
33
39
|
end
|
34
40
|
def execute(request)
|
35
41
|
end
|
36
42
|
|
43
|
+
# @api private
|
37
44
|
sig { params(size: Integer).returns(T.attached_class) }
|
38
45
|
def self.new(size: Etc.nprocessors)
|
39
46
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# typed: strong
|
2
2
|
|
3
3
|
module TerminalShop
|
4
|
+
# @api private
|
4
5
|
module RequestParameters
|
5
|
-
|
6
|
-
|
6
|
+
# Options to specify HTTP behaviour for this request.
|
7
7
|
sig { returns(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])) }
|
8
8
|
def request_options
|
9
9
|
end
|
@@ -15,18 +15,28 @@ module TerminalShop
|
|
15
15
|
def request_options=(_)
|
16
16
|
end
|
17
17
|
|
18
|
+
# @api private
|
18
19
|
module Converter
|
20
|
+
# @api private
|
19
21
|
sig { params(params: T.anything).returns([T.anything, T::Hash[Symbol, T.anything]]) }
|
20
22
|
def dump_request(params)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
27
|
+
# Specify HTTP behaviour to use for a specific request. These options supplement
|
28
|
+
# or override those provided at the client level.
|
29
|
+
#
|
30
|
+
# When making a request, you can pass an actual {RequestOptions} instance, or
|
31
|
+
# simply pass a Hash with symbol keys matching the attributes on this class.
|
25
32
|
class RequestOptions < TerminalShop::BaseModel
|
33
|
+
# @api private
|
26
34
|
sig { params(opts: T.any(T.self_type, T::Hash[Symbol, T.anything])).void }
|
27
35
|
def self.validate!(opts)
|
28
36
|
end
|
29
37
|
|
38
|
+
# Idempotency key to send with request and all associated retries. Will only be
|
39
|
+
# sent for write requests.
|
30
40
|
sig { returns(T.nilable(String)) }
|
31
41
|
def idempotency_key
|
32
42
|
end
|
@@ -35,6 +45,8 @@ module TerminalShop
|
|
35
45
|
def idempotency_key=(_)
|
36
46
|
end
|
37
47
|
|
48
|
+
# Extra query params to send with the request. These are `.merge`’d into any
|
49
|
+
# `query` given at the client level.
|
38
50
|
sig { returns(T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])) }
|
39
51
|
def extra_query
|
40
52
|
end
|
@@ -46,6 +58,8 @@ module TerminalShop
|
|
46
58
|
def extra_query=(_)
|
47
59
|
end
|
48
60
|
|
61
|
+
# Extra headers to send with the request. These are `.merged`’d into any
|
62
|
+
# `extra_headers` given at the client level.
|
49
63
|
sig { returns(T.nilable(T::Hash[String, T.nilable(String)])) }
|
50
64
|
def extra_headers
|
51
65
|
end
|
@@ -57,6 +71,8 @@ module TerminalShop
|
|
57
71
|
def extra_headers=(_)
|
58
72
|
end
|
59
73
|
|
74
|
+
# Extra data to send with the request. These are deep merged into any data
|
75
|
+
# generated as part of the normal request.
|
60
76
|
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
61
77
|
def extra_body
|
62
78
|
end
|
@@ -65,6 +81,7 @@ module TerminalShop
|
|
65
81
|
def extra_body=(_)
|
66
82
|
end
|
67
83
|
|
84
|
+
# Maximum number of retries to attempt after a failed initial request.
|
68
85
|
sig { returns(T.nilable(Integer)) }
|
69
86
|
def max_retries
|
70
87
|
end
|
@@ -73,6 +90,7 @@ module TerminalShop
|
|
73
90
|
def max_retries=(_)
|
74
91
|
end
|
75
92
|
|
93
|
+
# Request timeout in seconds.
|
76
94
|
sig { returns(T.nilable(Float)) }
|
77
95
|
def timeout
|
78
96
|
end
|
@@ -81,6 +99,7 @@ module TerminalShop
|
|
81
99
|
def timeout=(_)
|
82
100
|
end
|
83
101
|
|
102
|
+
# Returns a new instance of RequestOptions.
|
84
103
|
sig { params(values: T::Hash[Symbol, T.anything]).returns(T.attached_class) }
|
85
104
|
def self.new(values = {})
|
86
105
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Address
|
6
|
+
# Create and add a shipping address to the current user.
|
6
7
|
sig do
|
7
8
|
params(
|
8
9
|
city: String,
|
@@ -18,18 +19,27 @@ module TerminalShop
|
|
18
19
|
.returns(TerminalShop::Models::AddressCreateResponse)
|
19
20
|
end
|
20
21
|
def create(
|
22
|
+
# City of the address.
|
21
23
|
city:,
|
24
|
+
# ISO 3166-1 alpha-2 country code of the address.
|
22
25
|
country:,
|
26
|
+
# The recipient's name.
|
23
27
|
name:,
|
28
|
+
# Street of the address.
|
24
29
|
street1:,
|
30
|
+
# Zip code of the address.
|
25
31
|
zip:,
|
32
|
+
# Phone number of the recipient.
|
26
33
|
phone: nil,
|
34
|
+
# Province or state of the address.
|
27
35
|
province: nil,
|
36
|
+
# Apartment, suite, etc. of the address.
|
28
37
|
street2: nil,
|
29
38
|
request_options: {}
|
30
39
|
)
|
31
40
|
end
|
32
41
|
|
42
|
+
# Get the shipping addresses associated with the current user.
|
33
43
|
sig do
|
34
44
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
35
45
|
.returns(TerminalShop::Models::AddressListResponse)
|
@@ -37,6 +47,7 @@ module TerminalShop
|
|
37
47
|
def list(request_options: {})
|
38
48
|
end
|
39
49
|
|
50
|
+
# Delete a shipping address from the current user.
|
40
51
|
sig do
|
41
52
|
params(
|
42
53
|
id: String,
|
@@ -44,9 +55,14 @@ module TerminalShop
|
|
44
55
|
)
|
45
56
|
.returns(TerminalShop::Models::AddressDeleteResponse)
|
46
57
|
end
|
47
|
-
def delete(
|
58
|
+
def delete(
|
59
|
+
# ID of the shipping address to delete.
|
60
|
+
id,
|
61
|
+
request_options: {}
|
62
|
+
)
|
48
63
|
end
|
49
64
|
|
65
|
+
# Get the shipping address with the given ID.
|
50
66
|
sig do
|
51
67
|
params(
|
52
68
|
id: String,
|
@@ -54,7 +70,11 @@ module TerminalShop
|
|
54
70
|
)
|
55
71
|
.returns(TerminalShop::Models::AddressGetResponse)
|
56
72
|
end
|
57
|
-
def get(
|
73
|
+
def get(
|
74
|
+
# ID of the shipping address to get.
|
75
|
+
id,
|
76
|
+
request_options: {}
|
77
|
+
)
|
58
78
|
end
|
59
79
|
|
60
80
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class App
|
6
|
+
# Create an app.
|
6
7
|
sig do
|
7
8
|
params(
|
8
9
|
name: String,
|
@@ -14,6 +15,7 @@ module TerminalShop
|
|
14
15
|
def create(name:, redirect_uri:, request_options: {})
|
15
16
|
end
|
16
17
|
|
18
|
+
# List the current user's registered apps.
|
17
19
|
sig do
|
18
20
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
19
21
|
.returns(TerminalShop::Models::AppListResponse)
|
@@ -21,6 +23,7 @@ module TerminalShop
|
|
21
23
|
def list(request_options: {})
|
22
24
|
end
|
23
25
|
|
26
|
+
# Delete the app with the given ID.
|
24
27
|
sig do
|
25
28
|
params(
|
26
29
|
id: String,
|
@@ -28,9 +31,14 @@ module TerminalShop
|
|
28
31
|
)
|
29
32
|
.returns(TerminalShop::Models::AppDeleteResponse)
|
30
33
|
end
|
31
|
-
def delete(
|
34
|
+
def delete(
|
35
|
+
# ID of the app to delete.
|
36
|
+
id,
|
37
|
+
request_options: {}
|
38
|
+
)
|
32
39
|
end
|
33
40
|
|
41
|
+
# Get the app with the given ID.
|
34
42
|
sig do
|
35
43
|
params(
|
36
44
|
id: String,
|
@@ -38,7 +46,11 @@ module TerminalShop
|
|
38
46
|
)
|
39
47
|
.returns(TerminalShop::Models::AppGetResponse)
|
40
48
|
end
|
41
|
-
def get(
|
49
|
+
def get(
|
50
|
+
# ID of the app to get.
|
51
|
+
id,
|
52
|
+
request_options: {}
|
53
|
+
)
|
42
54
|
end
|
43
55
|
|
44
56
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Card
|
6
|
+
# Attach a credit card (tokenized via Stripe) to the current user.
|
6
7
|
sig do
|
7
8
|
params(
|
8
9
|
token: String,
|
@@ -10,9 +11,15 @@ module TerminalShop
|
|
10
11
|
)
|
11
12
|
.returns(TerminalShop::Models::CardCreateResponse)
|
12
13
|
end
|
13
|
-
def create(
|
14
|
+
def create(
|
15
|
+
# Stripe card token. Learn how to
|
16
|
+
# [create one here](https://docs.stripe.com/api/tokens/create_card).
|
17
|
+
token:,
|
18
|
+
request_options: {}
|
19
|
+
)
|
14
20
|
end
|
15
21
|
|
22
|
+
# List the credit cards associated with the current user.
|
16
23
|
sig do
|
17
24
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
18
25
|
.returns(TerminalShop::Models::CardListResponse)
|
@@ -20,6 +27,7 @@ module TerminalShop
|
|
20
27
|
def list(request_options: {})
|
21
28
|
end
|
22
29
|
|
30
|
+
# Delete a credit card associated with the current user.
|
23
31
|
sig do
|
24
32
|
params(
|
25
33
|
id: String,
|
@@ -27,9 +35,15 @@ module TerminalShop
|
|
27
35
|
)
|
28
36
|
.returns(TerminalShop::Models::CardDeleteResponse)
|
29
37
|
end
|
30
|
-
def delete(
|
38
|
+
def delete(
|
39
|
+
# ID of the card to delete.
|
40
|
+
id,
|
41
|
+
request_options: {}
|
42
|
+
)
|
31
43
|
end
|
32
44
|
|
45
|
+
# Create a temporary URL for collecting credit card information for the current
|
46
|
+
# user.
|
33
47
|
sig do
|
34
48
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
35
49
|
.returns(TerminalShop::Models::CardCollectResponse)
|
@@ -37,6 +51,7 @@ module TerminalShop
|
|
37
51
|
def collect(request_options: {})
|
38
52
|
end
|
39
53
|
|
54
|
+
# Get a credit card by ID associated with the current user.
|
40
55
|
sig do
|
41
56
|
params(
|
42
57
|
id: String,
|
@@ -44,7 +59,11 @@ module TerminalShop
|
|
44
59
|
)
|
45
60
|
.returns(TerminalShop::Models::CardGetResponse)
|
46
61
|
end
|
47
|
-
def get(
|
62
|
+
def get(
|
63
|
+
# ID of the card to get.
|
64
|
+
id,
|
65
|
+
request_options: {}
|
66
|
+
)
|
48
67
|
end
|
49
68
|
|
50
69
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Cart
|
6
|
+
# Clear the current user's cart.
|
6
7
|
sig do
|
7
8
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
8
9
|
.returns(TerminalShop::Models::CartClearResponse)
|
@@ -10,6 +11,7 @@ module TerminalShop
|
|
10
11
|
def clear(request_options: {})
|
11
12
|
end
|
12
13
|
|
14
|
+
# Convert the current user's cart to an order.
|
13
15
|
sig do
|
14
16
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
15
17
|
.returns(TerminalShop::Models::CartConvertResponse)
|
@@ -17,6 +19,7 @@ module TerminalShop
|
|
17
19
|
def convert(request_options: {})
|
18
20
|
end
|
19
21
|
|
22
|
+
# Get the current user's cart.
|
20
23
|
sig do
|
21
24
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
22
25
|
.returns(TerminalShop::Models::CartGetResponse)
|
@@ -24,6 +27,7 @@ module TerminalShop
|
|
24
27
|
def get(request_options: {})
|
25
28
|
end
|
26
29
|
|
30
|
+
# Set the shipping address for the current user's cart.
|
27
31
|
sig do
|
28
32
|
params(
|
29
33
|
address_id: String,
|
@@ -31,9 +35,14 @@ module TerminalShop
|
|
31
35
|
)
|
32
36
|
.returns(TerminalShop::Models::CartSetAddressResponse)
|
33
37
|
end
|
34
|
-
def set_address(
|
38
|
+
def set_address(
|
39
|
+
# ID of the shipping address to set for the current user's cart.
|
40
|
+
address_id:,
|
41
|
+
request_options: {}
|
42
|
+
)
|
35
43
|
end
|
36
44
|
|
45
|
+
# Set the credit card for the current user's cart.
|
37
46
|
sig do
|
38
47
|
params(
|
39
48
|
card_id: String,
|
@@ -41,9 +50,14 @@ module TerminalShop
|
|
41
50
|
)
|
42
51
|
.returns(TerminalShop::Models::CartSetCardResponse)
|
43
52
|
end
|
44
|
-
def set_card(
|
53
|
+
def set_card(
|
54
|
+
# ID of the credit card to set for the current user's cart.
|
55
|
+
card_id:,
|
56
|
+
request_options: {}
|
57
|
+
)
|
45
58
|
end
|
46
59
|
|
60
|
+
# Add an item to the current user's cart.
|
47
61
|
sig do
|
48
62
|
params(
|
49
63
|
product_variant_id: String,
|
@@ -52,7 +66,13 @@ module TerminalShop
|
|
52
66
|
)
|
53
67
|
.returns(TerminalShop::Models::CartSetItemResponse)
|
54
68
|
end
|
55
|
-
def set_item(
|
69
|
+
def set_item(
|
70
|
+
# ID of the product variant to add to the cart.
|
71
|
+
product_variant_id:,
|
72
|
+
# Quantity of the item to add to the cart.
|
73
|
+
quantity:,
|
74
|
+
request_options: {}
|
75
|
+
)
|
56
76
|
end
|
57
77
|
|
58
78
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Email
|
6
|
+
# Subscribe to email updates from Terminal.
|
6
7
|
sig do
|
7
8
|
params(
|
8
9
|
email: String,
|
@@ -10,7 +11,11 @@ module TerminalShop
|
|
10
11
|
)
|
11
12
|
.returns(TerminalShop::Models::EmailCreateResponse)
|
12
13
|
end
|
13
|
-
def create(
|
14
|
+
def create(
|
15
|
+
# Email address to subscribe to Terminal updates with.
|
16
|
+
email:,
|
17
|
+
request_options: {}
|
18
|
+
)
|
14
19
|
end
|
15
20
|
|
16
21
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Order
|
6
|
+
# Create an order without a cart. The order will be placed immediately.
|
6
7
|
sig do
|
7
8
|
params(
|
8
9
|
address_id: String,
|
@@ -12,9 +13,18 @@ module TerminalShop
|
|
12
13
|
)
|
13
14
|
.returns(TerminalShop::Models::OrderCreateResponse)
|
14
15
|
end
|
15
|
-
def create(
|
16
|
+
def create(
|
17
|
+
# Shipping address ID.
|
18
|
+
address_id:,
|
19
|
+
# Card ID.
|
20
|
+
card_id:,
|
21
|
+
# Product variants to include in the order, along with their quantities.
|
22
|
+
variants:,
|
23
|
+
request_options: {}
|
24
|
+
)
|
16
25
|
end
|
17
26
|
|
27
|
+
# List the orders associated with the current user.
|
18
28
|
sig do
|
19
29
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
20
30
|
.returns(TerminalShop::Models::OrderListResponse)
|
@@ -22,6 +32,7 @@ module TerminalShop
|
|
22
32
|
def list(request_options: {})
|
23
33
|
end
|
24
34
|
|
35
|
+
# Get the order with the given ID.
|
25
36
|
sig do
|
26
37
|
params(
|
27
38
|
id: String,
|
@@ -29,7 +40,11 @@ module TerminalShop
|
|
29
40
|
)
|
30
41
|
.returns(TerminalShop::Models::OrderGetResponse)
|
31
42
|
end
|
32
|
-
def get(
|
43
|
+
def get(
|
44
|
+
# ID of the order to get.
|
45
|
+
id,
|
46
|
+
request_options: {}
|
47
|
+
)
|
33
48
|
end
|
34
49
|
|
35
50
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Product
|
6
|
+
# List all products for sale in the Terminal shop.
|
6
7
|
sig do
|
7
8
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
8
9
|
.returns(TerminalShop::Models::ProductListResponse)
|
@@ -10,6 +11,7 @@ module TerminalShop
|
|
10
11
|
def list(request_options: {})
|
11
12
|
end
|
12
13
|
|
14
|
+
# Get a product by ID from the Terminal shop.
|
13
15
|
sig do
|
14
16
|
params(
|
15
17
|
id: String,
|
@@ -17,7 +19,11 @@ module TerminalShop
|
|
17
19
|
)
|
18
20
|
.returns(TerminalShop::Models::ProductGetResponse)
|
19
21
|
end
|
20
|
-
def get(
|
22
|
+
def get(
|
23
|
+
# ID of the product to get.
|
24
|
+
id,
|
25
|
+
request_options: {}
|
26
|
+
)
|
21
27
|
end
|
22
28
|
|
23
29
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Profile
|
6
|
+
# Update the current user's profile.
|
6
7
|
sig do
|
7
8
|
params(
|
8
9
|
email: String,
|
@@ -14,6 +15,7 @@ module TerminalShop
|
|
14
15
|
def update(email:, name:, request_options: {})
|
15
16
|
end
|
16
17
|
|
18
|
+
# Get the current user's profile.
|
17
19
|
sig do
|
18
20
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
19
21
|
.returns(TerminalShop::Models::ProfileMeResponse)
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Subscription
|
6
|
+
# Create a subscription for the current user.
|
6
7
|
sig do
|
7
8
|
params(
|
8
9
|
id: String,
|
@@ -20,17 +21,25 @@ module TerminalShop
|
|
20
21
|
.returns(TerminalShop::Models::SubscriptionCreateResponse)
|
21
22
|
end
|
22
23
|
def create(
|
24
|
+
# Unique object identifier. The format and length of IDs may change over time.
|
23
25
|
id:,
|
26
|
+
# ID of the shipping address used for the subscription.
|
24
27
|
address_id:,
|
28
|
+
# ID of the card used for the subscription.
|
25
29
|
card_id:,
|
30
|
+
# ID of the product variant being subscribed to.
|
26
31
|
product_variant_id:,
|
32
|
+
# Quantity of the subscription.
|
27
33
|
quantity:,
|
34
|
+
# Next shipment and billing date for the subscription.
|
28
35
|
next_: nil,
|
36
|
+
# Schedule of the subscription.
|
29
37
|
schedule: nil,
|
30
38
|
request_options: {}
|
31
39
|
)
|
32
40
|
end
|
33
41
|
|
42
|
+
# List the subscriptions associated with the current user.
|
34
43
|
sig do
|
35
44
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
36
45
|
.returns(TerminalShop::Models::SubscriptionListResponse)
|
@@ -38,6 +47,7 @@ module TerminalShop
|
|
38
47
|
def list(request_options: {})
|
39
48
|
end
|
40
49
|
|
50
|
+
# Cancel a subscription for the current user.
|
41
51
|
sig do
|
42
52
|
params(
|
43
53
|
id: String,
|
@@ -45,9 +55,14 @@ module TerminalShop
|
|
45
55
|
)
|
46
56
|
.returns(TerminalShop::Models::SubscriptionDeleteResponse)
|
47
57
|
end
|
48
|
-
def delete(
|
58
|
+
def delete(
|
59
|
+
# ID of the subscription to cancel.
|
60
|
+
id,
|
61
|
+
request_options: {}
|
62
|
+
)
|
49
63
|
end
|
50
64
|
|
65
|
+
# Get the subscription with the given ID.
|
51
66
|
sig do
|
52
67
|
params(
|
53
68
|
id: String,
|
@@ -55,7 +70,11 @@ module TerminalShop
|
|
55
70
|
)
|
56
71
|
.returns(TerminalShop::Models::SubscriptionGetResponse)
|
57
72
|
end
|
58
|
-
def get(
|
73
|
+
def get(
|
74
|
+
# ID of the subscription to get.
|
75
|
+
id,
|
76
|
+
request_options: {}
|
77
|
+
)
|
59
78
|
end
|
60
79
|
|
61
80
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class Token
|
6
|
+
# Create a personal access token.
|
6
7
|
sig do
|
7
8
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
8
9
|
.returns(TerminalShop::Models::TokenCreateResponse)
|
@@ -10,6 +11,7 @@ module TerminalShop
|
|
10
11
|
def create(request_options: {})
|
11
12
|
end
|
12
13
|
|
14
|
+
# List the current user's personal access tokens.
|
13
15
|
sig do
|
14
16
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
15
17
|
.returns(TerminalShop::Models::TokenListResponse)
|
@@ -17,6 +19,7 @@ module TerminalShop
|
|
17
19
|
def list(request_options: {})
|
18
20
|
end
|
19
21
|
|
22
|
+
# Delete the personal access token with the given ID.
|
20
23
|
sig do
|
21
24
|
params(
|
22
25
|
id: String,
|
@@ -24,9 +27,14 @@ module TerminalShop
|
|
24
27
|
)
|
25
28
|
.returns(TerminalShop::Models::TokenDeleteResponse)
|
26
29
|
end
|
27
|
-
def delete(
|
30
|
+
def delete(
|
31
|
+
# ID of the personal token to delete.
|
32
|
+
id,
|
33
|
+
request_options: {}
|
34
|
+
)
|
28
35
|
end
|
29
36
|
|
37
|
+
# Get the personal access token with the given ID.
|
30
38
|
sig do
|
31
39
|
params(
|
32
40
|
id: String,
|
@@ -34,7 +42,11 @@ module TerminalShop
|
|
34
42
|
)
|
35
43
|
.returns(TerminalShop::Models::TokenGetResponse)
|
36
44
|
end
|
37
|
-
def get(
|
45
|
+
def get(
|
46
|
+
# ID of the personal token to get.
|
47
|
+
id,
|
48
|
+
request_options: {}
|
49
|
+
)
|
38
50
|
end
|
39
51
|
|
40
52
|
sig { params(client: TerminalShop::Client).returns(T.attached_class) }
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module TerminalShop
|
4
4
|
module Resources
|
5
5
|
class View
|
6
|
+
# Get initial app data, including user, products, cart, addresses, cards,
|
7
|
+
# subscriptions, and orders.
|
6
8
|
sig do
|
7
9
|
params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
|
8
10
|
.returns(TerminalShop::Models::ViewInitResponse)
|