terminal-shop 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/terminal-shop/models/cart.rb +3 -25
  3. data/lib/terminal-shop/models/{cart_remove_gift_card_params.rb → cart_clear_params.rb} +1 -1
  4. data/lib/terminal-shop/models/{cart_remove_gift_card_response.rb → cart_clear_response.rb} +1 -1
  5. data/lib/terminal-shop/models/cart_convert_params.rb +1 -11
  6. data/lib/terminal-shop/pooled_net_requester.rb +2 -19
  7. data/lib/terminal-shop/resources/cart.rb +18 -43
  8. data/lib/terminal-shop/version.rb +1 -1
  9. data/lib/terminal-shop.rb +2 -4
  10. data/rbi/lib/terminal-shop/models/cart.rbi +4 -29
  11. data/rbi/lib/terminal-shop/models/{cart_remove_gift_card_params.rbi → cart_clear_params.rbi} +1 -1
  12. data/rbi/lib/terminal-shop/models/{cart_remove_gift_card_response.rbi → cart_clear_response.rbi} +1 -1
  13. data/rbi/lib/terminal-shop/models/cart_convert_params.rbi +3 -14
  14. data/rbi/lib/terminal-shop/resources/cart.rbi +7 -20
  15. data/rbi/lib/terminal-shop/version.rbi +1 -1
  16. data/sig/terminal-shop/models/cart.rbs +2 -23
  17. data/sig/terminal-shop/models/{cart_remove_gift_card_params.rbs → cart_clear_params.rbs} +4 -4
  18. data/sig/terminal-shop/models/cart_clear_response.rbs +18 -0
  19. data/sig/terminal-shop/models/cart_convert_params.rbs +2 -10
  20. data/sig/terminal-shop/resources/cart.rbs +8 -20
  21. data/sig/terminal-shop/version.rbs +1 -1
  22. metadata +7 -13
  23. data/lib/terminal-shop/models/cart_redeem_gift_card_params.rb +0 -24
  24. data/lib/terminal-shop/models/cart_redeem_gift_card_response.rb +0 -48
  25. data/rbi/lib/terminal-shop/models/cart_redeem_gift_card_params.rbi +0 -32
  26. data/rbi/lib/terminal-shop/models/cart_redeem_gift_card_response.rbi +0 -66
  27. data/sig/terminal-shop/models/cart_redeem_gift_card_params.rbs +0 -25
  28. data/sig/terminal-shop/models/cart_redeem_gift_card_response.rbs +0 -47
  29. data/sig/terminal-shop/models/cart_remove_gift_card_response.rbs +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 974257e90aeb93cf152e34de6ea7351f727f6e6ee95e04415b290b90f648a251
4
- data.tar.gz: 7de2c3d22ad41f81fe735d5fb3018b99a9a15350c4faa35b4f316f4ab0ae822a
3
+ metadata.gz: 768bdcebc5333de72d3b2d85a3fa97bc1abd1c6c5ec5277db2c97c0b368f733a
4
+ data.tar.gz: bc4f2911f1d7b441ae52da8ea310e75597799eada64b31ea009f7a48f1035be9
5
5
  SHA512:
6
- metadata.gz: 8f6a23136217de3ea26e0bed3db6f7ca39ced5bd099b681fd3f61cc50fdc8b4eb8d3c48591049a7d19e21c107cf7abc576a1bc714bf012ec35a4fa7eda2a46cb
7
- data.tar.gz: e8145d5a065574cf2f972f33978247fc21a1a9f9c935ced9d30aaae9d346aed51bc52f6e71b1555cbc089628dfb97c5d740aa2b2a8c2a43752c21253cd2afdd7
6
+ metadata.gz: e0dc39a0556ec3b66a4e765db6e519680c922132d35c5aecdb37b56cd4c6ae7cf52f2bd324820c96e5ce924afbfcac1801f62b11ec0f5759fe0c501ca70cec0b
7
+ data.tar.gz: 61532646f0b81b9dbf3fa30dda6cefd55fc7e01ccc5dd7d76eac43e9bb73ad2771373068cc7a5bdd130eca8d8f387443a246f9e5d5871dde4883c2a75e8c8aac
@@ -41,16 +41,6 @@ module TerminalShop
41
41
  # # @return [String]
42
42
  # attr_writer :card_id
43
43
 
44
- # @!attribute [r] gift_card_id
45
- # ID of the gift card applied to the current user's cart.
46
- #
47
- # @return [String, nil]
48
- optional :gift_card_id, String, api_name: :giftCardID
49
-
50
- # @!parse
51
- # # @return [String]
52
- # attr_writer :gift_card_id
53
-
54
44
  # @!attribute [r] shipping
55
45
  # Shipping information for the current user's cart.
56
46
  #
@@ -69,10 +59,9 @@ module TerminalShop
69
59
  # # @param subtotal [Integer]
70
60
  # # @param address_id [String]
71
61
  # # @param card_id [String]
72
- # # @param gift_card_id [String]
73
62
  # # @param shipping [TerminalShop::Models::CartAPI::Shipping]
74
63
  # #
75
- # def initialize(amount:, items:, subtotal:, address_id: nil, card_id: nil, gift_card_id: nil, shipping: nil, **) = super
64
+ # def initialize(amount:, items:, subtotal:, address_id: nil, card_id: nil, shipping: nil, **) = super
76
65
 
77
66
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
78
67
 
@@ -83,16 +72,6 @@ module TerminalShop
83
72
  # @return [Integer]
84
73
  required :subtotal, Integer
85
74
 
86
- # @!attribute [r] gift_card
87
- # Amount applied from gift card on the current user's cart, in cents (USD).
88
- #
89
- # @return [Integer, nil]
90
- optional :gift_card, Integer, api_name: :giftCard
91
-
92
- # @!parse
93
- # # @return [Integer]
94
- # attr_writer :gift_card
95
-
96
75
  # @!attribute [r] shipping
97
76
  # Shipping amount of the current user's cart, in cents (USD).
98
77
  #
@@ -104,7 +83,7 @@ module TerminalShop
104
83
  # attr_writer :shipping
105
84
 
106
85
  # @!attribute [r] total
107
- # Total amount after gift card applied, in cents (USD).
86
+ # Total amount after any discounts, in cents (USD).
108
87
  #
109
88
  # @return [Integer, nil]
110
89
  optional :total, Integer
@@ -117,11 +96,10 @@ module TerminalShop
117
96
  # # The subtotal and shipping amounts for the current user's cart.
118
97
  # #
119
98
  # # @param subtotal [Integer]
120
- # # @param gift_card [Integer]
121
99
  # # @param shipping [Integer]
122
100
  # # @param total [Integer]
123
101
  # #
124
- # def initialize(subtotal:, gift_card: nil, shipping: nil, total: nil, **) = super
102
+ # def initialize(subtotal:, shipping: nil, total: nil, **) = super
125
103
 
126
104
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
127
105
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- class CartRemoveGiftCardParams < TerminalShop::BaseModel
5
+ class CartClearParams < TerminalShop::BaseModel
6
6
  # @!parse
7
7
  # extend TerminalShop::RequestParameters::Converter
8
8
  include TerminalShop::RequestParameters
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- class CartRemoveGiftCardResponse < TerminalShop::BaseModel
5
+ class CartClearResponse < TerminalShop::BaseModel
6
6
  # @!attribute data
7
7
  #
8
8
  # @return [Symbol, :ok]
@@ -7,20 +7,10 @@ module TerminalShop
7
7
  # extend TerminalShop::RequestParameters::Converter
8
8
  include TerminalShop::RequestParameters
9
9
 
10
- # @!attribute [r] recipient_email
11
- #
12
- # @return [String, nil]
13
- optional :recipient_email, String, api_name: :recipientEmail
14
-
15
- # @!parse
16
- # # @return [String]
17
- # attr_writer :recipient_email
18
-
19
10
  # @!parse
20
- # # @param recipient_email [String]
21
11
  # # @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
22
12
  # #
23
- # def initialize(recipient_email: nil, request_options: {}, **) = super
13
+ # def initialize(request_options: {}, **) = super
24
14
 
25
15
  # def initialize: (Hash | TerminalShop::BaseModel) -> void
26
16
  end
@@ -85,20 +85,8 @@ module TerminalShop
85
85
  # @param url [URI::Generic]
86
86
  # @param blk [Proc]
87
87
  #
88
- private def with_pool(url, &blk)
88
+ private def with_pool(url, &)
89
89
  origin = TerminalShop::Util.uri_origin(url)
90
- th = Thread.current
91
- key = :"#{object_id}-#{self.class.name}-connection_in_use_for_#{origin}"
92
-
93
- if th[key]
94
- tap do
95
- conn = self.class.connect(url)
96
- return blk.call(conn)
97
- ensure
98
- conn.finish if conn&.started?
99
- end
100
- end
101
-
102
90
  pool =
103
91
  @mutex.synchronize do
104
92
  @pools[origin] ||= ConnectionPool.new(size: @size) do
@@ -106,12 +94,7 @@ module TerminalShop
106
94
  end
107
95
  end
108
96
 
109
- pool.with do |conn|
110
- th[key] = true
111
- blk.call(conn)
112
- ensure
113
- th[key] = nil
114
- end
97
+ pool.with(&)
115
98
  end
116
99
 
117
100
  # @private
@@ -3,24 +3,37 @@
3
3
  module TerminalShop
4
4
  module Resources
5
5
  class Cart
6
+ # Clear the current user's cart.
7
+ #
8
+ # @param params [TerminalShop::Models::CartClearParams, Hash{Symbol=>Object}] .
9
+ #
10
+ # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
11
+ #
12
+ # @return [TerminalShop::Models::CartClearResponse]
13
+ #
14
+ def clear(params = {})
15
+ @client.request(
16
+ method: :delete,
17
+ path: "cart",
18
+ model: TerminalShop::Models::CartClearResponse,
19
+ options: params[:request_options]
20
+ )
21
+ end
22
+
6
23
  # Convert the current user's cart to an order.
7
24
  #
8
25
  # @param params [TerminalShop::Models::CartConvertParams, Hash{Symbol=>Object}] .
9
26
  #
10
- # @option params [String] :recipient_email
11
- #
12
27
  # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
13
28
  #
14
29
  # @return [TerminalShop::Models::CartConvertResponse]
15
30
  #
16
31
  def convert(params = {})
17
- parsed, options = TerminalShop::Models::CartConvertParams.dump_request(params)
18
32
  @client.request(
19
33
  method: :post,
20
34
  path: "cart/convert",
21
- body: parsed,
22
35
  model: TerminalShop::Models::CartConvertResponse,
23
- options: options
36
+ options: params[:request_options]
24
37
  )
25
38
  end
26
39
 
@@ -41,44 +54,6 @@ module TerminalShop
41
54
  )
42
55
  end
43
56
 
44
- # Apply a gift card to the current user's cart.
45
- #
46
- # @param params [TerminalShop::Models::CartRedeemGiftCardParams, Hash{Symbol=>Object}] .
47
- #
48
- # @option params [String] :gift_card_id
49
- #
50
- # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
51
- #
52
- # @return [TerminalShop::Models::CartRedeemGiftCardResponse]
53
- #
54
- def redeem_gift_card(params)
55
- parsed, options = TerminalShop::Models::CartRedeemGiftCardParams.dump_request(params)
56
- @client.request(
57
- method: :put,
58
- path: "cart/gift-card",
59
- body: parsed,
60
- model: TerminalShop::Models::CartRedeemGiftCardResponse,
61
- options: options
62
- )
63
- end
64
-
65
- # Remove the gift card from the current user's cart.
66
- #
67
- # @param params [TerminalShop::Models::CartRemoveGiftCardParams, Hash{Symbol=>Object}] .
68
- #
69
- # @option params [TerminalShop::RequestOptions, Hash{Symbol=>Object}, nil] :request_options
70
- #
71
- # @return [TerminalShop::Models::CartRemoveGiftCardResponse]
72
- #
73
- def remove_gift_card(params = {})
74
- @client.request(
75
- method: :delete,
76
- path: "cart/gift-card",
77
- model: TerminalShop::Models::CartRemoveGiftCardResponse,
78
- options: params[:request_options]
79
- )
80
- end
81
-
82
57
  # Set the shipping address for the current user's cart.
83
58
  #
84
59
  # @param params [TerminalShop::Models::CartSetAddressParams, Hash{Symbol=>Object}] .
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TerminalShop
4
- VERSION = "1.2.0"
4
+ VERSION = "1.4.0"
5
5
  end
data/lib/terminal-shop.rb CHANGED
@@ -59,14 +59,12 @@ require_relative "terminal-shop/models/card_get_response"
59
59
  require_relative "terminal-shop/models/card_list_params"
60
60
  require_relative "terminal-shop/models/card_list_response"
61
61
  require_relative "terminal-shop/models/cart"
62
+ require_relative "terminal-shop/models/cart_clear_params"
63
+ require_relative "terminal-shop/models/cart_clear_response"
62
64
  require_relative "terminal-shop/models/cart_convert_params"
63
65
  require_relative "terminal-shop/models/cart_convert_response"
64
66
  require_relative "terminal-shop/models/cart_get_params"
65
67
  require_relative "terminal-shop/models/cart_get_response"
66
- require_relative "terminal-shop/models/cart_redeem_gift_card_params"
67
- require_relative "terminal-shop/models/cart_redeem_gift_card_response"
68
- require_relative "terminal-shop/models/cart_remove_gift_card_params"
69
- require_relative "terminal-shop/models/cart_remove_gift_card_response"
70
68
  require_relative "terminal-shop/models/cart_set_address_params"
71
69
  require_relative "terminal-shop/models/cart_set_address_response"
72
70
  require_relative "terminal-shop/models/cart_set_card_params"
@@ -46,14 +46,6 @@ module TerminalShop
46
46
  def card_id=(_)
47
47
  end
48
48
 
49
- sig { returns(T.nilable(String)) }
50
- def gift_card_id
51
- end
52
-
53
- sig { params(_: String).returns(String) }
54
- def gift_card_id=(_)
55
- end
56
-
57
49
  sig { returns(T.nilable(TerminalShop::Models::CartAPI::Shipping)) }
58
50
  def shipping
59
51
  end
@@ -69,12 +61,11 @@ module TerminalShop
69
61
  subtotal: Integer,
70
62
  address_id: String,
71
63
  card_id: String,
72
- gift_card_id: String,
73
64
  shipping: TerminalShop::Models::CartAPI::Shipping
74
65
  )
75
66
  .returns(T.attached_class)
76
67
  end
77
- def self.new(amount:, items:, subtotal:, address_id: nil, card_id: nil, gift_card_id: nil, shipping: nil)
68
+ def self.new(amount:, items:, subtotal:, address_id: nil, card_id: nil, shipping: nil)
78
69
  end
79
70
 
80
71
  sig do
@@ -86,7 +77,6 @@ module TerminalShop
86
77
  subtotal: Integer,
87
78
  address_id: String,
88
79
  card_id: String,
89
- gift_card_id: String,
90
80
  shipping: TerminalShop::Models::CartAPI::Shipping
91
81
  }
92
82
  )
@@ -103,14 +93,6 @@ module TerminalShop
103
93
  def subtotal=(_)
104
94
  end
105
95
 
106
- sig { returns(T.nilable(Integer)) }
107
- def gift_card
108
- end
109
-
110
- sig { params(_: Integer).returns(Integer) }
111
- def gift_card=(_)
112
- end
113
-
114
96
  sig { returns(T.nilable(Integer)) }
115
97
  def shipping
116
98
  end
@@ -127,18 +109,11 @@ module TerminalShop
127
109
  def total=(_)
128
110
  end
129
111
 
130
- sig do
131
- params(
132
- subtotal: Integer,
133
- gift_card: Integer,
134
- shipping: Integer,
135
- total: Integer
136
- ).returns(T.attached_class)
137
- end
138
- def self.new(subtotal:, gift_card: nil, shipping: nil, total: nil)
112
+ sig { params(subtotal: Integer, shipping: Integer, total: Integer).returns(T.attached_class) }
113
+ def self.new(subtotal:, shipping: nil, total: nil)
139
114
  end
140
115
 
141
- sig { override.returns({subtotal: Integer, gift_card: Integer, shipping: Integer, total: Integer}) }
116
+ sig { override.returns({subtotal: Integer, shipping: Integer, total: Integer}) }
142
117
  def to_hash
143
118
  end
144
119
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- class CartRemoveGiftCardParams < TerminalShop::BaseModel
5
+ class CartClearParams < TerminalShop::BaseModel
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TerminalShop
4
4
  module Models
5
- class CartRemoveGiftCardResponse < TerminalShop::BaseModel
5
+ class CartClearResponse < TerminalShop::BaseModel
6
6
  sig { returns(Symbol) }
7
7
  def data
8
8
  end
@@ -6,25 +6,14 @@ module TerminalShop
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
- sig { returns(T.nilable(String)) }
10
- def recipient_email
11
- end
12
-
13
- sig { params(_: String).returns(String) }
14
- def recipient_email=(_)
15
- end
16
-
17
9
  sig do
18
- params(
19
- recipient_email: String,
20
- request_options: T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])
21
- )
10
+ params(request_options: T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything]))
22
11
  .returns(T.attached_class)
23
12
  end
24
- def self.new(recipient_email: nil, request_options: {})
13
+ def self.new(request_options: {})
25
14
  end
26
15
 
27
- sig { override.returns({recipient_email: String, request_options: TerminalShop::RequestOptions}) }
16
+ sig { override.returns({request_options: TerminalShop::RequestOptions}) }
28
17
  def to_hash
29
18
  end
30
19
  end
@@ -3,38 +3,25 @@
3
3
  module TerminalShop
4
4
  module Resources
5
5
  class Cart
6
- sig do
7
- params(
8
- recipient_email: String,
9
- request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything]))
10
- )
11
- .returns(TerminalShop::Models::CartConvertResponse)
12
- end
13
- def convert(recipient_email: nil, request_options: {})
14
- end
15
-
16
6
  sig do
17
7
  params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
18
- .returns(TerminalShop::Models::CartGetResponse)
8
+ .returns(TerminalShop::Models::CartClearResponse)
19
9
  end
20
- def get(request_options: {})
10
+ def clear(request_options: {})
21
11
  end
22
12
 
23
13
  sig do
24
- params(
25
- gift_card_id: String,
26
- request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything]))
27
- )
28
- .returns(TerminalShop::Models::CartRedeemGiftCardResponse)
14
+ params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
15
+ .returns(TerminalShop::Models::CartConvertResponse)
29
16
  end
30
- def redeem_gift_card(gift_card_id:, request_options: {})
17
+ def convert(request_options: {})
31
18
  end
32
19
 
33
20
  sig do
34
21
  params(request_options: T.nilable(T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])))
35
- .returns(TerminalShop::Models::CartRemoveGiftCardResponse)
22
+ .returns(TerminalShop::Models::CartGetResponse)
36
23
  end
37
- def remove_gift_card(request_options: {})
24
+ def get(request_options: {})
38
25
  end
39
26
 
40
27
  sig do
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
 
3
3
  module TerminalShop
4
- VERSION = "1.2.0"
4
+ VERSION = "1.4.0"
5
5
  end
@@ -7,7 +7,6 @@ module TerminalShop
7
7
  subtotal: Integer,
8
8
  address_id: String,
9
9
  card_id: String,
10
- gift_card_id: String,
11
10
  shipping: TerminalShop::Models::CartAPI::Shipping
12
11
  }
13
12
 
@@ -26,10 +25,6 @@ module TerminalShop
26
25
 
27
26
  def card_id=: (String) -> String
28
27
 
29
- attr_reader gift_card_id: String?
30
-
31
- def gift_card_id=: (String) -> String
32
-
33
28
  attr_reader shipping: TerminalShop::Models::CartAPI::Shipping?
34
29
 
35
30
  def shipping=: (
@@ -43,7 +38,6 @@ module TerminalShop
43
38
  subtotal: Integer,
44
39
  address_id: String,
45
40
  card_id: String,
46
- gift_card_id: String,
47
41
  shipping: TerminalShop::Models::CartAPI::Shipping
48
42
  ) -> void
49
43
  | (
@@ -52,21 +46,11 @@ module TerminalShop
52
46
 
53
47
  def to_hash: -> TerminalShop::Models::cart_api
54
48
 
55
- type amount =
56
- {
57
- subtotal: Integer,
58
- gift_card: Integer,
59
- shipping: Integer,
60
- total: Integer
61
- }
49
+ type amount = { subtotal: Integer, shipping: Integer, total: Integer }
62
50
 
63
51
  class Amount < TerminalShop::BaseModel
64
52
  attr_accessor subtotal: Integer
65
53
 
66
- attr_reader gift_card: Integer?
67
-
68
- def gift_card=: (Integer) -> Integer
69
-
70
54
  attr_reader shipping: Integer?
71
55
 
72
56
  def shipping=: (Integer) -> Integer
@@ -76,12 +60,7 @@ module TerminalShop
76
60
  def total=: (Integer) -> Integer
77
61
 
78
62
  def initialize:
79
- (
80
- subtotal: Integer,
81
- gift_card: Integer,
82
- shipping: Integer,
83
- total: Integer
84
- ) -> void
63
+ (subtotal: Integer, shipping: Integer, total: Integer) -> void
85
64
  | (
86
65
  ?TerminalShop::Models::CartAPI::amount
87
66
  | TerminalShop::BaseModel data
@@ -1,19 +1,19 @@
1
1
  module TerminalShop
2
2
  module Models
3
- type cart_remove_gift_card_params = { } & TerminalShop::request_parameters
3
+ type cart_clear_params = { } & TerminalShop::request_parameters
4
4
 
5
- class CartRemoveGiftCardParams < TerminalShop::BaseModel
5
+ class CartClearParams < TerminalShop::BaseModel
6
6
  extend TerminalShop::RequestParameters::Converter
7
7
  include TerminalShop::RequestParameters
8
8
 
9
9
  def initialize:
10
10
  (request_options: TerminalShop::request_opts) -> void
11
11
  | (
12
- ?TerminalShop::Models::cart_remove_gift_card_params
12
+ ?TerminalShop::Models::cart_clear_params
13
13
  | TerminalShop::BaseModel data
14
14
  ) -> void
15
15
 
16
- def to_hash: -> TerminalShop::Models::cart_remove_gift_card_params
16
+ def to_hash: -> TerminalShop::Models::cart_clear_params
17
17
  end
18
18
  end
19
19
  end
@@ -0,0 +1,18 @@
1
+ module TerminalShop
2
+ module Models
3
+ type cart_clear_response = { data: :ok }
4
+
5
+ class CartClearResponse < TerminalShop::BaseModel
6
+ attr_accessor data: :ok
7
+
8
+ def initialize:
9
+ (data: :ok) -> void
10
+ | (
11
+ ?TerminalShop::Models::cart_clear_response
12
+ | TerminalShop::BaseModel data
13
+ ) -> void
14
+
15
+ def to_hash: -> TerminalShop::Models::cart_clear_response
16
+ end
17
+ end
18
+ end
@@ -1,21 +1,13 @@
1
1
  module TerminalShop
2
2
  module Models
3
- type cart_convert_params =
4
- { recipient_email: String } & TerminalShop::request_parameters
3
+ type cart_convert_params = { } & TerminalShop::request_parameters
5
4
 
6
5
  class CartConvertParams < TerminalShop::BaseModel
7
6
  extend TerminalShop::RequestParameters::Converter
8
7
  include TerminalShop::RequestParameters
9
8
 
10
- attr_reader recipient_email: String?
11
-
12
- def recipient_email=: (String) -> String
13
-
14
9
  def initialize:
15
- (
16
- recipient_email: String,
17
- request_options: TerminalShop::request_opts
18
- ) -> void
10
+ (request_options: TerminalShop::request_opts) -> void
19
11
  | (
20
12
  ?TerminalShop::Models::cart_convert_params
21
13
  | TerminalShop::BaseModel data
@@ -1,12 +1,19 @@
1
1
  module TerminalShop
2
2
  module Resources
3
3
  class Cart
4
+ def clear:
5
+ (
6
+ ?TerminalShop::Models::CartClearParams | ::Hash[Symbol, top] params
7
+ ) -> TerminalShop::Models::CartClearResponse
8
+ | (
9
+ request_options: TerminalShop::request_opts
10
+ ) -> TerminalShop::Models::CartClearResponse
11
+
4
12
  def convert:
5
13
  (
6
14
  ?TerminalShop::Models::CartConvertParams | ::Hash[Symbol, top] params
7
15
  ) -> TerminalShop::Models::CartConvertResponse
8
16
  | (
9
- recipient_email: String,
10
17
  request_options: TerminalShop::request_opts
11
18
  ) -> TerminalShop::Models::CartConvertResponse
12
19
 
@@ -18,25 +25,6 @@ module TerminalShop
18
25
  request_options: TerminalShop::request_opts
19
26
  ) -> TerminalShop::Models::CartGetResponse
20
27
 
21
- def redeem_gift_card:
22
- (
23
- TerminalShop::Models::CartRedeemGiftCardParams
24
- | ::Hash[Symbol, top] params
25
- ) -> TerminalShop::Models::CartRedeemGiftCardResponse
26
- | (
27
- gift_card_id: String,
28
- request_options: TerminalShop::request_opts
29
- ) -> TerminalShop::Models::CartRedeemGiftCardResponse
30
-
31
- def remove_gift_card:
32
- (
33
- ?TerminalShop::Models::CartRemoveGiftCardParams
34
- | ::Hash[Symbol, top] params
35
- ) -> TerminalShop::Models::CartRemoveGiftCardResponse
36
- | (
37
- request_options: TerminalShop::request_opts
38
- ) -> TerminalShop::Models::CartRemoveGiftCardResponse
39
-
40
28
  def set_address:
41
29
  (
42
30
  TerminalShop::Models::CartSetAddressParams
@@ -1,3 +1,3 @@
1
1
  module TerminalShop
2
- VERSION: "1.1.0"
2
+ VERSION: "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-shop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terminal
@@ -69,14 +69,12 @@ files:
69
69
  - lib/terminal-shop/models/card_list_params.rb
70
70
  - lib/terminal-shop/models/card_list_response.rb
71
71
  - lib/terminal-shop/models/cart.rb
72
+ - lib/terminal-shop/models/cart_clear_params.rb
73
+ - lib/terminal-shop/models/cart_clear_response.rb
72
74
  - lib/terminal-shop/models/cart_convert_params.rb
73
75
  - lib/terminal-shop/models/cart_convert_response.rb
74
76
  - lib/terminal-shop/models/cart_get_params.rb
75
77
  - lib/terminal-shop/models/cart_get_response.rb
76
- - lib/terminal-shop/models/cart_redeem_gift_card_params.rb
77
- - lib/terminal-shop/models/cart_redeem_gift_card_response.rb
78
- - lib/terminal-shop/models/cart_remove_gift_card_params.rb
79
- - lib/terminal-shop/models/cart_remove_gift_card_response.rb
80
78
  - lib/terminal-shop/models/cart_set_address_params.rb
81
79
  - lib/terminal-shop/models/cart_set_address_response.rb
82
80
  - lib/terminal-shop/models/cart_set_card_params.rb
@@ -175,14 +173,12 @@ files:
175
173
  - rbi/lib/terminal-shop/models/card_list_params.rbi
176
174
  - rbi/lib/terminal-shop/models/card_list_response.rbi
177
175
  - rbi/lib/terminal-shop/models/cart.rbi
176
+ - rbi/lib/terminal-shop/models/cart_clear_params.rbi
177
+ - rbi/lib/terminal-shop/models/cart_clear_response.rbi
178
178
  - rbi/lib/terminal-shop/models/cart_convert_params.rbi
179
179
  - rbi/lib/terminal-shop/models/cart_convert_response.rbi
180
180
  - rbi/lib/terminal-shop/models/cart_get_params.rbi
181
181
  - rbi/lib/terminal-shop/models/cart_get_response.rbi
182
- - rbi/lib/terminal-shop/models/cart_redeem_gift_card_params.rbi
183
- - rbi/lib/terminal-shop/models/cart_redeem_gift_card_response.rbi
184
- - rbi/lib/terminal-shop/models/cart_remove_gift_card_params.rbi
185
- - rbi/lib/terminal-shop/models/cart_remove_gift_card_response.rbi
186
182
  - rbi/lib/terminal-shop/models/cart_set_address_params.rbi
187
183
  - rbi/lib/terminal-shop/models/cart_set_address_response.rbi
188
184
  - rbi/lib/terminal-shop/models/cart_set_card_params.rbi
@@ -280,14 +276,12 @@ files:
280
276
  - sig/terminal-shop/models/card_list_params.rbs
281
277
  - sig/terminal-shop/models/card_list_response.rbs
282
278
  - sig/terminal-shop/models/cart.rbs
279
+ - sig/terminal-shop/models/cart_clear_params.rbs
280
+ - sig/terminal-shop/models/cart_clear_response.rbs
283
281
  - sig/terminal-shop/models/cart_convert_params.rbs
284
282
  - sig/terminal-shop/models/cart_convert_response.rbs
285
283
  - sig/terminal-shop/models/cart_get_params.rbs
286
284
  - sig/terminal-shop/models/cart_get_response.rbs
287
- - sig/terminal-shop/models/cart_redeem_gift_card_params.rbs
288
- - sig/terminal-shop/models/cart_redeem_gift_card_response.rbs
289
- - sig/terminal-shop/models/cart_remove_gift_card_params.rbs
290
- - sig/terminal-shop/models/cart_remove_gift_card_response.rbs
291
285
  - sig/terminal-shop/models/cart_set_address_params.rbs
292
286
  - sig/terminal-shop/models/cart_set_address_response.rbs
293
287
  - sig/terminal-shop/models/cart_set_card_params.rbs
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TerminalShop
4
- module Models
5
- class CartRedeemGiftCardParams < TerminalShop::BaseModel
6
- # @!parse
7
- # extend TerminalShop::RequestParameters::Converter
8
- include TerminalShop::RequestParameters
9
-
10
- # @!attribute gift_card_id
11
- #
12
- # @return [String]
13
- required :gift_card_id, String, api_name: :giftCardID
14
-
15
- # @!parse
16
- # # @param gift_card_id [String]
17
- # # @param request_options [TerminalShop::RequestOptions, Hash{Symbol=>Object}]
18
- # #
19
- # def initialize(gift_card_id:, request_options: {}, **) = super
20
-
21
- # def initialize: (Hash | TerminalShop::BaseModel) -> void
22
- end
23
- end
24
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TerminalShop
4
- module Models
5
- class CartRedeemGiftCardResponse < TerminalShop::BaseModel
6
- # @!attribute data
7
- # Gift card redemption result
8
- #
9
- # @return [TerminalShop::Models::CartRedeemGiftCardResponse::Data]
10
- required :data, -> { TerminalShop::Models::CartRedeemGiftCardResponse::Data }
11
-
12
- # @!parse
13
- # # @param data [TerminalShop::Models::CartRedeemGiftCardResponse::Data]
14
- # #
15
- # def initialize(data:, **) = super
16
-
17
- # def initialize: (Hash | TerminalShop::BaseModel) -> void
18
-
19
- class Data < TerminalShop::BaseModel
20
- # @!attribute applied_amount
21
- #
22
- # @return [Integer]
23
- required :applied_amount, Integer, api_name: :appliedAmount
24
-
25
- # @!attribute gift_card_id
26
- #
27
- # @return [String]
28
- required :gift_card_id, String, api_name: :giftCardID
29
-
30
- # @!attribute remaining_balance
31
- #
32
- # @return [Integer]
33
- required :remaining_balance, Integer, api_name: :remainingBalance
34
-
35
- # @!parse
36
- # # Gift card redemption result
37
- # #
38
- # # @param applied_amount [Integer]
39
- # # @param gift_card_id [String]
40
- # # @param remaining_balance [Integer]
41
- # #
42
- # def initialize(applied_amount:, gift_card_id:, remaining_balance:, **) = super
43
-
44
- # def initialize: (Hash | TerminalShop::BaseModel) -> void
45
- end
46
- end
47
- end
48
- end
@@ -1,32 +0,0 @@
1
- # typed: strong
2
-
3
- module TerminalShop
4
- module Models
5
- class CartRedeemGiftCardParams < TerminalShop::BaseModel
6
- extend TerminalShop::RequestParameters::Converter
7
- include TerminalShop::RequestParameters
8
-
9
- sig { returns(String) }
10
- def gift_card_id
11
- end
12
-
13
- sig { params(_: String).returns(String) }
14
- def gift_card_id=(_)
15
- end
16
-
17
- sig do
18
- params(
19
- gift_card_id: String,
20
- request_options: T.any(TerminalShop::RequestOptions, T::Hash[Symbol, T.anything])
21
- )
22
- .returns(T.attached_class)
23
- end
24
- def self.new(gift_card_id:, request_options: {})
25
- end
26
-
27
- sig { override.returns({gift_card_id: String, request_options: TerminalShop::RequestOptions}) }
28
- def to_hash
29
- end
30
- end
31
- end
32
- end
@@ -1,66 +0,0 @@
1
- # typed: strong
2
-
3
- module TerminalShop
4
- module Models
5
- class CartRedeemGiftCardResponse < TerminalShop::BaseModel
6
- sig { returns(TerminalShop::Models::CartRedeemGiftCardResponse::Data) }
7
- def data
8
- end
9
-
10
- sig do
11
- params(_: TerminalShop::Models::CartRedeemGiftCardResponse::Data)
12
- .returns(TerminalShop::Models::CartRedeemGiftCardResponse::Data)
13
- end
14
- def data=(_)
15
- end
16
-
17
- sig { params(data: TerminalShop::Models::CartRedeemGiftCardResponse::Data).returns(T.attached_class) }
18
- def self.new(data:)
19
- end
20
-
21
- sig { override.returns({data: TerminalShop::Models::CartRedeemGiftCardResponse::Data}) }
22
- def to_hash
23
- end
24
-
25
- class Data < TerminalShop::BaseModel
26
- sig { returns(Integer) }
27
- def applied_amount
28
- end
29
-
30
- sig { params(_: Integer).returns(Integer) }
31
- def applied_amount=(_)
32
- end
33
-
34
- sig { returns(String) }
35
- def gift_card_id
36
- end
37
-
38
- sig { params(_: String).returns(String) }
39
- def gift_card_id=(_)
40
- end
41
-
42
- sig { returns(Integer) }
43
- def remaining_balance
44
- end
45
-
46
- sig { params(_: Integer).returns(Integer) }
47
- def remaining_balance=(_)
48
- end
49
-
50
- sig do
51
- params(
52
- applied_amount: Integer,
53
- gift_card_id: String,
54
- remaining_balance: Integer
55
- ).returns(T.attached_class)
56
- end
57
- def self.new(applied_amount:, gift_card_id:, remaining_balance:)
58
- end
59
-
60
- sig { override.returns({applied_amount: Integer, gift_card_id: String, remaining_balance: Integer}) }
61
- def to_hash
62
- end
63
- end
64
- end
65
- end
66
- end
@@ -1,25 +0,0 @@
1
- module TerminalShop
2
- module Models
3
- type cart_redeem_gift_card_params =
4
- { gift_card_id: String } & TerminalShop::request_parameters
5
-
6
- class CartRedeemGiftCardParams < TerminalShop::BaseModel
7
- extend TerminalShop::RequestParameters::Converter
8
- include TerminalShop::RequestParameters
9
-
10
- attr_accessor gift_card_id: String
11
-
12
- def initialize:
13
- (
14
- gift_card_id: String,
15
- request_options: TerminalShop::request_opts
16
- ) -> void
17
- | (
18
- ?TerminalShop::Models::cart_redeem_gift_card_params
19
- | TerminalShop::BaseModel data
20
- ) -> void
21
-
22
- def to_hash: -> TerminalShop::Models::cart_redeem_gift_card_params
23
- end
24
- end
25
- end
@@ -1,47 +0,0 @@
1
- module TerminalShop
2
- module Models
3
- type cart_redeem_gift_card_response =
4
- { data: TerminalShop::Models::CartRedeemGiftCardResponse::Data }
5
-
6
- class CartRedeemGiftCardResponse < TerminalShop::BaseModel
7
- attr_accessor data: TerminalShop::Models::CartRedeemGiftCardResponse::Data
8
-
9
- def initialize:
10
- (data: TerminalShop::Models::CartRedeemGiftCardResponse::Data) -> void
11
- | (
12
- ?TerminalShop::Models::cart_redeem_gift_card_response
13
- | TerminalShop::BaseModel data
14
- ) -> void
15
-
16
- def to_hash: -> TerminalShop::Models::cart_redeem_gift_card_response
17
-
18
- type data =
19
- {
20
- applied_amount: Integer,
21
- gift_card_id: String,
22
- remaining_balance: Integer
23
- }
24
-
25
- class Data < TerminalShop::BaseModel
26
- attr_accessor applied_amount: Integer
27
-
28
- attr_accessor gift_card_id: String
29
-
30
- attr_accessor remaining_balance: Integer
31
-
32
- def initialize:
33
- (
34
- applied_amount: Integer,
35
- gift_card_id: String,
36
- remaining_balance: Integer
37
- ) -> void
38
- | (
39
- ?TerminalShop::Models::CartRedeemGiftCardResponse::data
40
- | TerminalShop::BaseModel data
41
- ) -> void
42
-
43
- def to_hash: -> TerminalShop::Models::CartRedeemGiftCardResponse::data
44
- end
45
- end
46
- end
47
- end
@@ -1,18 +0,0 @@
1
- module TerminalShop
2
- module Models
3
- type cart_remove_gift_card_response = { data: :ok }
4
-
5
- class CartRemoveGiftCardResponse < TerminalShop::BaseModel
6
- attr_accessor data: :ok
7
-
8
- def initialize:
9
- (data: :ok) -> void
10
- | (
11
- ?TerminalShop::Models::cart_remove_gift_card_response
12
- | TerminalShop::BaseModel data
13
- ) -> void
14
-
15
- def to_hash: -> TerminalShop::Models::cart_remove_gift_card_response
16
- end
17
- end
18
- end