shopify_api 14.0.0 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/BUG_REPORT.md +23 -17
  3. data/.github/workflows/build.yml +2 -0
  4. data/.rubocop.yml +0 -1
  5. data/.ruby-version +1 -0
  6. data/CHANGELOG.md +13 -0
  7. data/Gemfile +13 -1
  8. data/Gemfile.lock +24 -22
  9. data/dev.yml +1 -1
  10. data/docs/usage/custom_apps.md +3 -3
  11. data/docs/usage/graphql_storefront.md +13 -6
  12. data/docs/usage/rest.md +1 -1
  13. data/docs/usage/webhooks.md +2 -2
  14. data/lib/shopify_api/admin_versions.rb +2 -1
  15. data/lib/shopify_api/auth/session.rb +3 -3
  16. data/lib/shopify_api/clients/graphql/storefront.rb +26 -4
  17. data/lib/shopify_api/logger.rb +1 -1
  18. data/lib/shopify_api/rest/resources/2022_04/fulfillment_event.rb +5 -8
  19. data/lib/shopify_api/rest/resources/2022_04/inventory_item.rb +2 -2
  20. data/lib/shopify_api/rest/resources/2022_04/variant.rb +6 -6
  21. data/lib/shopify_api/rest/resources/2022_07/fulfillment_event.rb +5 -8
  22. data/lib/shopify_api/rest/resources/2022_07/inventory_item.rb +2 -2
  23. data/lib/shopify_api/rest/resources/2022_07/variant.rb +6 -6
  24. data/lib/shopify_api/rest/resources/2022_10/fulfillment_event.rb +5 -8
  25. data/lib/shopify_api/rest/resources/2022_10/inventory_item.rb +2 -2
  26. data/lib/shopify_api/rest/resources/2022_10/variant.rb +4 -4
  27. data/lib/shopify_api/rest/resources/2023_01/fulfillment_event.rb +5 -8
  28. data/lib/shopify_api/rest/resources/2023_01/inventory_item.rb +2 -2
  29. data/lib/shopify_api/rest/resources/2023_01/variant.rb +4 -4
  30. data/lib/shopify_api/rest/resources/2023_04/fulfillment_event.rb +5 -8
  31. data/lib/shopify_api/rest/resources/2023_04/inventory_item.rb +2 -2
  32. data/lib/shopify_api/rest/resources/2023_04/variant.rb +4 -4
  33. data/lib/shopify_api/rest/resources/2023_07/fulfillment_event.rb +5 -8
  34. data/lib/shopify_api/rest/resources/2023_07/inventory_item.rb +2 -2
  35. data/lib/shopify_api/rest/resources/2023_07/variant.rb +4 -4
  36. data/lib/shopify_api/rest/resources/2023_10/fulfillment_event.rb +5 -8
  37. data/lib/shopify_api/rest/resources/2023_10/inventory_item.rb +2 -2
  38. data/lib/shopify_api/rest/resources/2023_10/variant.rb +4 -4
  39. data/lib/shopify_api/rest/resources/2024_01/fulfillment_event.rb +5 -8
  40. data/lib/shopify_api/rest/resources/2024_01/inventory_item.rb +2 -2
  41. data/lib/shopify_api/rest/resources/2024_01/variant.rb +4 -4
  42. data/lib/shopify_api/rest/resources/2024_04/abandoned_checkout.rb +194 -0
  43. data/lib/shopify_api/rest/resources/2024_04/access_scope.rb +62 -0
  44. data/lib/shopify_api/rest/resources/2024_04/apple_pay_certificate.rb +109 -0
  45. data/lib/shopify_api/rest/resources/2024_04/application_charge.rb +113 -0
  46. data/lib/shopify_api/rest/resources/2024_04/application_credit.rb +95 -0
  47. data/lib/shopify_api/rest/resources/2024_04/article.rb +269 -0
  48. data/lib/shopify_api/rest/resources/2024_04/asset.rb +122 -0
  49. data/lib/shopify_api/rest/resources/2024_04/assigned_fulfillment_order.rb +92 -0
  50. data/lib/shopify_api/rest/resources/2024_04/balance.rb +58 -0
  51. data/lib/shopify_api/rest/resources/2024_04/blog.rb +166 -0
  52. data/lib/shopify_api/rest/resources/2024_04/cancellation_request.rb +87 -0
  53. data/lib/shopify_api/rest/resources/2024_04/carrier_service.rb +120 -0
  54. data/lib/shopify_api/rest/resources/2024_04/checkout.rb +213 -0
  55. data/lib/shopify_api/rest/resources/2024_04/collect.rb +146 -0
  56. data/lib/shopify_api/rest/resources/2024_04/collection.rb +114 -0
  57. data/lib/shopify_api/rest/resources/2024_04/collection_listing.rb +159 -0
  58. data/lib/shopify_api/rest/resources/2024_04/comment.rb +287 -0
  59. data/lib/shopify_api/rest/resources/2024_04/country.rb +141 -0
  60. data/lib/shopify_api/rest/resources/2024_04/currency.rb +61 -0
  61. data/lib/shopify_api/rest/resources/2024_04/custom_collection.rb +191 -0
  62. data/lib/shopify_api/rest/resources/2024_04/customer.rb +333 -0
  63. data/lib/shopify_api/rest/resources/2024_04/customer_address.rb +215 -0
  64. data/lib/shopify_api/rest/resources/2024_04/deprecated_api_call.rb +61 -0
  65. data/lib/shopify_api/rest/resources/2024_04/discount_code.rb +226 -0
  66. data/lib/shopify_api/rest/resources/2024_04/dispute.rb +115 -0
  67. data/lib/shopify_api/rest/resources/2024_04/dispute_evidence.rb +121 -0
  68. data/lib/shopify_api/rest/resources/2024_04/dispute_file_upload.rb +85 -0
  69. data/lib/shopify_api/rest/resources/2024_04/draft_order.rb +279 -0
  70. data/lib/shopify_api/rest/resources/2024_04/event.rb +152 -0
  71. data/lib/shopify_api/rest/resources/2024_04/fulfillment.rb +235 -0
  72. data/lib/shopify_api/rest/resources/2024_04/fulfillment_event.rb +167 -0
  73. data/lib/shopify_api/rest/resources/2024_04/fulfillment_order.rb +326 -0
  74. data/lib/shopify_api/rest/resources/2024_04/fulfillment_request.rb +101 -0
  75. data/lib/shopify_api/rest/resources/2024_04/fulfillment_service.rb +134 -0
  76. data/lib/shopify_api/rest/resources/2024_04/gift_card.rb +222 -0
  77. data/lib/shopify_api/rest/resources/2024_04/gift_card_adjustment.rb +122 -0
  78. data/lib/shopify_api/rest/resources/2024_04/image.rb +161 -0
  79. data/lib/shopify_api/rest/resources/2024_04/inventory_item.rb +112 -0
  80. data/lib/shopify_api/rest/resources/2024_04/inventory_level.rb +183 -0
  81. data/lib/shopify_api/rest/resources/2024_04/location.rb +171 -0
  82. data/lib/shopify_api/rest/resources/2024_04/locations_for_move.rb +60 -0
  83. data/lib/shopify_api/rest/resources/2024_04/marketing_event.rb +213 -0
  84. data/lib/shopify_api/rest/resources/2024_04/metafield.rb +348 -0
  85. data/lib/shopify_api/rest/resources/2024_04/mobile_platform_application.rb +114 -0
  86. data/lib/shopify_api/rest/resources/2024_04/order.rb +489 -0
  87. data/lib/shopify_api/rest/resources/2024_04/order_risk.rb +148 -0
  88. data/lib/shopify_api/rest/resources/2024_04/page.rb +198 -0
  89. data/lib/shopify_api/rest/resources/2024_04/payment.rb +144 -0
  90. data/lib/shopify_api/rest/resources/2024_04/payment_gateway.rb +147 -0
  91. data/lib/shopify_api/rest/resources/2024_04/payment_transaction.rb +114 -0
  92. data/lib/shopify_api/rest/resources/2024_04/payout.rb +101 -0
  93. data/lib/shopify_api/rest/resources/2024_04/policy.rb +73 -0
  94. data/lib/shopify_api/rest/resources/2024_04/price_rule.rb +227 -0
  95. data/lib/shopify_api/rest/resources/2024_04/product.rb +227 -0
  96. data/lib/shopify_api/rest/resources/2024_04/product_listing.rb +200 -0
  97. data/lib/shopify_api/rest/resources/2024_04/product_resource_feedback.rb +92 -0
  98. data/lib/shopify_api/rest/resources/2024_04/province.rb +136 -0
  99. data/lib/shopify_api/rest/resources/2024_04/recurring_application_charge.rb +176 -0
  100. data/lib/shopify_api/rest/resources/2024_04/redirect.rb +143 -0
  101. data/lib/shopify_api/rest/resources/2024_04/refund.rb +155 -0
  102. data/lib/shopify_api/rest/resources/2024_04/resource_feedback.rb +77 -0
  103. data/lib/shopify_api/rest/resources/2024_04/script_tag.rb +159 -0
  104. data/lib/shopify_api/rest/resources/2024_04/shipping_zone.rb +87 -0
  105. data/lib/shopify_api/rest/resources/2024_04/shop.rb +222 -0
  106. data/lib/shopify_api/rest/resources/2024_04/smart_collection.rb +220 -0
  107. data/lib/shopify_api/rest/resources/2024_04/storefront_access_token.rb +91 -0
  108. data/lib/shopify_api/rest/resources/2024_04/tender_transaction.rb +97 -0
  109. data/lib/shopify_api/rest/resources/2024_04/theme.rb +127 -0
  110. data/lib/shopify_api/rest/resources/2024_04/transaction.rb +188 -0
  111. data/lib/shopify_api/rest/resources/2024_04/usage_charge.rb +106 -0
  112. data/lib/shopify_api/rest/resources/2024_04/user.rb +142 -0
  113. data/lib/shopify_api/rest/resources/2024_04/variant.rb +212 -0
  114. data/lib/shopify_api/rest/resources/2024_04/webhook.rb +172 -0
  115. data/lib/shopify_api/version.rb +1 -1
  116. data/lib/shopify_api/webhooks/registry.rb +6 -6
  117. data/lib/shopify_api.rb +1 -0
  118. data/shopify_api.gemspec +0 -8
  119. metadata +77 -101
@@ -0,0 +1,215 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class CustomerAddress < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
16
+ @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
17
+
18
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
19
+ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
20
+
21
+ @address1 = T.let(nil, T.nilable(String))
22
+ @address2 = T.let(nil, T.nilable(String))
23
+ @city = T.let(nil, T.nilable(String))
24
+ @company = T.let(nil, T.nilable(String))
25
+ @country = T.let(nil, T.nilable(String))
26
+ @country_code = T.let(nil, T.nilable(String))
27
+ @country_name = T.let(nil, T.nilable(String))
28
+ @customer_id = T.let(nil, T.nilable(Integer))
29
+ @first_name = T.let(nil, T.nilable(String))
30
+ @id = T.let(nil, T.nilable(Integer))
31
+ @last_name = T.let(nil, T.nilable(String))
32
+ @name = T.let(nil, T.nilable(String))
33
+ @phone = T.let(nil, T.nilable(String))
34
+ @province = T.let(nil, T.nilable(String))
35
+ @province_code = T.let(nil, T.nilable(String))
36
+ @zip = T.let(nil, T.nilable(String))
37
+
38
+ super(session: session, from_hash: from_hash)
39
+ end
40
+
41
+ @has_one = T.let({}, T::Hash[Symbol, Class])
42
+ @has_many = T.let({}, T::Hash[Symbol, Class])
43
+ @paths = T.let([
44
+ {http_method: :delete, operation: :delete, ids: [:customer_id, :id], path: "customers/<customer_id>/addresses/<id>.json"},
45
+ {http_method: :get, operation: :get, ids: [:customer_id], path: "customers/<customer_id>/addresses.json"},
46
+ {http_method: :get, operation: :get, ids: [:customer_id, :id], path: "customers/<customer_id>/addresses/<id>.json"},
47
+ {http_method: :post, operation: :post, ids: [:customer_id], path: "customers/<customer_id>/addresses.json"},
48
+ {http_method: :put, operation: :default, ids: [:customer_id, :id], path: "customers/<customer_id>/addresses/<id>/default.json"},
49
+ {http_method: :put, operation: :put, ids: [:customer_id, :id], path: "customers/<customer_id>/addresses/<id>.json"},
50
+ {http_method: :put, operation: :set, ids: [:customer_id], path: "customers/<customer_id>/addresses/set.json"}
51
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
52
+
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :address1
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :address2
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :city
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :company
61
+ sig { returns(T.nilable(String)) }
62
+ attr_reader :country
63
+ sig { returns(T.nilable(String)) }
64
+ attr_reader :country_code
65
+ sig { returns(T.nilable(String)) }
66
+ attr_reader :country_name
67
+ sig { returns(T.nilable(Integer)) }
68
+ attr_reader :customer_id
69
+ sig { returns(T.nilable(String)) }
70
+ attr_reader :first_name
71
+ sig { returns(T.nilable(Integer)) }
72
+ attr_reader :id
73
+ sig { returns(T.nilable(String)) }
74
+ attr_reader :last_name
75
+ sig { returns(T.nilable(String)) }
76
+ attr_reader :name
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :phone
79
+ sig { returns(T.nilable(String)) }
80
+ attr_reader :province
81
+ sig { returns(T.nilable(String)) }
82
+ attr_reader :province_code
83
+ sig { returns(T.nilable(String)) }
84
+ attr_reader :zip
85
+
86
+ class << self
87
+ sig do
88
+ returns(String)
89
+ end
90
+ def json_body_name()
91
+ "address"
92
+ end
93
+
94
+ sig do
95
+ returns(T::Array[String])
96
+ end
97
+ def json_response_body_names()
98
+ [
99
+ "customer_address",
100
+ "address"
101
+ ]
102
+ end
103
+
104
+ sig do
105
+ params(
106
+ id: T.any(Integer, String),
107
+ customer_id: T.nilable(T.any(Integer, String)),
108
+ session: Auth::Session
109
+ ).returns(T.nilable(CustomerAddress))
110
+ end
111
+ def find(
112
+ id:,
113
+ customer_id: nil,
114
+ session: ShopifyAPI::Context.active_session
115
+ )
116
+ result = base_find(
117
+ session: session,
118
+ ids: {id: id, customer_id: customer_id},
119
+ params: {},
120
+ )
121
+ T.cast(result[0], T.nilable(CustomerAddress))
122
+ end
123
+
124
+ sig do
125
+ params(
126
+ id: T.any(Integer, String),
127
+ customer_id: T.nilable(T.any(Integer, String)),
128
+ session: Auth::Session
129
+ ).returns(T.untyped)
130
+ end
131
+ def delete(
132
+ id:,
133
+ customer_id: nil,
134
+ session: ShopifyAPI::Context.active_session
135
+ )
136
+ request(
137
+ http_method: :delete,
138
+ operation: :delete,
139
+ session: session,
140
+ ids: {id: id, customer_id: customer_id},
141
+ params: {},
142
+ )
143
+ end
144
+
145
+ sig do
146
+ params(
147
+ customer_id: T.nilable(T.any(Integer, String)),
148
+ session: Auth::Session,
149
+ kwargs: T.untyped
150
+ ).returns(T::Array[CustomerAddress])
151
+ end
152
+ def all(
153
+ customer_id: nil,
154
+ session: ShopifyAPI::Context.active_session,
155
+ **kwargs
156
+ )
157
+ response = base_find(
158
+ session: session,
159
+ ids: {customer_id: customer_id},
160
+ params: {}.merge(kwargs).compact,
161
+ )
162
+
163
+ T.cast(response, T::Array[CustomerAddress])
164
+ end
165
+
166
+ end
167
+
168
+ sig do
169
+ params(
170
+ body: T.untyped,
171
+ kwargs: T.untyped
172
+ ).returns(T.untyped)
173
+ end
174
+ def default(
175
+ body: nil,
176
+ **kwargs
177
+ )
178
+ self.class.request(
179
+ http_method: :put,
180
+ operation: :default,
181
+ session: @session,
182
+ ids: {id: @id, customer_id: @customer_id},
183
+ params: {}.merge(kwargs).compact,
184
+ body: body,
185
+ entity: self,
186
+ )
187
+ end
188
+
189
+ sig do
190
+ params(
191
+ address_ids: T.nilable(T.any(T::Array[T.untyped], Integer, String)),
192
+ operation: T.untyped,
193
+ body: T.untyped,
194
+ kwargs: T.untyped
195
+ ).returns(T.untyped)
196
+ end
197
+ def set(
198
+ address_ids: nil,
199
+ operation: nil,
200
+ body: nil,
201
+ **kwargs
202
+ )
203
+ self.class.request(
204
+ http_method: :put,
205
+ operation: :set,
206
+ session: @session,
207
+ ids: {customer_id: @customer_id},
208
+ params: {address_ids: address_ids, operation: operation}.merge(kwargs).compact,
209
+ body: body,
210
+ entity: self,
211
+ )
212
+ end
213
+
214
+ end
215
+ end
@@ -0,0 +1,61 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class DeprecatedApiCall < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
16
+ @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
17
+
18
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
19
+ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
20
+
21
+ @data_updated_at = T.let(nil, T.nilable(String))
22
+ @deprecated_api_calls = T.let(nil, T.nilable(T::Array[T.untyped]))
23
+
24
+ super(session: session, from_hash: from_hash)
25
+ end
26
+
27
+ @has_one = T.let({}, T::Hash[Symbol, Class])
28
+ @has_many = T.let({}, T::Hash[Symbol, Class])
29
+ @paths = T.let([
30
+ {http_method: :get, operation: :get, ids: [], path: "deprecated_api_calls.json"}
31
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
32
+
33
+ sig { returns(T.nilable(String)) }
34
+ attr_reader :data_updated_at
35
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
36
+ attr_reader :deprecated_api_calls
37
+
38
+ class << self
39
+ sig do
40
+ params(
41
+ session: Auth::Session,
42
+ kwargs: T.untyped
43
+ ).returns(T::Array[DeprecatedApiCall])
44
+ end
45
+ def all(
46
+ session: ShopifyAPI::Context.active_session,
47
+ **kwargs
48
+ )
49
+ response = base_find(
50
+ session: session,
51
+ ids: {},
52
+ params: {}.merge(kwargs).compact,
53
+ )
54
+
55
+ T.cast(response, T::Array[DeprecatedApiCall])
56
+ end
57
+
58
+ end
59
+
60
+ end
61
+ end
@@ -0,0 +1,226 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class DiscountCode < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
16
+ @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
17
+
18
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
19
+ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
20
+
21
+ @code = T.let(nil, T.nilable(String))
22
+ @created_at = T.let(nil, T.nilable(String))
23
+ @errors = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
24
+ @id = T.let(nil, T.nilable(Integer))
25
+ @price_rule_id = T.let(nil, T.nilable(Integer))
26
+ @updated_at = T.let(nil, T.nilable(String))
27
+ @usage_count = T.let(nil, T.nilable(Integer))
28
+
29
+ super(session: session, from_hash: from_hash)
30
+ end
31
+
32
+ @has_one = T.let({}, T::Hash[Symbol, Class])
33
+ @has_many = T.let({}, T::Hash[Symbol, Class])
34
+ @paths = T.let([
35
+ {http_method: :delete, operation: :delete, ids: [:price_rule_id, :id], path: "price_rules/<price_rule_id>/discount_codes/<id>.json"},
36
+ {http_method: :get, operation: :count, ids: [], path: "discount_codes/count.json"},
37
+ {http_method: :get, operation: :get, ids: [:price_rule_id, :batch_id], path: "price_rules/<price_rule_id>/batch/<batch_id>/discount_codes.json"},
38
+ {http_method: :get, operation: :get, ids: [:price_rule_id], path: "price_rules/<price_rule_id>/discount_codes.json"},
39
+ {http_method: :get, operation: :get, ids: [:price_rule_id, :id], path: "price_rules/<price_rule_id>/discount_codes/<id>.json"},
40
+ {http_method: :get, operation: :get_all, ids: [:price_rule_id, :batch_id], path: "price_rules/<price_rule_id>/batch/<batch_id>.json"},
41
+ {http_method: :get, operation: :lookup, ids: [], path: "discount_codes/lookup.json"},
42
+ {http_method: :post, operation: :batch, ids: [:price_rule_id], path: "price_rules/<price_rule_id>/batch.json"},
43
+ {http_method: :post, operation: :post, ids: [:price_rule_id], path: "price_rules/<price_rule_id>/discount_codes.json"},
44
+ {http_method: :put, operation: :put, ids: [:price_rule_id, :id], path: "price_rules/<price_rule_id>/discount_codes/<id>.json"}
45
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
46
+
47
+ sig { returns(T.nilable(String)) }
48
+ attr_reader :code
49
+ sig { returns(T.nilable(String)) }
50
+ attr_reader :created_at
51
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
52
+ attr_reader :errors
53
+ sig { returns(T.nilable(Integer)) }
54
+ attr_reader :id
55
+ sig { returns(T.nilable(Integer)) }
56
+ attr_reader :price_rule_id
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :updated_at
59
+ sig { returns(T.nilable(Integer)) }
60
+ attr_reader :usage_count
61
+
62
+ class << self
63
+ sig do
64
+ params(
65
+ id: T.any(Integer, String),
66
+ price_rule_id: T.nilable(T.any(Integer, String)),
67
+ session: Auth::Session
68
+ ).returns(T.nilable(DiscountCode))
69
+ end
70
+ def find(
71
+ id:,
72
+ price_rule_id: nil,
73
+ session: ShopifyAPI::Context.active_session
74
+ )
75
+ result = base_find(
76
+ session: session,
77
+ ids: {id: id, price_rule_id: price_rule_id},
78
+ params: {},
79
+ )
80
+ T.cast(result[0], T.nilable(DiscountCode))
81
+ end
82
+
83
+ sig do
84
+ params(
85
+ id: T.any(Integer, String),
86
+ price_rule_id: T.nilable(T.any(Integer, String)),
87
+ session: Auth::Session
88
+ ).returns(T.untyped)
89
+ end
90
+ def delete(
91
+ id:,
92
+ price_rule_id: nil,
93
+ session: ShopifyAPI::Context.active_session
94
+ )
95
+ request(
96
+ http_method: :delete,
97
+ operation: :delete,
98
+ session: session,
99
+ ids: {id: id, price_rule_id: price_rule_id},
100
+ params: {},
101
+ )
102
+ end
103
+
104
+ sig do
105
+ params(
106
+ price_rule_id: T.nilable(T.any(Integer, String)),
107
+ batch_id: T.nilable(T.any(Integer, String)),
108
+ session: Auth::Session,
109
+ kwargs: T.untyped
110
+ ).returns(T::Array[DiscountCode])
111
+ end
112
+ def all(
113
+ price_rule_id: nil,
114
+ batch_id: nil,
115
+ session: ShopifyAPI::Context.active_session,
116
+ **kwargs
117
+ )
118
+ response = base_find(
119
+ session: session,
120
+ ids: {price_rule_id: price_rule_id, batch_id: batch_id},
121
+ params: {}.merge(kwargs).compact,
122
+ )
123
+
124
+ T.cast(response, T::Array[DiscountCode])
125
+ end
126
+
127
+ sig do
128
+ params(
129
+ times_used: T.untyped,
130
+ times_used_min: T.untyped,
131
+ times_used_max: T.untyped,
132
+ session: Auth::Session,
133
+ kwargs: T.untyped
134
+ ).returns(T.untyped)
135
+ end
136
+ def count(
137
+ times_used: nil,
138
+ times_used_min: nil,
139
+ times_used_max: nil,
140
+ session: ShopifyAPI::Context.active_session,
141
+ **kwargs
142
+ )
143
+ request(
144
+ http_method: :get,
145
+ operation: :count,
146
+ session: session,
147
+ ids: {},
148
+ params: {times_used: times_used, times_used_min: times_used_min, times_used_max: times_used_max}.merge(kwargs).compact,
149
+ body: {},
150
+ entity: nil,
151
+ )
152
+ end
153
+
154
+ sig do
155
+ params(
156
+ price_rule_id: T.nilable(T.any(Integer, String)),
157
+ batch_id: T.nilable(T.any(Integer, String)),
158
+ session: Auth::Session,
159
+ kwargs: T.untyped
160
+ ).returns(T.untyped)
161
+ end
162
+ def get_all(
163
+ price_rule_id: nil,
164
+ batch_id: nil,
165
+ session: ShopifyAPI::Context.active_session,
166
+ **kwargs
167
+ )
168
+ request(
169
+ http_method: :get,
170
+ operation: :get_all,
171
+ session: session,
172
+ ids: {price_rule_id: price_rule_id, batch_id: batch_id},
173
+ params: {}.merge(kwargs).compact,
174
+ body: {},
175
+ entity: nil,
176
+ )
177
+ end
178
+
179
+ sig do
180
+ params(
181
+ code: T.untyped,
182
+ session: Auth::Session,
183
+ kwargs: T.untyped
184
+ ).returns(T.untyped)
185
+ end
186
+ def lookup(
187
+ code: nil,
188
+ session: ShopifyAPI::Context.active_session,
189
+ **kwargs
190
+ )
191
+ request(
192
+ http_method: :get,
193
+ operation: :lookup,
194
+ session: session,
195
+ ids: {},
196
+ params: {code: code}.merge(kwargs).compact,
197
+ body: {},
198
+ entity: nil,
199
+ )
200
+ end
201
+
202
+ end
203
+
204
+ sig do
205
+ params(
206
+ body: T.untyped,
207
+ kwargs: T.untyped
208
+ ).returns(T.untyped)
209
+ end
210
+ def batch(
211
+ body: nil,
212
+ **kwargs
213
+ )
214
+ self.class.request(
215
+ http_method: :post,
216
+ operation: :batch,
217
+ session: @session,
218
+ ids: {price_rule_id: @price_rule_id},
219
+ params: {}.merge(kwargs).compact,
220
+ body: body,
221
+ entity: self,
222
+ )
223
+ end
224
+
225
+ end
226
+ end
@@ -0,0 +1,115 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ ########################################################################################################################
5
+ # This file is auto-generated. If you have an issue, please create a GitHub issue. #
6
+ ########################################################################################################################
7
+
8
+ module ShopifyAPI
9
+ class Dispute < ShopifyAPI::Rest::Base
10
+ extend T::Sig
11
+
12
+ @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
13
+ @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
14
+
15
+ @api_call_limit = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
16
+ @retry_request_after = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar)
17
+
18
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session), from_hash: T.nilable(T::Hash[T.untyped, T.untyped])).void }
19
+ def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)
20
+
21
+ @amount = T.let(nil, T.nilable(String))
22
+ @currency = T.let(nil, T.nilable(String))
23
+ @evidence_due_by = T.let(nil, T.nilable(String))
24
+ @evidence_sent_on = T.let(nil, T.nilable(String))
25
+ @finalized_on = T.let(nil, T.nilable(String))
26
+ @id = T.let(nil, T.nilable(Integer))
27
+ @network_reason_code = T.let(nil, T.nilable(String))
28
+ @order_id = T.let(nil, T.nilable(Integer))
29
+ @reason = T.let(nil, T.nilable(String))
30
+ @status = T.let(nil, T.nilable(String))
31
+ @type = T.let(nil, T.nilable(String))
32
+
33
+ super(session: session, from_hash: from_hash)
34
+ end
35
+
36
+ @has_one = T.let({}, T::Hash[Symbol, Class])
37
+ @has_many = T.let({}, T::Hash[Symbol, Class])
38
+ @paths = T.let([
39
+ {http_method: :get, operation: :get, ids: [], path: "shopify_payments/disputes.json"},
40
+ {http_method: :get, operation: :get, ids: [:id], path: "shopify_payments/disputes/<id>.json"}
41
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
42
+
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :amount
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :currency
47
+ sig { returns(T.nilable(String)) }
48
+ attr_reader :evidence_due_by
49
+ sig { returns(T.nilable(String)) }
50
+ attr_reader :evidence_sent_on
51
+ sig { returns(T.nilable(String)) }
52
+ attr_reader :finalized_on
53
+ sig { returns(T.nilable(Integer)) }
54
+ attr_reader :id
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :network_reason_code
57
+ sig { returns(T.nilable(Integer)) }
58
+ attr_reader :order_id
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :reason
61
+ sig { returns(T.nilable(String)) }
62
+ attr_reader :status
63
+ sig { returns(T.nilable(String)) }
64
+ attr_reader :type
65
+
66
+ class << self
67
+ sig do
68
+ params(
69
+ id: T.any(Integer, String),
70
+ session: Auth::Session
71
+ ).returns(T.nilable(Dispute))
72
+ end
73
+ def find(
74
+ id:,
75
+ session: ShopifyAPI::Context.active_session
76
+ )
77
+ result = base_find(
78
+ session: session,
79
+ ids: {id: id},
80
+ params: {},
81
+ )
82
+ T.cast(result[0], T.nilable(Dispute))
83
+ end
84
+
85
+ sig do
86
+ params(
87
+ since_id: T.untyped,
88
+ last_id: T.untyped,
89
+ status: T.untyped,
90
+ initiated_at: T.untyped,
91
+ session: Auth::Session,
92
+ kwargs: T.untyped
93
+ ).returns(T::Array[Dispute])
94
+ end
95
+ def all(
96
+ since_id: nil,
97
+ last_id: nil,
98
+ status: nil,
99
+ initiated_at: nil,
100
+ session: ShopifyAPI::Context.active_session,
101
+ **kwargs
102
+ )
103
+ response = base_find(
104
+ session: session,
105
+ ids: {},
106
+ params: {since_id: since_id, last_id: last_id, status: status, initiated_at: initiated_at}.merge(kwargs).compact,
107
+ )
108
+
109
+ T.cast(response, T::Array[Dispute])
110
+ end
111
+
112
+ end
113
+
114
+ end
115
+ end