terminal-shop 3.6.1 → 3.7.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/CHANGELOG.md +34 -0
- data/README.md +3 -3
- data/lib/terminal_shop/errors.rb +1 -1
- data/lib/terminal_shop/file_part.rb +2 -2
- data/lib/terminal_shop/internal/transport/base_client.rb +77 -5
- data/lib/terminal_shop/internal/transport/pooled_net_requester.rb +14 -0
- data/lib/terminal_shop/internal/type/array_of.rb +1 -1
- data/lib/terminal_shop/internal/type/base_model.rb +62 -30
- data/lib/terminal_shop/internal/type/converter.rb +18 -0
- data/lib/terminal_shop/internal/type/enum.rb +5 -4
- data/lib/terminal_shop/internal/type/hash_of.rb +1 -1
- data/lib/terminal_shop/internal/type/request_parameters.rb +4 -4
- data/lib/terminal_shop/internal/type/union.rb +1 -0
- data/lib/terminal_shop/internal/util.rb +57 -1
- data/lib/terminal_shop/internal.rb +6 -0
- data/lib/terminal_shop/models/address.rb +3 -3
- data/lib/terminal_shop/models/address_get_response.rb +3 -3
- data/lib/terminal_shop/models/address_list_response.rb +3 -3
- data/lib/terminal_shop/models/app.rb +3 -3
- data/lib/terminal_shop/models/app_get_response.rb +3 -3
- data/lib/terminal_shop/models/app_list_response.rb +3 -3
- data/lib/terminal_shop/models/card.rb +7 -7
- data/lib/terminal_shop/models/card_collect_response.rb +0 -1
- data/lib/terminal_shop/models/card_create_params.rb +0 -1
- data/lib/terminal_shop/models/card_get_response.rb +3 -3
- data/lib/terminal_shop/models/card_list_response.rb +3 -3
- data/lib/terminal_shop/models/cart.rb +13 -13
- data/lib/terminal_shop/models/cart_convert_response.rb +3 -3
- data/lib/terminal_shop/models/cart_get_response.rb +3 -3
- data/lib/terminal_shop/models/cart_set_item_response.rb +3 -3
- data/lib/terminal_shop/models/order.rb +24 -24
- data/lib/terminal_shop/models/order_get_response.rb +3 -3
- data/lib/terminal_shop/models/order_list_response.rb +3 -3
- data/lib/terminal_shop/models/product.rb +14 -14
- data/lib/terminal_shop/models/product_get_response.rb +3 -3
- data/lib/terminal_shop/models/product_list_response.rb +3 -3
- data/lib/terminal_shop/models/product_variant.rb +6 -6
- data/lib/terminal_shop/models/profile.rb +6 -6
- data/lib/terminal_shop/models/profile_me_response.rb +3 -3
- data/lib/terminal_shop/models/profile_update_response.rb +3 -3
- data/lib/terminal_shop/models/subscription.rb +18 -9
- data/lib/terminal_shop/models/subscription_get_response.rb +3 -3
- data/lib/terminal_shop/models/subscription_list_response.rb +3 -3
- data/lib/terminal_shop/models/subscription_update_params.rb +15 -6
- data/lib/terminal_shop/models/subscription_update_response.rb +3 -3
- data/lib/terminal_shop/models/token.rb +3 -3
- data/lib/terminal_shop/models/token_create_response.rb +0 -1
- data/lib/terminal_shop/models/token_get_response.rb +3 -4
- data/lib/terminal_shop/models/token_list_response.rb +3 -3
- data/lib/terminal_shop/models/view_init_response.rb +30 -31
- data/lib/terminal_shop/models.rb +27 -0
- data/lib/terminal_shop/request_options.rb +4 -0
- data/lib/terminal_shop/resources/address.rb +1 -1
- data/lib/terminal_shop/resources/app.rb +1 -1
- data/lib/terminal_shop/resources/card.rb +1 -2
- data/lib/terminal_shop/resources/cart.rb +3 -3
- data/lib/terminal_shop/resources/email.rb +1 -1
- data/lib/terminal_shop/resources/order.rb +1 -1
- data/lib/terminal_shop/resources/profile.rb +1 -1
- data/lib/terminal_shop/resources/subscription.rb +5 -5
- data/lib/terminal_shop/version.rb +1 -1
- data/lib/terminal_shop.rb +3 -0
- data/rbi/terminal_shop/client.rbi +9 -5
- data/rbi/terminal_shop/errors.rbi +35 -16
- data/rbi/terminal_shop/file_part.rbi +9 -6
- data/rbi/terminal_shop/internal/transport/base_client.rbi +165 -77
- data/rbi/terminal_shop/internal/transport/pooled_net_requester.rbi +29 -13
- data/rbi/terminal_shop/internal/type/array_of.rbi +34 -24
- data/rbi/terminal_shop/internal/type/base_model.rbi +155 -70
- data/rbi/terminal_shop/internal/type/base_page.rbi +13 -8
- data/rbi/terminal_shop/internal/type/boolean.rbi +16 -14
- data/rbi/terminal_shop/internal/type/converter.rbi +72 -28
- data/rbi/terminal_shop/internal/type/enum.rbi +24 -13
- data/rbi/terminal_shop/internal/type/file_input.rbi +8 -4
- data/rbi/terminal_shop/internal/type/hash_of.rbi +34 -24
- data/rbi/terminal_shop/internal/type/request_parameters.rbi +14 -4
- data/rbi/terminal_shop/internal/type/union.rbi +53 -22
- data/rbi/terminal_shop/internal/type/unknown.rbi +16 -6
- data/rbi/terminal_shop/internal/util.rbi +236 -91
- data/rbi/terminal_shop/internal.rbi +2 -0
- data/rbi/terminal_shop/models/address.rbi +25 -19
- data/rbi/terminal_shop/models/address_create_params.rbi +28 -19
- data/rbi/terminal_shop/models/address_create_response.rbi +14 -3
- data/rbi/terminal_shop/models/address_delete_params.rbi +18 -5
- data/rbi/terminal_shop/models/address_delete_response.rbi +13 -3
- data/rbi/terminal_shop/models/address_get_params.rbi +15 -5
- data/rbi/terminal_shop/models/address_get_response.rbi +17 -7
- data/rbi/terminal_shop/models/address_list_params.rbi +18 -5
- data/rbi/terminal_shop/models/address_list_response.rbi +18 -6
- data/rbi/terminal_shop/models/app.rbi +23 -4
- data/rbi/terminal_shop/models/app_create_params.rbi +18 -6
- data/rbi/terminal_shop/models/app_create_response.rbi +37 -9
- data/rbi/terminal_shop/models/app_delete_params.rbi +15 -5
- data/rbi/terminal_shop/models/app_delete_response.rbi +13 -3
- data/rbi/terminal_shop/models/app_get_params.rbi +15 -5
- data/rbi/terminal_shop/models/app_get_response.rbi +17 -7
- data/rbi/terminal_shop/models/app_list_params.rbi +15 -5
- data/rbi/terminal_shop/models/app_list_response.rbi +18 -6
- data/rbi/terminal_shop/models/card.rbi +37 -14
- data/rbi/terminal_shop/models/card_collect_params.rbi +18 -5
- data/rbi/terminal_shop/models/card_collect_response.rbi +40 -9
- data/rbi/terminal_shop/models/card_create_params.rbi +17 -6
- data/rbi/terminal_shop/models/card_create_response.rbi +14 -3
- data/rbi/terminal_shop/models/card_delete_params.rbi +15 -5
- data/rbi/terminal_shop/models/card_delete_response.rbi +13 -3
- data/rbi/terminal_shop/models/card_get_params.rbi +15 -5
- data/rbi/terminal_shop/models/card_get_response.rbi +17 -7
- data/rbi/terminal_shop/models/card_list_params.rbi +15 -5
- data/rbi/terminal_shop/models/card_list_response.rbi +18 -6
- data/rbi/terminal_shop/models/cart.rbi +93 -36
- data/rbi/terminal_shop/models/cart_clear_params.rbi +15 -5
- data/rbi/terminal_shop/models/cart_clear_response.rbi +13 -3
- data/rbi/terminal_shop/models/cart_convert_params.rbi +18 -5
- data/rbi/terminal_shop/models/cart_convert_response.rbi +17 -7
- data/rbi/terminal_shop/models/cart_get_params.rbi +15 -5
- data/rbi/terminal_shop/models/cart_get_response.rbi +17 -7
- data/rbi/terminal_shop/models/cart_set_address_params.rbi +20 -6
- data/rbi/terminal_shop/models/cart_set_address_response.rbi +13 -3
- data/rbi/terminal_shop/models/cart_set_card_params.rbi +20 -6
- data/rbi/terminal_shop/models/cart_set_card_response.rbi +13 -3
- data/rbi/terminal_shop/models/cart_set_item_params.rbi +22 -11
- data/rbi/terminal_shop/models/cart_set_item_response.rbi +17 -7
- data/rbi/terminal_shop/models/email_create_params.rbi +20 -6
- data/rbi/terminal_shop/models/email_create_response.rbi +13 -3
- data/rbi/terminal_shop/models/order.rbi +172 -87
- data/rbi/terminal_shop/models/order_create_params.rbi +23 -14
- data/rbi/terminal_shop/models/order_create_response.rbi +14 -3
- data/rbi/terminal_shop/models/order_get_params.rbi +15 -5
- data/rbi/terminal_shop/models/order_get_response.rbi +17 -7
- data/rbi/terminal_shop/models/order_list_params.rbi +15 -5
- data/rbi/terminal_shop/models/order_list_response.rbi +18 -6
- data/rbi/terminal_shop/models/product.rbi +78 -44
- data/rbi/terminal_shop/models/product_get_params.rbi +15 -5
- data/rbi/terminal_shop/models/product_get_response.rbi +17 -7
- data/rbi/terminal_shop/models/product_list_params.rbi +18 -5
- data/rbi/terminal_shop/models/product_list_response.rbi +18 -6
- data/rbi/terminal_shop/models/product_variant.rbi +46 -15
- data/rbi/terminal_shop/models/profile.rbi +39 -21
- data/rbi/terminal_shop/models/profile_me_params.rbi +15 -5
- data/rbi/terminal_shop/models/profile_me_response.rbi +17 -7
- data/rbi/terminal_shop/models/profile_update_params.rbi +23 -6
- data/rbi/terminal_shop/models/profile_update_response.rbi +17 -7
- data/rbi/terminal_shop/models/region.rbi +7 -6
- data/rbi/terminal_shop/models/subscription.rbi +82 -46
- data/rbi/terminal_shop/models/subscription_create_params.rbi +18 -5
- data/rbi/terminal_shop/models/subscription_create_response.rbi +13 -3
- data/rbi/terminal_shop/models/subscription_delete_params.rbi +18 -5
- data/rbi/terminal_shop/models/subscription_delete_response.rbi +13 -3
- data/rbi/terminal_shop/models/subscription_get_params.rbi +18 -5
- data/rbi/terminal_shop/models/subscription_get_response.rbi +19 -7
- data/rbi/terminal_shop/models/subscription_list_params.rbi +18 -5
- data/rbi/terminal_shop/models/subscription_list_response.rbi +20 -6
- data/rbi/terminal_shop/models/subscription_update_params.rbi +81 -42
- data/rbi/terminal_shop/models/subscription_update_response.rbi +19 -7
- data/rbi/terminal_shop/models/token.rbi +16 -4
- data/rbi/terminal_shop/models/token_create_params.rbi +18 -5
- data/rbi/terminal_shop/models/token_create_response.rbi +39 -9
- data/rbi/terminal_shop/models/token_delete_params.rbi +18 -5
- data/rbi/terminal_shop/models/token_delete_response.rbi +13 -3
- data/rbi/terminal_shop/models/token_get_params.rbi +15 -5
- data/rbi/terminal_shop/models/token_get_response.rbi +17 -7
- data/rbi/terminal_shop/models/token_list_params.rbi +15 -5
- data/rbi/terminal_shop/models/token_list_response.rbi +18 -6
- data/rbi/terminal_shop/models/view_init_params.rbi +15 -5
- data/rbi/terminal_shop/models/view_init_response.rbi +72 -47
- data/rbi/terminal_shop/request_options.rbi +18 -7
- data/rbi/terminal_shop/resources/address.rbi +28 -13
- data/rbi/terminal_shop/resources/app.rbi +30 -12
- data/rbi/terminal_shop/resources/card.rbi +37 -14
- data/rbi/terminal_shop/resources/cart.rbi +45 -16
- data/rbi/terminal_shop/resources/email.rbi +9 -4
- data/rbi/terminal_shop/resources/order.rbi +21 -10
- data/rbi/terminal_shop/resources/product.rbi +16 -6
- data/rbi/terminal_shop/resources/profile.rbi +16 -6
- data/rbi/terminal_shop/resources/subscription.rbi +43 -27
- data/rbi/terminal_shop/resources/token.rbi +30 -11
- data/rbi/terminal_shop/resources/view.rbi +9 -3
- data/sig/terminal_shop/internal/transport/base_client.rbs +16 -1
- data/sig/terminal_shop/internal/transport/pooled_net_requester.rbs +2 -0
- data/sig/terminal_shop/internal/type/base_model.rbs +11 -5
- data/sig/terminal_shop/internal/type/base_page.rbs +1 -1
- data/sig/terminal_shop/internal/type/converter.rbs +2 -0
- data/sig/terminal_shop/internal/type/enum.rbs +1 -0
- data/sig/terminal_shop/internal/type/request_parameters.rbs +5 -1
- data/sig/terminal_shop/internal/type/union.rbs +1 -0
- data/sig/terminal_shop/internal/util.rbs +13 -0
- data/sig/terminal_shop/internal.rbs +2 -0
- data/sig/terminal_shop/models/address.rbs +0 -2
- data/sig/terminal_shop/models/address_create_params.rbs +0 -2
- data/sig/terminal_shop/models/address_create_response.rbs +0 -2
- data/sig/terminal_shop/models/address_delete_params.rbs +0 -2
- data/sig/terminal_shop/models/address_delete_response.rbs +0 -2
- data/sig/terminal_shop/models/address_get_params.rbs +0 -2
- data/sig/terminal_shop/models/address_get_response.rbs +3 -5
- data/sig/terminal_shop/models/address_list_params.rbs +0 -2
- data/sig/terminal_shop/models/address_list_response.rbs +3 -6
- data/sig/terminal_shop/models/app.rbs +0 -2
- data/sig/terminal_shop/models/app_create_params.rbs +0 -2
- data/sig/terminal_shop/models/app_create_response.rbs +0 -4
- data/sig/terminal_shop/models/app_delete_params.rbs +0 -2
- data/sig/terminal_shop/models/app_delete_response.rbs +0 -2
- data/sig/terminal_shop/models/app_get_params.rbs +0 -2
- data/sig/terminal_shop/models/app_get_response.rbs +3 -5
- data/sig/terminal_shop/models/app_list_params.rbs +0 -2
- data/sig/terminal_shop/models/app_list_response.rbs +3 -5
- data/sig/terminal_shop/models/card.rbs +3 -7
- data/sig/terminal_shop/models/card_collect_params.rbs +0 -2
- data/sig/terminal_shop/models/card_collect_response.rbs +0 -4
- data/sig/terminal_shop/models/card_create_params.rbs +0 -2
- data/sig/terminal_shop/models/card_create_response.rbs +0 -2
- data/sig/terminal_shop/models/card_delete_params.rbs +0 -2
- data/sig/terminal_shop/models/card_delete_response.rbs +0 -2
- data/sig/terminal_shop/models/card_get_params.rbs +0 -2
- data/sig/terminal_shop/models/card_get_response.rbs +3 -5
- data/sig/terminal_shop/models/card_list_params.rbs +0 -2
- data/sig/terminal_shop/models/card_list_response.rbs +3 -5
- data/sig/terminal_shop/models/cart.rbs +11 -19
- data/sig/terminal_shop/models/cart_clear_params.rbs +0 -2
- data/sig/terminal_shop/models/cart_clear_response.rbs +0 -2
- data/sig/terminal_shop/models/cart_convert_params.rbs +0 -2
- data/sig/terminal_shop/models/cart_convert_response.rbs +3 -5
- data/sig/terminal_shop/models/cart_get_params.rbs +0 -2
- data/sig/terminal_shop/models/cart_get_response.rbs +3 -5
- data/sig/terminal_shop/models/cart_set_address_params.rbs +0 -2
- data/sig/terminal_shop/models/cart_set_address_response.rbs +0 -2
- data/sig/terminal_shop/models/cart_set_card_params.rbs +0 -2
- data/sig/terminal_shop/models/cart_set_card_response.rbs +0 -2
- data/sig/terminal_shop/models/cart_set_item_params.rbs +0 -2
- data/sig/terminal_shop/models/cart_set_item_response.rbs +3 -5
- data/sig/terminal_shop/models/email_create_params.rbs +0 -2
- data/sig/terminal_shop/models/email_create_response.rbs +0 -2
- data/sig/terminal_shop/models/order.rbs +18 -28
- data/sig/terminal_shop/models/order_create_params.rbs +0 -2
- data/sig/terminal_shop/models/order_create_response.rbs +0 -2
- data/sig/terminal_shop/models/order_get_params.rbs +0 -2
- data/sig/terminal_shop/models/order_get_response.rbs +3 -5
- data/sig/terminal_shop/models/order_list_params.rbs +0 -2
- data/sig/terminal_shop/models/order_list_response.rbs +3 -5
- data/sig/terminal_shop/models/product.rbs +14 -18
- data/sig/terminal_shop/models/product_get_params.rbs +0 -2
- data/sig/terminal_shop/models/product_get_response.rbs +3 -5
- data/sig/terminal_shop/models/product_list_params.rbs +0 -2
- data/sig/terminal_shop/models/product_list_response.rbs +3 -6
- data/sig/terminal_shop/models/product_variant.rbs +5 -9
- data/sig/terminal_shop/models/profile.rbs +3 -7
- data/sig/terminal_shop/models/profile_me_params.rbs +0 -2
- data/sig/terminal_shop/models/profile_me_response.rbs +3 -5
- data/sig/terminal_shop/models/profile_update_params.rbs +0 -2
- data/sig/terminal_shop/models/profile_update_response.rbs +3 -5
- data/sig/terminal_shop/models/subscription.rbs +8 -14
- data/sig/terminal_shop/models/subscription_create_params.rbs +0 -2
- data/sig/terminal_shop/models/subscription_create_response.rbs +0 -2
- data/sig/terminal_shop/models/subscription_delete_params.rbs +0 -2
- data/sig/terminal_shop/models/subscription_delete_response.rbs +0 -2
- data/sig/terminal_shop/models/subscription_get_params.rbs +0 -2
- data/sig/terminal_shop/models/subscription_get_response.rbs +3 -6
- data/sig/terminal_shop/models/subscription_list_params.rbs +0 -2
- data/sig/terminal_shop/models/subscription_list_response.rbs +3 -7
- data/sig/terminal_shop/models/subscription_update_params.rbs +3 -9
- data/sig/terminal_shop/models/subscription_update_response.rbs +3 -6
- data/sig/terminal_shop/models/token.rbs +0 -2
- data/sig/terminal_shop/models/token_create_params.rbs +0 -2
- data/sig/terminal_shop/models/token_create_response.rbs +0 -4
- data/sig/terminal_shop/models/token_delete_params.rbs +0 -2
- data/sig/terminal_shop/models/token_delete_response.rbs +0 -2
- data/sig/terminal_shop/models/token_get_params.rbs +0 -2
- data/sig/terminal_shop/models/token_get_response.rbs +3 -5
- data/sig/terminal_shop/models/token_list_params.rbs +0 -2
- data/sig/terminal_shop/models/token_list_response.rbs +3 -5
- data/sig/terminal_shop/models/view_init_params.rbs +0 -2
- data/sig/terminal_shop/models/view_init_response.rbs +27 -31
- data/sig/terminal_shop/request_options.rbs +1 -1
- metadata +2 -2
@@ -7,11 +7,11 @@ module TerminalShop
|
|
7
7
|
# @!attribute data
|
8
8
|
# Subscription to a Terminal shop product.
|
9
9
|
#
|
10
|
-
# @return [TerminalShop::
|
11
|
-
required :data, -> { TerminalShop::
|
10
|
+
# @return [TerminalShop::SubscriptionAPI]
|
11
|
+
required :data, -> { TerminalShop::SubscriptionAPI }
|
12
12
|
|
13
13
|
# @!method initialize(data:)
|
14
|
-
# @param data [TerminalShop::
|
14
|
+
# @param data [TerminalShop::SubscriptionAPI] Subscription to a Terminal shop product.
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -7,11 +7,11 @@ module TerminalShop
|
|
7
7
|
# @!attribute data
|
8
8
|
# List of subscriptions.
|
9
9
|
#
|
10
|
-
# @return [Array<TerminalShop::
|
11
|
-
required :data, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::
|
10
|
+
# @return [Array<TerminalShop::SubscriptionAPI>]
|
11
|
+
required :data, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::SubscriptionAPI] }
|
12
12
|
|
13
13
|
# @!method initialize(data:)
|
14
|
-
# @param data [Array<TerminalShop::
|
14
|
+
# @param data [Array<TerminalShop::SubscriptionAPI>] List of subscriptions.
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -22,15 +22,15 @@ module TerminalShop
|
|
22
22
|
# @!attribute schedule
|
23
23
|
# New schedule for the subscription.
|
24
24
|
#
|
25
|
-
# @return [TerminalShop::
|
26
|
-
optional :schedule, union: -> { TerminalShop::
|
25
|
+
# @return [TerminalShop::SubscriptionUpdateParams::Schedule::Fixed, TerminalShop::SubscriptionUpdateParams::Schedule::Weekly, nil]
|
26
|
+
optional :schedule, union: -> { TerminalShop::SubscriptionUpdateParams::Schedule }
|
27
27
|
|
28
28
|
# @!method initialize(address_id: nil, card_id: nil, schedule: nil, request_options: {})
|
29
29
|
# @param address_id [String] New shipping address ID for the subscription.
|
30
30
|
#
|
31
31
|
# @param card_id [String] New payment method ID for the subscription.
|
32
32
|
#
|
33
|
-
# @param schedule [TerminalShop::
|
33
|
+
# @param schedule [TerminalShop::SubscriptionUpdateParams::Schedule::Fixed, TerminalShop::SubscriptionUpdateParams::Schedule::Weekly] New schedule for the subscription.
|
34
34
|
#
|
35
35
|
# @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
|
36
36
|
|
@@ -38,9 +38,9 @@ module TerminalShop
|
|
38
38
|
module Schedule
|
39
39
|
extend TerminalShop::Internal::Type::Union
|
40
40
|
|
41
|
-
variant -> { TerminalShop::
|
41
|
+
variant -> { TerminalShop::SubscriptionUpdateParams::Schedule::Fixed }
|
42
42
|
|
43
|
-
variant -> { TerminalShop::
|
43
|
+
variant -> { TerminalShop::SubscriptionUpdateParams::Schedule::Weekly }
|
44
44
|
|
45
45
|
class Fixed < TerminalShop::Internal::Type::BaseModel
|
46
46
|
# @!attribute type
|
@@ -69,7 +69,16 @@ module TerminalShop
|
|
69
69
|
end
|
70
70
|
|
71
71
|
# @!method self.variants
|
72
|
-
# @return [Array(TerminalShop::
|
72
|
+
# @return [Array(TerminalShop::SubscriptionUpdateParams::Schedule::Fixed, TerminalShop::SubscriptionUpdateParams::Schedule::Weekly)]
|
73
|
+
|
74
|
+
define_sorbet_constant!(:Variants) do
|
75
|
+
T.type_alias do
|
76
|
+
T.any(
|
77
|
+
TerminalShop::SubscriptionUpdateParams::Schedule::Fixed,
|
78
|
+
TerminalShop::SubscriptionUpdateParams::Schedule::Weekly
|
79
|
+
)
|
80
|
+
end
|
81
|
+
end
|
73
82
|
end
|
74
83
|
end
|
75
84
|
end
|
@@ -7,11 +7,11 @@ module TerminalShop
|
|
7
7
|
# @!attribute data
|
8
8
|
# Subscription to a Terminal shop product.
|
9
9
|
#
|
10
|
-
# @return [TerminalShop::
|
11
|
-
required :data, -> { TerminalShop::
|
10
|
+
# @return [TerminalShop::SubscriptionAPI]
|
11
|
+
required :data, -> { TerminalShop::SubscriptionAPI }
|
12
12
|
|
13
13
|
# @!method initialize(data:)
|
14
|
-
# @param data [TerminalShop::
|
14
|
+
# @param data [TerminalShop::SubscriptionAPI] Subscription to a Terminal shop product.
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -22,13 +22,13 @@ module TerminalShop
|
|
22
22
|
required :created, String
|
23
23
|
|
24
24
|
# @!method initialize(id:, token:, created:)
|
25
|
-
# Some parameter documentations has been truncated, see
|
26
|
-
#
|
25
|
+
# Some parameter documentations has been truncated, see {TerminalShop::TokenAPI}
|
26
|
+
# for more details.
|
27
27
|
#
|
28
28
|
# A personal access token used to access the Terminal API. If you leak this,
|
29
29
|
# expect large sums of coffee to be ordered on your credit card.
|
30
30
|
#
|
31
|
-
# @param id [String] Unique object identifier.
|
31
|
+
# @param id [String] Unique object identifier.
|
32
32
|
#
|
33
33
|
# @param token [String] Personal access token (obfuscated).
|
34
34
|
#
|
@@ -8,15 +8,14 @@ module TerminalShop
|
|
8
8
|
# A personal access token used to access the Terminal API. If you leak this,
|
9
9
|
# expect large sums of coffee to be ordered on your credit card.
|
10
10
|
#
|
11
|
-
# @return [TerminalShop::
|
12
|
-
required :data, -> { TerminalShop::
|
11
|
+
# @return [TerminalShop::TokenAPI]
|
12
|
+
required :data, -> { TerminalShop::TokenAPI }
|
13
13
|
|
14
14
|
# @!method initialize(data:)
|
15
15
|
# Some parameter documentations has been truncated, see
|
16
16
|
# {TerminalShop::Models::TokenGetResponse} for more details.
|
17
17
|
#
|
18
|
-
# @param data [TerminalShop::
|
19
|
-
# ...
|
18
|
+
# @param data [TerminalShop::TokenAPI] A personal access token used to access the Terminal API. If you leak this, expec
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
@@ -7,11 +7,11 @@ module TerminalShop
|
|
7
7
|
# @!attribute data
|
8
8
|
# List of personal access tokens.
|
9
9
|
#
|
10
|
-
# @return [Array<TerminalShop::
|
11
|
-
required :data, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::
|
10
|
+
# @return [Array<TerminalShop::TokenAPI>]
|
11
|
+
required :data, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::TokenAPI] }
|
12
12
|
|
13
13
|
# @!method initialize(data:)
|
14
|
-
# @param data [Array<TerminalShop::
|
14
|
+
# @param data [Array<TerminalShop::TokenAPI>] List of personal access tokens.
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -17,80 +17,79 @@ module TerminalShop
|
|
17
17
|
class Data < TerminalShop::Internal::Type::BaseModel
|
18
18
|
# @!attribute addresses
|
19
19
|
#
|
20
|
-
# @return [Array<TerminalShop::
|
21
|
-
required :addresses, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::
|
20
|
+
# @return [Array<TerminalShop::AddressAPI>]
|
21
|
+
required :addresses, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::AddressAPI] }
|
22
22
|
|
23
23
|
# @!attribute apps
|
24
24
|
#
|
25
|
-
# @return [Array<TerminalShop::
|
26
|
-
required :apps, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::
|
25
|
+
# @return [Array<TerminalShop::AppAPI>]
|
26
|
+
required :apps, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::AppAPI] }
|
27
27
|
|
28
28
|
# @!attribute cards
|
29
29
|
#
|
30
|
-
# @return [Array<TerminalShop::
|
31
|
-
required :cards, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::
|
30
|
+
# @return [Array<TerminalShop::CardAPI>]
|
31
|
+
required :cards, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::CardAPI] }
|
32
32
|
|
33
33
|
# @!attribute cart
|
34
34
|
# The current Terminal shop user's cart.
|
35
35
|
#
|
36
|
-
# @return [TerminalShop::
|
37
|
-
required :cart, -> { TerminalShop::
|
36
|
+
# @return [TerminalShop::CartAPI]
|
37
|
+
required :cart, -> { TerminalShop::CartAPI }
|
38
38
|
|
39
39
|
# @!attribute orders
|
40
40
|
#
|
41
|
-
# @return [Array<TerminalShop::
|
42
|
-
required :orders, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::
|
41
|
+
# @return [Array<TerminalShop::OrderAPI>]
|
42
|
+
required :orders, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::OrderAPI] }
|
43
43
|
|
44
44
|
# @!attribute products
|
45
45
|
#
|
46
|
-
# @return [Array<TerminalShop::
|
47
|
-
required :products, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::
|
46
|
+
# @return [Array<TerminalShop::ProductAPI>]
|
47
|
+
required :products, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::ProductAPI] }
|
48
48
|
|
49
49
|
# @!attribute profile
|
50
50
|
# A Terminal shop user's profile. (We have users, btw.)
|
51
51
|
#
|
52
|
-
# @return [TerminalShop::
|
53
|
-
required :profile, -> { TerminalShop::
|
52
|
+
# @return [TerminalShop::ProfileAPI]
|
53
|
+
required :profile, -> { TerminalShop::ProfileAPI }
|
54
54
|
|
55
55
|
# @!attribute region
|
56
56
|
# A Terminal shop user's region.
|
57
57
|
#
|
58
|
-
# @return [Symbol, TerminalShop::
|
59
|
-
required :region, enum: -> { TerminalShop::
|
58
|
+
# @return [Symbol, TerminalShop::Region]
|
59
|
+
required :region, enum: -> { TerminalShop::Region }
|
60
60
|
|
61
61
|
# @!attribute subscriptions
|
62
62
|
#
|
63
|
-
# @return [Array<TerminalShop::
|
64
|
-
required :subscriptions,
|
65
|
-
-> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::Models::SubscriptionAPI] }
|
63
|
+
# @return [Array<TerminalShop::SubscriptionAPI>]
|
64
|
+
required :subscriptions, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::SubscriptionAPI] }
|
66
65
|
|
67
66
|
# @!attribute tokens
|
68
67
|
#
|
69
|
-
# @return [Array<TerminalShop::
|
70
|
-
required :tokens, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::
|
68
|
+
# @return [Array<TerminalShop::TokenAPI>]
|
69
|
+
required :tokens, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::TokenAPI] }
|
71
70
|
|
72
71
|
# @!method initialize(addresses:, apps:, cards:, cart:, orders:, products:, profile:, region:, subscriptions:, tokens:)
|
73
72
|
# Initial app data.
|
74
73
|
#
|
75
|
-
# @param addresses [Array<TerminalShop::
|
74
|
+
# @param addresses [Array<TerminalShop::AddressAPI>]
|
76
75
|
#
|
77
|
-
# @param apps [Array<TerminalShop::
|
76
|
+
# @param apps [Array<TerminalShop::AppAPI>]
|
78
77
|
#
|
79
|
-
# @param cards [Array<TerminalShop::
|
78
|
+
# @param cards [Array<TerminalShop::CardAPI>]
|
80
79
|
#
|
81
|
-
# @param cart [TerminalShop::
|
80
|
+
# @param cart [TerminalShop::CartAPI] The current Terminal shop user's cart.
|
82
81
|
#
|
83
|
-
# @param orders [Array<TerminalShop::
|
82
|
+
# @param orders [Array<TerminalShop::OrderAPI>]
|
84
83
|
#
|
85
|
-
# @param products [Array<TerminalShop::
|
84
|
+
# @param products [Array<TerminalShop::ProductAPI>]
|
86
85
|
#
|
87
|
-
# @param profile [TerminalShop::
|
86
|
+
# @param profile [TerminalShop::ProfileAPI] A Terminal shop user's profile. (We have users, btw.)
|
88
87
|
#
|
89
|
-
# @param region [Symbol, TerminalShop::
|
88
|
+
# @param region [Symbol, TerminalShop::Region] A Terminal shop user's region.
|
90
89
|
#
|
91
|
-
# @param subscriptions [Array<TerminalShop::
|
90
|
+
# @param subscriptions [Array<TerminalShop::SubscriptionAPI>]
|
92
91
|
#
|
93
|
-
# @param tokens [Array<TerminalShop::
|
92
|
+
# @param tokens [Array<TerminalShop::TokenAPI>]
|
94
93
|
end
|
95
94
|
end
|
96
95
|
end
|
data/lib/terminal_shop/models.rb
CHANGED
@@ -1,6 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module TerminalShop
|
4
|
+
[TerminalShop::Internal::Type::BaseModel, *TerminalShop::Internal::Type::BaseModel.subclasses].each do |cls|
|
5
|
+
cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, TerminalShop::Internal::AnyHash) } }
|
6
|
+
end
|
7
|
+
|
8
|
+
[
|
9
|
+
*TerminalShop::Internal::Type::Enum.included_modules,
|
10
|
+
*TerminalShop::Internal::Type::Union.included_modules
|
11
|
+
].each do |cls|
|
12
|
+
cls.constants.each do |name|
|
13
|
+
case cls.const_get(name)
|
14
|
+
in true | false
|
15
|
+
cls.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, cls) } }
|
16
|
+
cls.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
|
17
|
+
in Integer
|
18
|
+
cls.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, cls) } }
|
19
|
+
cls.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
|
20
|
+
in Float
|
21
|
+
cls.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, cls) } }
|
22
|
+
cls.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
|
23
|
+
in Symbol
|
24
|
+
cls.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, cls) } }
|
25
|
+
cls.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
|
26
|
+
else
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
4
31
|
AddressAPI = TerminalShop::Models::AddressAPI
|
5
32
|
|
6
33
|
AddressCreateParams = TerminalShop::Models::AddressCreateParams
|
@@ -69,5 +69,9 @@ module TerminalShop
|
|
69
69
|
# Returns a new instance of RequestOptions.
|
70
70
|
#
|
71
71
|
# @param values [Hash{Symbol=>Object}]
|
72
|
+
|
73
|
+
define_sorbet_constant!(:OrHash) do
|
74
|
+
T.type_alias { T.any(TerminalShop::RequestOptions, TerminalShop::Internal::AnyHash) }
|
75
|
+
end
|
72
76
|
end
|
73
77
|
end
|
@@ -29,7 +29,7 @@ module TerminalShop
|
|
29
29
|
#
|
30
30
|
# @see TerminalShop::Models::AddressCreateParams
|
31
31
|
def create(params)
|
32
|
-
parsed, options = TerminalShop::
|
32
|
+
parsed, options = TerminalShop::AddressCreateParams.dump_request(params)
|
33
33
|
@client.request(
|
34
34
|
method: :post,
|
35
35
|
path: "address",
|
@@ -15,7 +15,7 @@ module TerminalShop
|
|
15
15
|
#
|
16
16
|
# @see TerminalShop::Models::AppCreateParams
|
17
17
|
def create(params)
|
18
|
-
parsed, options = TerminalShop::
|
18
|
+
parsed, options = TerminalShop::AppCreateParams.dump_request(params)
|
19
19
|
@client.request(
|
20
20
|
method: :post,
|
21
21
|
path: "app",
|
@@ -11,7 +11,6 @@ module TerminalShop
|
|
11
11
|
# @overload create(token:, request_options: {})
|
12
12
|
#
|
13
13
|
# @param token [String] Stripe card token. Learn how to [create one here](https://docs.stripe.com/api/to
|
14
|
-
# ...
|
15
14
|
#
|
16
15
|
# @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil]
|
17
16
|
#
|
@@ -19,7 +18,7 @@ module TerminalShop
|
|
19
18
|
#
|
20
19
|
# @see TerminalShop::Models::CardCreateParams
|
21
20
|
def create(params)
|
22
|
-
parsed, options = TerminalShop::
|
21
|
+
parsed, options = TerminalShop::CardCreateParams.dump_request(params)
|
23
22
|
@client.request(
|
24
23
|
method: :post,
|
25
24
|
path: "card",
|
@@ -69,7 +69,7 @@ module TerminalShop
|
|
69
69
|
#
|
70
70
|
# @see TerminalShop::Models::CartSetAddressParams
|
71
71
|
def set_address(params)
|
72
|
-
parsed, options = TerminalShop::
|
72
|
+
parsed, options = TerminalShop::CartSetAddressParams.dump_request(params)
|
73
73
|
@client.request(
|
74
74
|
method: :put,
|
75
75
|
path: "cart/address",
|
@@ -91,7 +91,7 @@ module TerminalShop
|
|
91
91
|
#
|
92
92
|
# @see TerminalShop::Models::CartSetCardParams
|
93
93
|
def set_card(params)
|
94
|
-
parsed, options = TerminalShop::
|
94
|
+
parsed, options = TerminalShop::CartSetCardParams.dump_request(params)
|
95
95
|
@client.request(
|
96
96
|
method: :put,
|
97
97
|
path: "cart/card",
|
@@ -115,7 +115,7 @@ module TerminalShop
|
|
115
115
|
#
|
116
116
|
# @see TerminalShop::Models::CartSetItemParams
|
117
117
|
def set_item(params)
|
118
|
-
parsed, options = TerminalShop::
|
118
|
+
parsed, options = TerminalShop::CartSetItemParams.dump_request(params)
|
119
119
|
@client.request(
|
120
120
|
method: :put,
|
121
121
|
path: "cart/item",
|
@@ -15,7 +15,7 @@ module TerminalShop
|
|
15
15
|
#
|
16
16
|
# @see TerminalShop::Models::EmailCreateParams
|
17
17
|
def create(params)
|
18
|
-
parsed, options = TerminalShop::
|
18
|
+
parsed, options = TerminalShop::EmailCreateParams.dump_request(params)
|
19
19
|
@client.request(
|
20
20
|
method: :post,
|
21
21
|
path: "email",
|
@@ -19,7 +19,7 @@ module TerminalShop
|
|
19
19
|
#
|
20
20
|
# @see TerminalShop::Models::OrderCreateParams
|
21
21
|
def create(params)
|
22
|
-
parsed, options = TerminalShop::
|
22
|
+
parsed, options = TerminalShop::OrderCreateParams.dump_request(params)
|
23
23
|
@client.request(
|
24
24
|
method: :post,
|
25
25
|
path: "order",
|
@@ -15,7 +15,7 @@ module TerminalShop
|
|
15
15
|
#
|
16
16
|
# @see TerminalShop::Models::ProfileUpdateParams
|
17
17
|
def update(params)
|
18
|
-
parsed, options = TerminalShop::
|
18
|
+
parsed, options = TerminalShop::ProfileUpdateParams.dump_request(params)
|
19
19
|
@client.request(
|
20
20
|
method: :put,
|
21
21
|
path: "profile",
|
@@ -10,7 +10,7 @@ module TerminalShop
|
|
10
10
|
#
|
11
11
|
# @overload create(id:, address_id:, card_id:, created:, price:, product_variant_id:, quantity:, next_: nil, schedule: nil, request_options: {})
|
12
12
|
#
|
13
|
-
# @param id [String] Unique object identifier.
|
13
|
+
# @param id [String] Unique object identifier.
|
14
14
|
#
|
15
15
|
# @param address_id [String] ID of the shipping address used for the subscription.
|
16
16
|
#
|
@@ -26,7 +26,7 @@ module TerminalShop
|
|
26
26
|
#
|
27
27
|
# @param next_ [String] Next shipment and billing date for the subscription.
|
28
28
|
#
|
29
|
-
# @param schedule [TerminalShop::
|
29
|
+
# @param schedule [TerminalShop::SubscriptionAPI::Schedule::Fixed, TerminalShop::SubscriptionAPI::Schedule::Weekly] Schedule of the subscription.
|
30
30
|
#
|
31
31
|
# @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil]
|
32
32
|
#
|
@@ -34,7 +34,7 @@ module TerminalShop
|
|
34
34
|
#
|
35
35
|
# @see TerminalShop::Models::SubscriptionCreateParams
|
36
36
|
def create(params)
|
37
|
-
parsed, options = TerminalShop::
|
37
|
+
parsed, options = TerminalShop::SubscriptionCreateParams.dump_request(params)
|
38
38
|
@client.request(
|
39
39
|
method: :post,
|
40
40
|
path: "subscription",
|
@@ -54,7 +54,7 @@ module TerminalShop
|
|
54
54
|
#
|
55
55
|
# @param card_id [String] New payment method ID for the subscription.
|
56
56
|
#
|
57
|
-
# @param schedule [TerminalShop::
|
57
|
+
# @param schedule [TerminalShop::SubscriptionUpdateParams::Schedule::Fixed, TerminalShop::SubscriptionUpdateParams::Schedule::Weekly] New schedule for the subscription.
|
58
58
|
#
|
59
59
|
# @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil]
|
60
60
|
#
|
@@ -62,7 +62,7 @@ module TerminalShop
|
|
62
62
|
#
|
63
63
|
# @see TerminalShop::Models::SubscriptionUpdateParams
|
64
64
|
def update(id, params = {})
|
65
|
-
parsed, options = TerminalShop::
|
65
|
+
parsed, options = TerminalShop::SubscriptionUpdateParams.dump_request(params)
|
66
66
|
@client.request(
|
67
67
|
method: :put,
|
68
68
|
path: ["subscription/%1$s", id],
|
data/lib/terminal_shop.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Standard libraries.
|
4
|
+
# rubocop:disable Lint/RedundantRequireStatement
|
4
5
|
require "English"
|
5
6
|
require "cgi"
|
6
7
|
require "date"
|
@@ -15,6 +16,7 @@ require "set"
|
|
15
16
|
require "stringio"
|
16
17
|
require "time"
|
17
18
|
require "uri"
|
19
|
+
# rubocop:enable Lint/RedundantRequireStatement
|
18
20
|
|
19
21
|
# We already ship the preferred sorbet manifests in the package itself.
|
20
22
|
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
|
@@ -131,6 +133,7 @@ require_relative "terminal_shop/models/token_list_params"
|
|
131
133
|
require_relative "terminal_shop/models/token_list_response"
|
132
134
|
require_relative "terminal_shop/models/view_init_params"
|
133
135
|
require_relative "terminal_shop/models/view_init_response"
|
136
|
+
require_relative "terminal_shop/models"
|
134
137
|
require_relative "terminal_shop/resources/address"
|
135
138
|
require_relative "terminal_shop/resources/app"
|
136
139
|
require_relative "terminal_shop/resources/card"
|
@@ -12,7 +12,10 @@ module TerminalShop
|
|
12
12
|
|
13
13
|
ENVIRONMENTS =
|
14
14
|
T.let(
|
15
|
-
{
|
15
|
+
{
|
16
|
+
production: "https://api.terminal.shop",
|
17
|
+
dev: "https://api.dev.terminal.shop"
|
18
|
+
},
|
16
19
|
T::Hash[Symbol, String]
|
17
20
|
)
|
18
21
|
|
@@ -57,7 +60,8 @@ module TerminalShop
|
|
57
60
|
|
58
61
|
# @api private
|
59
62
|
sig { override.returns(T::Hash[String, String]) }
|
60
|
-
private def auth_headers
|
63
|
+
private def auth_headers
|
64
|
+
end
|
61
65
|
|
62
66
|
# Creates and returns a new client for interacting with the API.
|
63
67
|
sig do
|
@@ -70,8 +74,7 @@ module TerminalShop
|
|
70
74
|
timeout: Float,
|
71
75
|
initial_retry_delay: Float,
|
72
76
|
max_retry_delay: Float
|
73
|
-
)
|
74
|
-
.returns(T.attached_class)
|
77
|
+
).returns(T.attached_class)
|
75
78
|
end
|
76
79
|
def self.new(
|
77
80
|
# Defaults to `ENV["TERMINAL_BEARER_TOKEN"]`
|
@@ -92,6 +95,7 @@ module TerminalShop
|
|
92
95
|
timeout: TerminalShop::Client::DEFAULT_TIMEOUT_IN_SECONDS,
|
93
96
|
initial_retry_delay: TerminalShop::Client::DEFAULT_INITIAL_RETRY_DELAY,
|
94
97
|
max_retry_delay: TerminalShop::Client::DEFAULT_MAX_RETRY_DELAY
|
95
|
-
)
|
98
|
+
)
|
99
|
+
end
|
96
100
|
end
|
97
101
|
end
|
@@ -29,10 +29,17 @@ module TerminalShop
|
|
29
29
|
request: NilClass,
|
30
30
|
response: NilClass,
|
31
31
|
message: T.nilable(String)
|
32
|
-
)
|
33
|
-
|
32
|
+
).returns(T.attached_class)
|
33
|
+
end
|
34
|
+
def self.new(
|
35
|
+
url:,
|
36
|
+
status: nil,
|
37
|
+
body: nil,
|
38
|
+
request: nil,
|
39
|
+
response: nil,
|
40
|
+
message: nil
|
41
|
+
)
|
34
42
|
end
|
35
|
-
def self.new(url:, status: nil, body: nil, request: nil, response: nil, message: nil); end
|
36
43
|
end
|
37
44
|
|
38
45
|
class APIConnectionError < TerminalShop::Errors::APIError
|
@@ -51,10 +58,16 @@ module TerminalShop
|
|
51
58
|
request: NilClass,
|
52
59
|
response: NilClass,
|
53
60
|
message: T.nilable(String)
|
54
|
-
)
|
55
|
-
.returns(T.attached_class)
|
61
|
+
).returns(T.attached_class)
|
56
62
|
end
|
57
|
-
def self.new(
|
63
|
+
def self.new(
|
64
|
+
url:,
|
65
|
+
status: nil,
|
66
|
+
body: nil,
|
67
|
+
request: nil,
|
68
|
+
response: nil,
|
69
|
+
message: "Connection error."
|
70
|
+
)
|
58
71
|
end
|
59
72
|
end
|
60
73
|
|
@@ -68,10 +81,16 @@ module TerminalShop
|
|
68
81
|
request: NilClass,
|
69
82
|
response: NilClass,
|
70
83
|
message: T.nilable(String)
|
71
|
-
)
|
72
|
-
.returns(T.attached_class)
|
84
|
+
).returns(T.attached_class)
|
73
85
|
end
|
74
|
-
def self.new(
|
86
|
+
def self.new(
|
87
|
+
url:,
|
88
|
+
status: nil,
|
89
|
+
body: nil,
|
90
|
+
request: nil,
|
91
|
+
response: nil,
|
92
|
+
message: "Request timed out."
|
93
|
+
)
|
75
94
|
end
|
76
95
|
end
|
77
96
|
|
@@ -85,10 +104,10 @@ module TerminalShop
|
|
85
104
|
request: NilClass,
|
86
105
|
response: NilClass,
|
87
106
|
message: T.nilable(String)
|
88
|
-
)
|
89
|
-
|
107
|
+
).returns(T.attached_class)
|
108
|
+
end
|
109
|
+
def self.for(url:, status:, body:, request:, response:, message: nil)
|
90
110
|
end
|
91
|
-
def self.for(url:, status:, body:, request:, response:, message: nil); end
|
92
111
|
|
93
112
|
sig { returns(Integer) }
|
94
113
|
attr_accessor :status
|
@@ -102,10 +121,10 @@ module TerminalShop
|
|
102
121
|
request: NilClass,
|
103
122
|
response: NilClass,
|
104
123
|
message: T.nilable(String)
|
105
|
-
)
|
106
|
-
|
124
|
+
).returns(T.attached_class)
|
125
|
+
end
|
126
|
+
def self.new(url:, status:, body:, request:, response:, message: nil)
|
107
127
|
end
|
108
|
-
def self.new(url:, status:, body:, request:, response:, message: nil); end
|
109
128
|
end
|
110
129
|
|
111
130
|
class BadRequestError < TerminalShop::Errors::APIStatusError
|
@@ -137,7 +156,7 @@ module TerminalShop
|
|
137
156
|
end
|
138
157
|
|
139
158
|
class InternalServerError < TerminalShop::Errors::APIStatusError
|
140
|
-
HTTP_STATUS = T.let(500
|
159
|
+
HTTP_STATUS = T.let((500..), T::Range[Integer])
|
141
160
|
end
|
142
161
|
end
|
143
162
|
end
|
@@ -13,22 +13,25 @@ module TerminalShop
|
|
13
13
|
|
14
14
|
# @api private
|
15
15
|
sig { returns(String) }
|
16
|
-
private def read
|
16
|
+
private def read
|
17
|
+
end
|
17
18
|
|
18
19
|
sig { params(a: T.anything).returns(String) }
|
19
|
-
def to_json(*a)
|
20
|
+
def to_json(*a)
|
21
|
+
end
|
20
22
|
|
21
23
|
sig { params(a: T.anything).returns(String) }
|
22
|
-
def to_yaml(*a)
|
24
|
+
def to_yaml(*a)
|
25
|
+
end
|
23
26
|
|
24
27
|
sig do
|
25
28
|
params(
|
26
29
|
content: T.any(Pathname, StringIO, IO, String),
|
27
30
|
filename: T.nilable(String),
|
28
31
|
content_type: T.nilable(String)
|
29
|
-
)
|
30
|
-
|
32
|
+
).returns(T.attached_class)
|
33
|
+
end
|
34
|
+
def self.new(content, filename: nil, content_type: nil)
|
31
35
|
end
|
32
|
-
def self.new(content, filename: nil, content_type: nil); end
|
33
36
|
end
|
34
37
|
end
|