shopify_api 12.5.0 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile.lock +2 -2
  5. data/lib/shopify_api/auth/oauth.rb +0 -2
  6. data/lib/shopify_api/clients/http_client.rb +13 -9
  7. data/lib/shopify_api/context.rb +4 -20
  8. data/lib/shopify_api/rest/base.rb +48 -14
  9. data/lib/shopify_api/rest/resources/2022_04/abandoned_checkout.rb +190 -0
  10. data/lib/shopify_api/rest/resources/2022_04/access_scope.rb +58 -0
  11. data/lib/shopify_api/rest/resources/2022_04/android_pay_key.rb +77 -0
  12. data/lib/shopify_api/rest/resources/2022_04/apple_pay_certificate.rb +105 -0
  13. data/lib/shopify_api/rest/resources/2022_04/application_charge.rb +109 -0
  14. data/lib/shopify_api/rest/resources/2022_04/application_credit.rb +92 -0
  15. data/lib/shopify_api/rest/resources/2022_04/article.rb +265 -0
  16. data/lib/shopify_api/rest/resources/2022_04/asset.rb +118 -0
  17. data/lib/shopify_api/rest/resources/2022_04/assigned_fulfillment_order.rb +86 -0
  18. data/lib/shopify_api/rest/resources/2022_04/balance.rb +50 -0
  19. data/lib/shopify_api/rest/resources/2022_04/blog.rb +162 -0
  20. data/lib/shopify_api/rest/resources/2022_04/cancellation_request.rb +83 -0
  21. data/lib/shopify_api/rest/resources/2022_04/carrier_service.rb +116 -0
  22. data/lib/shopify_api/rest/resources/2022_04/checkout.rb +209 -0
  23. data/lib/shopify_api/rest/resources/2022_04/collect.rb +142 -0
  24. data/lib/shopify_api/rest/resources/2022_04/collection.rb +110 -0
  25. data/lib/shopify_api/rest/resources/2022_04/collection_listing.rb +155 -0
  26. data/lib/shopify_api/rest/resources/2022_04/comment.rb +283 -0
  27. data/lib/shopify_api/rest/resources/2022_04/country.rb +137 -0
  28. data/lib/shopify_api/rest/resources/2022_04/currency.rb +57 -0
  29. data/lib/shopify_api/rest/resources/2022_04/custom_collection.rb +187 -0
  30. data/lib/shopify_api/rest/resources/2022_04/customer.rb +329 -0
  31. data/lib/shopify_api/rest/resources/2022_04/customer_address.rb +201 -0
  32. data/lib/shopify_api/rest/resources/2022_04/customer_saved_search.rb +169 -0
  33. data/lib/shopify_api/rest/resources/2022_04/deprecated_api_call.rb +57 -0
  34. data/lib/shopify_api/rest/resources/2022_04/discount_code.rb +222 -0
  35. data/lib/shopify_api/rest/resources/2022_04/dispute.rb +111 -0
  36. data/lib/shopify_api/rest/resources/2022_04/draft_order.rb +275 -0
  37. data/lib/shopify_api/rest/resources/2022_04/event.rb +148 -0
  38. data/lib/shopify_api/rest/resources/2022_04/fulfillment.rb +278 -0
  39. data/lib/shopify_api/rest/resources/2022_04/fulfillment_event.rb +166 -0
  40. data/lib/shopify_api/rest/resources/2022_04/fulfillment_order.rb +284 -0
  41. data/lib/shopify_api/rest/resources/2022_04/fulfillment_request.rb +87 -0
  42. data/lib/shopify_api/rest/resources/2022_04/fulfillment_service.rb +130 -0
  43. data/lib/shopify_api/rest/resources/2022_04/gift_card.rb +218 -0
  44. data/lib/shopify_api/rest/resources/2022_04/gift_card_adjustment.rb +118 -0
  45. data/lib/shopify_api/rest/resources/2022_04/image.rb +157 -0
  46. data/lib/shopify_api/rest/resources/2022_04/inventory_item.rb +108 -0
  47. data/lib/shopify_api/rest/resources/2022_04/inventory_level.rb +179 -0
  48. data/lib/shopify_api/rest/resources/2022_04/location.rb +167 -0
  49. data/lib/shopify_api/rest/resources/2022_04/locations_for_move.rb +56 -0
  50. data/lib/shopify_api/rest/resources/2022_04/marketing_event.rb +209 -0
  51. data/lib/shopify_api/rest/resources/2022_04/metafield.rb +344 -0
  52. data/lib/shopify_api/rest/resources/2022_04/mobile_platform_application.rb +110 -0
  53. data/lib/shopify_api/rest/resources/2022_04/order.rb +473 -0
  54. data/lib/shopify_api/rest/resources/2022_04/order_risk.rb +142 -0
  55. data/lib/shopify_api/rest/resources/2022_04/page.rb +194 -0
  56. data/lib/shopify_api/rest/resources/2022_04/payment.rb +140 -0
  57. data/lib/shopify_api/rest/resources/2022_04/payment_gateway.rb +143 -0
  58. data/lib/shopify_api/rest/resources/2022_04/payment_transaction.rb +107 -0
  59. data/lib/shopify_api/rest/resources/2022_04/payout.rb +97 -0
  60. data/lib/shopify_api/rest/resources/2022_04/policy.rb +69 -0
  61. data/lib/shopify_api/rest/resources/2022_04/price_rule.rb +223 -0
  62. data/lib/shopify_api/rest/resources/2022_04/product.rb +223 -0
  63. data/lib/shopify_api/rest/resources/2022_04/product_listing.rb +196 -0
  64. data/lib/shopify_api/rest/resources/2022_04/product_resource_feedback.rb +88 -0
  65. data/lib/shopify_api/rest/resources/2022_04/province.rb +132 -0
  66. data/lib/shopify_api/rest/resources/2022_04/recurring_application_charge.rb +172 -0
  67. data/lib/shopify_api/rest/resources/2022_04/redirect.rb +139 -0
  68. data/lib/shopify_api/rest/resources/2022_04/refund.rb +151 -0
  69. data/lib/shopify_api/rest/resources/2022_04/report.rb +121 -0
  70. data/lib/shopify_api/rest/resources/2022_04/resource_feedback.rb +73 -0
  71. data/lib/shopify_api/rest/resources/2022_04/script_tag.rb +155 -0
  72. data/lib/shopify_api/rest/resources/2022_04/shipping_zone.rb +83 -0
  73. data/lib/shopify_api/rest/resources/2022_04/shop.rb +218 -0
  74. data/lib/shopify_api/rest/resources/2022_04/smart_collection.rb +216 -0
  75. data/lib/shopify_api/rest/resources/2022_04/storefront_access_token.rb +87 -0
  76. data/lib/shopify_api/rest/resources/2022_04/tender_transaction.rb +93 -0
  77. data/lib/shopify_api/rest/resources/2022_04/theme.rb +123 -0
  78. data/lib/shopify_api/rest/resources/2022_04/transaction.rb +181 -0
  79. data/lib/shopify_api/rest/resources/2022_04/usage_charge.rb +102 -0
  80. data/lib/shopify_api/rest/resources/2022_04/user.rb +138 -0
  81. data/lib/shopify_api/rest/resources/2022_04/variant.rb +212 -0
  82. data/lib/shopify_api/rest/resources/2022_04/webhook.rb +168 -0
  83. data/lib/shopify_api/rest/resources/2022_07/application_credit.rb +2 -2
  84. data/lib/shopify_api/rest/resources/2022_07/carrier_service.rb +3 -0
  85. data/lib/shopify_api/rest/resources/2022_07/discount_code.rb +3 -0
  86. data/lib/shopify_api/rest/resources/2022_07/dispute.rb +2 -2
  87. data/lib/shopify_api/rest/resources/2022_07/draft_order.rb +2 -2
  88. data/lib/shopify_api/rest/resources/2022_07/event.rb +2 -2
  89. data/lib/shopify_api/rest/resources/2022_07/fulfillment.rb +6 -0
  90. data/lib/shopify_api/rest/resources/2022_07/gift_card.rb +8 -5
  91. data/lib/shopify_api/rest/resources/2022_07/order_risk.rb +9 -2
  92. data/lib/shopify_api/rest/resources/2022_07/shipping_zone.rb +2 -2
  93. data/lib/shopify_api/rest/resources/2022_07/shop.rb +2 -2
  94. data/lib/shopify_api/rest/resources/2022_07/theme.rb +3 -0
  95. data/lib/shopify_api/rest/resources/2022_07/usage_charge.rb +2 -2
  96. data/lib/shopify_api/rest/resources/2022_10/application_credit.rb +2 -2
  97. data/lib/shopify_api/rest/resources/2022_10/carrier_service.rb +3 -0
  98. data/lib/shopify_api/rest/resources/2022_10/discount_code.rb +3 -0
  99. data/lib/shopify_api/rest/resources/2022_10/dispute.rb +2 -2
  100. data/lib/shopify_api/rest/resources/2022_10/draft_order.rb +2 -2
  101. data/lib/shopify_api/rest/resources/2022_10/event.rb +2 -2
  102. data/lib/shopify_api/rest/resources/2022_10/fulfillment.rb +6 -0
  103. data/lib/shopify_api/rest/resources/2022_10/gift_card.rb +8 -5
  104. data/lib/shopify_api/rest/resources/2022_10/order_risk.rb +9 -2
  105. data/lib/shopify_api/rest/resources/2022_10/shipping_zone.rb +2 -2
  106. data/lib/shopify_api/rest/resources/2022_10/shop.rb +2 -2
  107. data/lib/shopify_api/rest/resources/2022_10/theme.rb +3 -0
  108. data/lib/shopify_api/rest/resources/2022_10/usage_charge.rb +2 -2
  109. data/lib/shopify_api/rest/resources/2023_01/application_credit.rb +2 -2
  110. data/lib/shopify_api/rest/resources/2023_01/carrier_service.rb +3 -0
  111. data/lib/shopify_api/rest/resources/2023_01/discount_code.rb +3 -0
  112. data/lib/shopify_api/rest/resources/2023_01/dispute.rb +2 -2
  113. data/lib/shopify_api/rest/resources/2023_01/draft_order.rb +2 -2
  114. data/lib/shopify_api/rest/resources/2023_01/event.rb +2 -2
  115. data/lib/shopify_api/rest/resources/2023_01/fulfillment.rb +6 -0
  116. data/lib/shopify_api/rest/resources/2023_01/gift_card.rb +8 -5
  117. data/lib/shopify_api/rest/resources/2023_01/order_risk.rb +9 -2
  118. data/lib/shopify_api/rest/resources/2023_01/shipping_zone.rb +2 -2
  119. data/lib/shopify_api/rest/resources/2023_01/shop.rb +2 -2
  120. data/lib/shopify_api/rest/resources/2023_01/theme.rb +3 -0
  121. data/lib/shopify_api/rest/resources/2023_01/usage_charge.rb +2 -2
  122. data/lib/shopify_api/rest/resources/2023_04/application_credit.rb +2 -2
  123. data/lib/shopify_api/rest/resources/2023_04/carrier_service.rb +3 -0
  124. data/lib/shopify_api/rest/resources/2023_04/discount_code.rb +3 -0
  125. data/lib/shopify_api/rest/resources/2023_04/dispute.rb +2 -2
  126. data/lib/shopify_api/rest/resources/2023_04/draft_order.rb +2 -2
  127. data/lib/shopify_api/rest/resources/2023_04/event.rb +2 -2
  128. data/lib/shopify_api/rest/resources/2023_04/fulfillment.rb +6 -0
  129. data/lib/shopify_api/rest/resources/2023_04/gift_card.rb +8 -5
  130. data/lib/shopify_api/rest/resources/2023_04/order_risk.rb +9 -2
  131. data/lib/shopify_api/rest/resources/2023_04/shipping_zone.rb +2 -2
  132. data/lib/shopify_api/rest/resources/2023_04/shop.rb +2 -2
  133. data/lib/shopify_api/rest/resources/2023_04/theme.rb +3 -0
  134. data/lib/shopify_api/rest/resources/2023_04/usage_charge.rb +2 -2
  135. data/lib/shopify_api/utils/graphql_proxy.rb +3 -6
  136. data/lib/shopify_api/utils/session_utils.rb +0 -84
  137. data/lib/shopify_api/version.rb +1 -1
  138. data/lib/shopify_api/webhooks/registry.rb +1 -1
  139. metadata +77 -5
  140. data/lib/shopify_api/auth/file_session_storage.rb +0 -72
  141. data/lib/shopify_api/auth/session_storage.rb +0 -30
@@ -0,0 +1,278 @@
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 Fulfillment < 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
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @created_at = T.let(nil, T.nilable(String))
20
+ @id = T.let(nil, T.nilable(Integer))
21
+ @line_items = T.let(nil, T.nilable(T::Array[T.untyped]))
22
+ @location_id = T.let(nil, T.nilable(Integer))
23
+ @name = T.let(nil, T.nilable(String))
24
+ @notify_customer = T.let(nil, T.nilable(T::Boolean))
25
+ @order_id = T.let(nil, T.nilable(Integer))
26
+ @origin_address = T.let(nil, T.nilable(T::Array[T.untyped]))
27
+ @receipt = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
28
+ @service = T.let(nil, T.nilable(String))
29
+ @shipment_status = T.let(nil, T.nilable(String))
30
+ @status = T.let(nil, T.nilable(String))
31
+ @tracking_company = T.let(nil, T.nilable(String))
32
+ @tracking_number = T.let(nil, T.nilable(String))
33
+ @tracking_numbers = T.let(nil, T.nilable(T::Array[T.untyped]))
34
+ @tracking_url = T.let(nil, T.nilable(String))
35
+ @tracking_urls = T.let(nil, T.nilable(T::Array[T.untyped]))
36
+ @updated_at = T.let(nil, T.nilable(String))
37
+ @variant_inventory_management = T.let(nil, T.nilable(String))
38
+ end
39
+
40
+ @has_one = T.let({}, T::Hash[Symbol, Class])
41
+ @has_many = T.let({}, T::Hash[Symbol, Class])
42
+ @paths = T.let([
43
+ {http_method: :get, operation: :count, ids: [:order_id], path: "orders/<order_id>/fulfillments/count.json"},
44
+ {http_method: :get, operation: :get, ids: [:fulfillment_order_id], path: "fulfillment_orders/<fulfillment_order_id>/fulfillments.json"},
45
+ {http_method: :get, operation: :get, ids: [:order_id], path: "orders/<order_id>/fulfillments.json"},
46
+ {http_method: :get, operation: :get, ids: [:order_id, :id], path: "orders/<order_id>/fulfillments/<id>.json"},
47
+ {http_method: :post, operation: :cancel, ids: [:id], path: "fulfillments/<id>/cancel.json"},
48
+ {http_method: :post, operation: :cancel, ids: [:order_id, :id], path: "orders/<order_id>/fulfillments/<id>/cancel.json"},
49
+ {http_method: :post, operation: :complete, ids: [:order_id, :id], path: "orders/<order_id>/fulfillments/<id>/complete.json"},
50
+ {http_method: :post, operation: :open, ids: [:order_id, :id], path: "orders/<order_id>/fulfillments/<id>/open.json"},
51
+ {http_method: :post, operation: :post, ids: [], path: "fulfillments.json"},
52
+ {http_method: :post, operation: :post, ids: [:order_id], path: "orders/<order_id>/fulfillments.json"},
53
+ {http_method: :post, operation: :update_tracking, ids: [:id], path: "fulfillments/<id>/update_tracking.json"},
54
+ {http_method: :put, operation: :put, ids: [:order_id, :id], path: "orders/<order_id>/fulfillments/<id>.json"}
55
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
56
+
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :created_at
59
+ sig { returns(T.nilable(Integer)) }
60
+ attr_reader :id
61
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
62
+ attr_reader :line_items
63
+ sig { returns(T.nilable(Integer)) }
64
+ attr_reader :location_id
65
+ sig { returns(T.nilable(String)) }
66
+ attr_reader :name
67
+ sig { returns(T.nilable(T::Boolean)) }
68
+ attr_reader :notify_customer
69
+ sig { returns(T.nilable(Integer)) }
70
+ attr_reader :order_id
71
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
72
+ attr_reader :origin_address
73
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
74
+ attr_reader :receipt
75
+ sig { returns(T.nilable(String)) }
76
+ attr_reader :service
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :shipment_status
79
+ sig { returns(T.nilable(String)) }
80
+ attr_reader :status
81
+ sig { returns(T.nilable(String)) }
82
+ attr_reader :tracking_company
83
+ sig { returns(T.nilable(String)) }
84
+ attr_reader :tracking_number
85
+ sig { returns(T.nilable(T::Array[String])) }
86
+ attr_reader :tracking_numbers
87
+ sig { returns(T.nilable(String)) }
88
+ attr_reader :tracking_url
89
+ sig { returns(T.nilable(T::Array[String])) }
90
+ attr_reader :tracking_urls
91
+ sig { returns(T.nilable(String)) }
92
+ attr_reader :updated_at
93
+ sig { returns(T.nilable(String)) }
94
+ attr_reader :variant_inventory_management
95
+
96
+ class << self
97
+ sig do
98
+ params(
99
+ id: T.any(Integer, String),
100
+ order_id: T.nilable(T.any(Integer, String)),
101
+ fields: T.untyped,
102
+ session: Auth::Session
103
+ ).returns(T.nilable(Fulfillment))
104
+ end
105
+ def find(
106
+ id:,
107
+ order_id: nil,
108
+ fields: nil,
109
+ session: ShopifyAPI::Context.active_session
110
+ )
111
+ result = base_find(
112
+ session: session,
113
+ ids: {id: id, order_id: order_id},
114
+ params: {fields: fields},
115
+ )
116
+ T.cast(result[0], T.nilable(Fulfillment))
117
+ end
118
+
119
+ sig do
120
+ params(
121
+ fulfillment_order_id: T.nilable(T.any(Integer, String)),
122
+ order_id: T.nilable(T.any(Integer, String)),
123
+ created_at_max: T.untyped,
124
+ created_at_min: T.untyped,
125
+ fields: T.untyped,
126
+ limit: T.untyped,
127
+ since_id: T.untyped,
128
+ updated_at_max: T.untyped,
129
+ updated_at_min: T.untyped,
130
+ session: Auth::Session,
131
+ kwargs: T.untyped
132
+ ).returns(T::Array[Fulfillment])
133
+ end
134
+ def all(
135
+ fulfillment_order_id: nil,
136
+ order_id: nil,
137
+ created_at_max: nil,
138
+ created_at_min: nil,
139
+ fields: nil,
140
+ limit: nil,
141
+ since_id: nil,
142
+ updated_at_max: nil,
143
+ updated_at_min: nil,
144
+ session: ShopifyAPI::Context.active_session,
145
+ **kwargs
146
+ )
147
+ response = base_find(
148
+ session: session,
149
+ ids: {fulfillment_order_id: fulfillment_order_id, order_id: order_id},
150
+ params: {created_at_max: created_at_max, created_at_min: created_at_min, fields: fields, limit: limit, since_id: since_id, updated_at_max: updated_at_max, updated_at_min: updated_at_min}.merge(kwargs).compact,
151
+ )
152
+
153
+ T.cast(response, T::Array[Fulfillment])
154
+ end
155
+
156
+ sig do
157
+ params(
158
+ order_id: T.nilable(T.any(Integer, String)),
159
+ created_at_min: T.untyped,
160
+ created_at_max: T.untyped,
161
+ updated_at_min: T.untyped,
162
+ updated_at_max: T.untyped,
163
+ session: Auth::Session,
164
+ kwargs: T.untyped
165
+ ).returns(T.untyped)
166
+ end
167
+ def count(
168
+ order_id: nil,
169
+ created_at_min: nil,
170
+ created_at_max: nil,
171
+ updated_at_min: nil,
172
+ updated_at_max: nil,
173
+ session: ShopifyAPI::Context.active_session,
174
+ **kwargs
175
+ )
176
+ request(
177
+ http_method: :get,
178
+ operation: :count,
179
+ session: session,
180
+ ids: {order_id: order_id},
181
+ params: {created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max}.merge(kwargs).compact,
182
+ body: {},
183
+ entity: nil,
184
+ )
185
+ end
186
+
187
+ end
188
+
189
+ sig do
190
+ params(
191
+ body: T.untyped,
192
+ kwargs: T.untyped
193
+ ).returns(T.untyped)
194
+ end
195
+ def cancel(
196
+ body: nil,
197
+ **kwargs
198
+ )
199
+ self.class.request(
200
+ http_method: :post,
201
+ operation: :cancel,
202
+ session: @session,
203
+ ids: {id: @id, order_id: @order_id},
204
+ params: {}.merge(kwargs).compact,
205
+ body: body,
206
+ entity: self,
207
+ )
208
+ end
209
+
210
+ sig do
211
+ params(
212
+ body: T.untyped,
213
+ kwargs: T.untyped
214
+ ).returns(T.untyped)
215
+ end
216
+ def complete(
217
+ body: nil,
218
+ **kwargs
219
+ )
220
+ self.class.request(
221
+ http_method: :post,
222
+ operation: :complete,
223
+ session: @session,
224
+ ids: {id: @id, order_id: @order_id},
225
+ params: {}.merge(kwargs).compact,
226
+ body: body,
227
+ entity: self,
228
+ )
229
+ end
230
+
231
+ sig do
232
+ params(
233
+ body: T.untyped,
234
+ kwargs: T.untyped
235
+ ).returns(T.untyped)
236
+ end
237
+ def open(
238
+ body: nil,
239
+ **kwargs
240
+ )
241
+ self.class.request(
242
+ http_method: :post,
243
+ operation: :open,
244
+ session: @session,
245
+ ids: {id: @id, order_id: @order_id},
246
+ params: {}.merge(kwargs).compact,
247
+ body: body,
248
+ entity: self,
249
+ )
250
+ end
251
+
252
+ sig do
253
+ params(
254
+ notify_customer: T.untyped,
255
+ tracking_info: T.untyped,
256
+ body: T.untyped,
257
+ kwargs: T.untyped
258
+ ).returns(T.untyped)
259
+ end
260
+ def update_tracking(
261
+ notify_customer: nil,
262
+ tracking_info: nil,
263
+ body: nil,
264
+ **kwargs
265
+ )
266
+ self.class.request(
267
+ http_method: :post,
268
+ operation: :update_tracking,
269
+ session: @session,
270
+ ids: {id: @id},
271
+ params: {notify_customer: notify_customer, tracking_info: tracking_info}.merge(kwargs).compact,
272
+ body: body,
273
+ entity: self,
274
+ )
275
+ end
276
+
277
+ end
278
+ end
@@ -0,0 +1,166 @@
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 FulfillmentEvent < 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
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @address1 = T.let(nil, T.nilable(String))
20
+ @city = T.let(nil, T.nilable(String))
21
+ @country = T.let(nil, T.nilable(Country))
22
+ @created_at = T.let(nil, T.nilable(String))
23
+ @estimated_delivery_at = T.let(nil, T.nilable(String))
24
+ @fulfillment_id = T.let(nil, T.nilable(Integer))
25
+ @happened_at = T.let(nil, T.nilable(String))
26
+ @id = T.let(nil, T.nilable(Integer))
27
+ @latitude = T.let(nil, T.nilable(Float))
28
+ @longitude = T.let(nil, T.nilable(Float))
29
+ @message = T.let(nil, T.nilable(String))
30
+ @order_id = T.let(nil, T.nilable(Integer))
31
+ @province = T.let(nil, T.nilable(Province))
32
+ @shop_id = T.let(nil, T.nilable(Integer))
33
+ @status = T.let(nil, T.nilable(String))
34
+ @updated_at = T.let(nil, T.nilable(String))
35
+ @zip = T.let(nil, T.nilable(String))
36
+ end
37
+
38
+ @has_one = T.let({
39
+ country: Country,
40
+ province: Province
41
+ }, T::Hash[Symbol, Class])
42
+ @has_many = T.let({}, T::Hash[Symbol, Class])
43
+ @paths = T.let([
44
+ {http_method: :delete, operation: :delete, ids: [:order_id, :fulfillment_id, :id], path: "orders/<order_id>/fulfillments/<fulfillment_id>/events/<id>.json"},
45
+ {http_method: :get, operation: :get, ids: [:order_id, :fulfillment_id], path: "orders/<order_id>/fulfillments/<fulfillment_id>/events.json"},
46
+ {http_method: :get, operation: :get, ids: [:order_id, :fulfillment_id, :id], path: "orders/<order_id>/fulfillments/<fulfillment_id>/events/<id>.json"},
47
+ {http_method: :post, operation: :post, ids: [:order_id, :fulfillment_id], path: "orders/<order_id>/fulfillments/<fulfillment_id>/events.json"}
48
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
49
+
50
+ sig { returns(T.nilable(String)) }
51
+ attr_reader :address1
52
+ sig { returns(T.nilable(String)) }
53
+ attr_reader :city
54
+ sig { returns(T.nilable(Country)) }
55
+ attr_reader :country
56
+ sig { returns(T.nilable(String)) }
57
+ attr_reader :created_at
58
+ sig { returns(T.nilable(String)) }
59
+ attr_reader :estimated_delivery_at
60
+ sig { returns(T.nilable(Integer)) }
61
+ attr_reader :fulfillment_id
62
+ sig { returns(T.nilable(String)) }
63
+ attr_reader :happened_at
64
+ sig { returns(T.nilable(Integer)) }
65
+ attr_reader :id
66
+ sig { returns(T.nilable(Float)) }
67
+ attr_reader :latitude
68
+ sig { returns(T.nilable(Float)) }
69
+ attr_reader :longitude
70
+ sig { returns(T.nilable(String)) }
71
+ attr_reader :message
72
+ sig { returns(T.nilable(Integer)) }
73
+ attr_reader :order_id
74
+ sig { returns(T.nilable(Province)) }
75
+ attr_reader :province
76
+ sig { returns(T.nilable(Integer)) }
77
+ attr_reader :shop_id
78
+ sig { returns(T.nilable(String)) }
79
+ attr_reader :status
80
+ sig { returns(T.nilable(String)) }
81
+ attr_reader :updated_at
82
+ sig { returns(T.nilable(String)) }
83
+ attr_reader :zip
84
+
85
+ class << self
86
+ sig do
87
+ returns(String)
88
+ end
89
+ def json_body_name()
90
+ "event"
91
+ end
92
+
93
+ sig do
94
+ params(
95
+ id: T.any(Integer, String),
96
+ order_id: T.nilable(T.any(Integer, String)),
97
+ fulfillment_id: T.nilable(T.any(Integer, String)),
98
+ event_id: T.untyped,
99
+ session: Auth::Session
100
+ ).returns(T.nilable(FulfillmentEvent))
101
+ end
102
+ def find(
103
+ id:,
104
+ order_id: nil,
105
+ fulfillment_id: nil,
106
+ event_id: nil,
107
+ session: ShopifyAPI::Context.active_session
108
+ )
109
+ result = base_find(
110
+ session: session,
111
+ ids: {id: id, order_id: order_id, fulfillment_id: fulfillment_id},
112
+ params: {event_id: event_id},
113
+ )
114
+ T.cast(result[0], T.nilable(FulfillmentEvent))
115
+ end
116
+
117
+ sig do
118
+ params(
119
+ id: T.any(Integer, String),
120
+ order_id: T.nilable(T.any(Integer, String)),
121
+ fulfillment_id: T.nilable(T.any(Integer, String)),
122
+ session: Auth::Session
123
+ ).returns(T.untyped)
124
+ end
125
+ def delete(
126
+ id:,
127
+ order_id: nil,
128
+ fulfillment_id: nil,
129
+ session: ShopifyAPI::Context.active_session
130
+ )
131
+ request(
132
+ http_method: :delete,
133
+ operation: :delete,
134
+ session: session,
135
+ ids: {id: id, order_id: order_id, fulfillment_id: fulfillment_id},
136
+ params: {},
137
+ )
138
+ end
139
+
140
+ sig do
141
+ params(
142
+ order_id: T.nilable(T.any(Integer, String)),
143
+ fulfillment_id: T.nilable(T.any(Integer, String)),
144
+ session: Auth::Session,
145
+ kwargs: T.untyped
146
+ ).returns(T::Array[FulfillmentEvent])
147
+ end
148
+ def all(
149
+ order_id: nil,
150
+ fulfillment_id: nil,
151
+ session: ShopifyAPI::Context.active_session,
152
+ **kwargs
153
+ )
154
+ response = base_find(
155
+ session: session,
156
+ ids: {order_id: order_id, fulfillment_id: fulfillment_id},
157
+ params: {}.merge(kwargs).compact,
158
+ )
159
+
160
+ T.cast(response, T::Array[FulfillmentEvent])
161
+ end
162
+
163
+ end
164
+
165
+ end
166
+ end