shopify_api 14.5.0 → 14.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -1
  3. data/Gemfile.lock +20 -11
  4. data/docs/usage/oauth.md +14 -0
  5. data/docs/usage/webhooks.md +11 -0
  6. data/lib/shopify_api/admin_versions.rb +2 -1
  7. data/lib/shopify_api/context.rb +2 -2
  8. data/lib/shopify_api/rest/resources/2022_04/shop.rb +2 -2
  9. data/lib/shopify_api/rest/resources/2022_07/shop.rb +2 -2
  10. data/lib/shopify_api/rest/resources/2022_10/shop.rb +2 -2
  11. data/lib/shopify_api/rest/resources/2023_01/shop.rb +2 -2
  12. data/lib/shopify_api/rest/resources/2023_04/shop.rb +2 -2
  13. data/lib/shopify_api/rest/resources/2023_07/shop.rb +2 -2
  14. data/lib/shopify_api/rest/resources/2023_10/shop.rb +2 -2
  15. data/lib/shopify_api/rest/resources/2024_01/shop.rb +2 -2
  16. data/lib/shopify_api/rest/resources/2024_04/shop.rb +2 -2
  17. data/lib/shopify_api/rest/resources/2024_07/shop.rb +2 -2
  18. data/lib/shopify_api/rest/resources/2024_07/webhook.rb +1 -0
  19. data/lib/shopify_api/rest/resources/2024_10/abandoned_checkout.rb +194 -0
  20. data/lib/shopify_api/rest/resources/2024_10/access_scope.rb +62 -0
  21. data/lib/shopify_api/rest/resources/2024_10/apple_pay_certificate.rb +109 -0
  22. data/lib/shopify_api/rest/resources/2024_10/application_charge.rb +113 -0
  23. data/lib/shopify_api/rest/resources/2024_10/application_credit.rb +95 -0
  24. data/lib/shopify_api/rest/resources/2024_10/article.rb +269 -0
  25. data/lib/shopify_api/rest/resources/2024_10/asset.rb +122 -0
  26. data/lib/shopify_api/rest/resources/2024_10/assigned_fulfillment_order.rb +92 -0
  27. data/lib/shopify_api/rest/resources/2024_10/balance.rb +58 -0
  28. data/lib/shopify_api/rest/resources/2024_10/blog.rb +166 -0
  29. data/lib/shopify_api/rest/resources/2024_10/cancellation_request.rb +87 -0
  30. data/lib/shopify_api/rest/resources/2024_10/carrier_service.rb +120 -0
  31. data/lib/shopify_api/rest/resources/2024_10/checkout.rb +213 -0
  32. data/lib/shopify_api/rest/resources/2024_10/collect.rb +146 -0
  33. data/lib/shopify_api/rest/resources/2024_10/collection.rb +114 -0
  34. data/lib/shopify_api/rest/resources/2024_10/collection_listing.rb +159 -0
  35. data/lib/shopify_api/rest/resources/2024_10/comment.rb +287 -0
  36. data/lib/shopify_api/rest/resources/2024_10/country.rb +141 -0
  37. data/lib/shopify_api/rest/resources/2024_10/currency.rb +61 -0
  38. data/lib/shopify_api/rest/resources/2024_10/custom_collection.rb +191 -0
  39. data/lib/shopify_api/rest/resources/2024_10/customer.rb +335 -0
  40. data/lib/shopify_api/rest/resources/2024_10/customer_address.rb +215 -0
  41. data/lib/shopify_api/rest/resources/2024_10/deprecated_api_call.rb +61 -0
  42. data/lib/shopify_api/rest/resources/2024_10/discount_code.rb +226 -0
  43. data/lib/shopify_api/rest/resources/2024_10/dispute.rb +115 -0
  44. data/lib/shopify_api/rest/resources/2024_10/dispute_evidence.rb +121 -0
  45. data/lib/shopify_api/rest/resources/2024_10/dispute_file_upload.rb +85 -0
  46. data/lib/shopify_api/rest/resources/2024_10/draft_order.rb +279 -0
  47. data/lib/shopify_api/rest/resources/2024_10/event.rb +152 -0
  48. data/lib/shopify_api/rest/resources/2024_10/fulfillment.rb +235 -0
  49. data/lib/shopify_api/rest/resources/2024_10/fulfillment_event.rb +167 -0
  50. data/lib/shopify_api/rest/resources/2024_10/fulfillment_order.rb +326 -0
  51. data/lib/shopify_api/rest/resources/2024_10/fulfillment_request.rb +101 -0
  52. data/lib/shopify_api/rest/resources/2024_10/fulfillment_service.rb +134 -0
  53. data/lib/shopify_api/rest/resources/2024_10/gift_card.rb +222 -0
  54. data/lib/shopify_api/rest/resources/2024_10/gift_card_adjustment.rb +122 -0
  55. data/lib/shopify_api/rest/resources/2024_10/image.rb +161 -0
  56. data/lib/shopify_api/rest/resources/2024_10/inventory_item.rb +112 -0
  57. data/lib/shopify_api/rest/resources/2024_10/inventory_level.rb +183 -0
  58. data/lib/shopify_api/rest/resources/2024_10/location.rb +171 -0
  59. data/lib/shopify_api/rest/resources/2024_10/locations_for_move.rb +60 -0
  60. data/lib/shopify_api/rest/resources/2024_10/marketing_event.rb +213 -0
  61. data/lib/shopify_api/rest/resources/2024_10/metafield.rb +348 -0
  62. data/lib/shopify_api/rest/resources/2024_10/mobile_platform_application.rb +114 -0
  63. data/lib/shopify_api/rest/resources/2024_10/order.rb +490 -0
  64. data/lib/shopify_api/rest/resources/2024_10/order_risk.rb +148 -0
  65. data/lib/shopify_api/rest/resources/2024_10/page.rb +198 -0
  66. data/lib/shopify_api/rest/resources/2024_10/payment.rb +144 -0
  67. data/lib/shopify_api/rest/resources/2024_10/payment_gateway.rb +147 -0
  68. data/lib/shopify_api/rest/resources/2024_10/payment_transaction.rb +114 -0
  69. data/lib/shopify_api/rest/resources/2024_10/payout.rb +101 -0
  70. data/lib/shopify_api/rest/resources/2024_10/policy.rb +73 -0
  71. data/lib/shopify_api/rest/resources/2024_10/price_rule.rb +227 -0
  72. data/lib/shopify_api/rest/resources/2024_10/product.rb +227 -0
  73. data/lib/shopify_api/rest/resources/2024_10/product_listing.rb +200 -0
  74. data/lib/shopify_api/rest/resources/2024_10/product_resource_feedback.rb +92 -0
  75. data/lib/shopify_api/rest/resources/2024_10/province.rb +136 -0
  76. data/lib/shopify_api/rest/resources/2024_10/recurring_application_charge.rb +184 -0
  77. data/lib/shopify_api/rest/resources/2024_10/redirect.rb +143 -0
  78. data/lib/shopify_api/rest/resources/2024_10/refund.rb +155 -0
  79. data/lib/shopify_api/rest/resources/2024_10/resource_feedback.rb +77 -0
  80. data/lib/shopify_api/rest/resources/2024_10/script_tag.rb +159 -0
  81. data/lib/shopify_api/rest/resources/2024_10/shipping_zone.rb +87 -0
  82. data/lib/shopify_api/rest/resources/2024_10/shop.rb +232 -0
  83. data/lib/shopify_api/rest/resources/2024_10/smart_collection.rb +220 -0
  84. data/lib/shopify_api/rest/resources/2024_10/storefront_access_token.rb +91 -0
  85. data/lib/shopify_api/rest/resources/2024_10/tender_transaction.rb +97 -0
  86. data/lib/shopify_api/rest/resources/2024_10/theme.rb +127 -0
  87. data/lib/shopify_api/rest/resources/2024_10/transaction.rb +189 -0
  88. data/lib/shopify_api/rest/resources/2024_10/usage_charge.rb +106 -0
  89. data/lib/shopify_api/rest/resources/2024_10/user.rb +142 -0
  90. data/lib/shopify_api/rest/resources/2024_10/variant.rb +212 -0
  91. data/lib/shopify_api/rest/resources/2024_10/webhook.rb +173 -0
  92. data/lib/shopify_api/version.rb +1 -1
  93. data/lib/shopify_api/webhooks/registration.rb +17 -3
  94. data/lib/shopify_api/webhooks/registrations/event_bridge.rb +22 -3
  95. data/lib/shopify_api/webhooks/registrations/http.rb +22 -3
  96. data/lib/shopify_api/webhooks/registrations/pub_sub.rb +23 -4
  97. data/lib/shopify_api/webhooks/registry.rb +15 -5
  98. metadata +76 -3
@@ -0,0 +1,200 @@
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 ProductListing < 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
+ @body_html = T.let(nil, T.nilable(String))
22
+ @created_at = T.let(nil, T.nilable(String))
23
+ @handle = T.let(nil, T.nilable(String))
24
+ @images = T.let(nil, T.nilable(T::Array[T.untyped]))
25
+ @options = T.let(nil, T.nilable(T::Array[T.untyped]))
26
+ @product_id = T.let(nil, T.nilable(Integer))
27
+ @product_type = T.let(nil, T.nilable(String))
28
+ @published_at = T.let(nil, T.nilable(String))
29
+ @tags = T.let(nil, T.nilable(String))
30
+ @title = T.let(nil, T.nilable(String))
31
+ @updated_at = T.let(nil, T.nilable(String))
32
+ @variants = T.let(nil, T.nilable(T::Array[T.untyped]))
33
+ @vendor = T.let(nil, T.nilable(String))
34
+
35
+ super(session: session, from_hash: from_hash)
36
+ end
37
+
38
+ @has_one = T.let({}, T::Hash[Symbol, Class])
39
+ @has_many = T.let({
40
+ images: Image,
41
+ variants: Variant
42
+ }, T::Hash[Symbol, Class])
43
+ @paths = T.let([
44
+ {http_method: :delete, operation: :delete, ids: [:product_id], path: "product_listings/<product_id>.json"},
45
+ {http_method: :get, operation: :count, ids: [], path: "product_listings/count.json"},
46
+ {http_method: :get, operation: :get, ids: [], path: "product_listings.json"},
47
+ {http_method: :get, operation: :get, ids: [:product_id], path: "product_listings/<product_id>.json"},
48
+ {http_method: :get, operation: :product_ids, ids: [], path: "product_listings/product_ids.json"},
49
+ {http_method: :put, operation: :put, ids: [:product_id], path: "product_listings/<product_id>.json"}
50
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
51
+
52
+ sig { returns(T.nilable(String)) }
53
+ attr_reader :body_html
54
+ sig { returns(T.nilable(String)) }
55
+ attr_reader :created_at
56
+ sig { returns(T.nilable(String)) }
57
+ attr_reader :handle
58
+ sig { returns(T.nilable(T::Array[Image])) }
59
+ attr_reader :images
60
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
61
+ attr_reader :options
62
+ sig { returns(T.nilable(Integer)) }
63
+ attr_reader :product_id
64
+ sig { returns(T.nilable(String)) }
65
+ attr_reader :product_type
66
+ sig { returns(T.nilable(String)) }
67
+ attr_reader :published_at
68
+ sig { returns(T.nilable(String)) }
69
+ attr_reader :tags
70
+ sig { returns(T.nilable(String)) }
71
+ attr_reader :title
72
+ sig { returns(T.nilable(String)) }
73
+ attr_reader :updated_at
74
+ sig { returns(T.nilable(T::Array[Variant])) }
75
+ attr_reader :variants
76
+ sig { returns(T.nilable(String)) }
77
+ attr_reader :vendor
78
+
79
+ class << self
80
+ sig do
81
+ returns(String)
82
+ end
83
+ def primary_key()
84
+ "product_id"
85
+ end
86
+
87
+ sig do
88
+ params(
89
+ product_id: T.any(Integer, String),
90
+ session: Auth::Session
91
+ ).returns(T.nilable(ProductListing))
92
+ end
93
+ def find(
94
+ product_id:,
95
+ session: ShopifyAPI::Context.active_session
96
+ )
97
+ result = base_find(
98
+ session: session,
99
+ ids: {product_id: product_id},
100
+ params: {},
101
+ )
102
+ T.cast(result[0], T.nilable(ProductListing))
103
+ end
104
+
105
+ sig do
106
+ params(
107
+ product_id: T.any(Integer, String),
108
+ session: Auth::Session
109
+ ).returns(T.untyped)
110
+ end
111
+ def delete(
112
+ product_id:,
113
+ session: ShopifyAPI::Context.active_session
114
+ )
115
+ request(
116
+ http_method: :delete,
117
+ operation: :delete,
118
+ session: session,
119
+ ids: {product_id: product_id},
120
+ params: {},
121
+ )
122
+ end
123
+
124
+ sig do
125
+ params(
126
+ product_ids: T.untyped,
127
+ limit: T.untyped,
128
+ collection_id: T.untyped,
129
+ updated_at_min: T.untyped,
130
+ handle: T.untyped,
131
+ session: Auth::Session,
132
+ kwargs: T.untyped
133
+ ).returns(T::Array[ProductListing])
134
+ end
135
+ def all(
136
+ product_ids: nil,
137
+ limit: nil,
138
+ collection_id: nil,
139
+ updated_at_min: nil,
140
+ handle: nil,
141
+ session: ShopifyAPI::Context.active_session,
142
+ **kwargs
143
+ )
144
+ response = base_find(
145
+ session: session,
146
+ ids: {},
147
+ params: {product_ids: product_ids, limit: limit, collection_id: collection_id, updated_at_min: updated_at_min, handle: handle}.merge(kwargs).compact,
148
+ )
149
+
150
+ T.cast(response, T::Array[ProductListing])
151
+ end
152
+
153
+ sig do
154
+ params(
155
+ session: Auth::Session,
156
+ kwargs: T.untyped
157
+ ).returns(T.untyped)
158
+ end
159
+ def count(
160
+ session: ShopifyAPI::Context.active_session,
161
+ **kwargs
162
+ )
163
+ request(
164
+ http_method: :get,
165
+ operation: :count,
166
+ session: session,
167
+ ids: {},
168
+ params: {}.merge(kwargs).compact,
169
+ body: {},
170
+ entity: nil,
171
+ )
172
+ end
173
+
174
+ sig do
175
+ params(
176
+ limit: T.untyped,
177
+ session: Auth::Session,
178
+ kwargs: T.untyped
179
+ ).returns(T.untyped)
180
+ end
181
+ def product_ids(
182
+ limit: nil,
183
+ session: ShopifyAPI::Context.active_session,
184
+ **kwargs
185
+ )
186
+ request(
187
+ http_method: :get,
188
+ operation: :product_ids,
189
+ session: session,
190
+ ids: {},
191
+ params: {limit: limit}.merge(kwargs).compact,
192
+ body: {},
193
+ entity: nil,
194
+ )
195
+ end
196
+
197
+ end
198
+
199
+ end
200
+ end
@@ -0,0 +1,92 @@
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 ProductResourceFeedback < 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
+ @created_at = T.let(nil, T.nilable(String))
22
+ @feedback_generated_at = T.let(nil, T.nilable(String))
23
+ @messages = T.let(nil, T.nilable(T::Array[T.untyped]))
24
+ @product_id = T.let(nil, T.nilable(Integer))
25
+ @resource_id = T.let(nil, T.nilable(Integer))
26
+ @resource_type = T.let(nil, T.nilable(String))
27
+ @resource_updated_at = T.let(nil, T.nilable(String))
28
+ @state = T.let(nil, T.nilable(String))
29
+ @updated_at = T.let(nil, T.nilable(String))
30
+
31
+ super(session: session, from_hash: from_hash)
32
+ end
33
+
34
+ @has_one = T.let({}, T::Hash[Symbol, Class])
35
+ @has_many = T.let({}, T::Hash[Symbol, Class])
36
+ @paths = T.let([
37
+ {http_method: :get, operation: :get, ids: [:product_id], path: "products/<product_id>/resource_feedback.json"},
38
+ {http_method: :post, operation: :post, ids: [:product_id], path: "products/<product_id>/resource_feedback.json"}
39
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
40
+
41
+ sig { returns(T.nilable(String)) }
42
+ attr_reader :created_at
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :feedback_generated_at
45
+ sig { returns(T.nilable(T::Array[String])) }
46
+ attr_reader :messages
47
+ sig { returns(T.nilable(Integer)) }
48
+ attr_reader :product_id
49
+ sig { returns(T.nilable(Integer)) }
50
+ attr_reader :resource_id
51
+ sig { returns(T.nilable(String)) }
52
+ attr_reader :resource_type
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :resource_updated_at
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :state
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :updated_at
59
+
60
+ class << self
61
+ sig do
62
+ returns(String)
63
+ end
64
+ def json_body_name()
65
+ "resource_feedback"
66
+ end
67
+
68
+ sig do
69
+ params(
70
+ product_id: T.nilable(T.any(Integer, String)),
71
+ session: Auth::Session,
72
+ kwargs: T.untyped
73
+ ).returns(T::Array[ProductResourceFeedback])
74
+ end
75
+ def all(
76
+ product_id: nil,
77
+ session: ShopifyAPI::Context.active_session,
78
+ **kwargs
79
+ )
80
+ response = base_find(
81
+ session: session,
82
+ ids: {product_id: product_id},
83
+ params: {}.merge(kwargs).compact,
84
+ )
85
+
86
+ T.cast(response, T::Array[ProductResourceFeedback])
87
+ end
88
+
89
+ end
90
+
91
+ end
92
+ end
@@ -0,0 +1,136 @@
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 Province < 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
+ @country_id = T.let(nil, T.nilable(Integer))
23
+ @id = T.let(nil, T.nilable(Integer))
24
+ @name = T.let(nil, T.nilable(String))
25
+ @shipping_zone_id = T.let(nil, T.nilable(Integer))
26
+ @tax = T.let(nil, T.nilable(Float))
27
+ @tax_name = T.let(nil, T.nilable(String))
28
+ @tax_percentage = T.let(nil, T.nilable(Float))
29
+ @tax_type = T.let(nil, T.nilable(String))
30
+
31
+ super(session: session, from_hash: from_hash)
32
+ end
33
+
34
+ @has_one = T.let({}, T::Hash[Symbol, Class])
35
+ @has_many = T.let({}, T::Hash[Symbol, Class])
36
+ @paths = T.let([
37
+ {http_method: :get, operation: :count, ids: [:country_id], path: "countries/<country_id>/provinces/count.json"},
38
+ {http_method: :get, operation: :get, ids: [:country_id], path: "countries/<country_id>/provinces.json"},
39
+ {http_method: :get, operation: :get, ids: [:country_id, :id], path: "countries/<country_id>/provinces/<id>.json"},
40
+ {http_method: :put, operation: :put, ids: [:country_id, :id], path: "countries/<country_id>/provinces/<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 :code
45
+ sig { returns(T.nilable(Integer)) }
46
+ attr_reader :country_id
47
+ sig { returns(T.nilable(Integer)) }
48
+ attr_reader :id
49
+ sig { returns(T.nilable(String)) }
50
+ attr_reader :name
51
+ sig { returns(T.nilable(Integer)) }
52
+ attr_reader :shipping_zone_id
53
+ sig { returns(T.nilable(Float)) }
54
+ attr_reader :tax
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :tax_name
57
+ sig { returns(T.nilable(Float)) }
58
+ attr_reader :tax_percentage
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :tax_type
61
+
62
+ class << self
63
+ sig do
64
+ params(
65
+ id: T.any(Integer, String),
66
+ country_id: T.nilable(T.any(Integer, String)),
67
+ fields: T.untyped,
68
+ session: Auth::Session
69
+ ).returns(T.nilable(Province))
70
+ end
71
+ def find(
72
+ id:,
73
+ country_id: nil,
74
+ fields: nil,
75
+ session: ShopifyAPI::Context.active_session
76
+ )
77
+ result = base_find(
78
+ session: session,
79
+ ids: {id: id, country_id: country_id},
80
+ params: {fields: fields},
81
+ )
82
+ T.cast(result[0], T.nilable(Province))
83
+ end
84
+
85
+ sig do
86
+ params(
87
+ country_id: T.nilable(T.any(Integer, String)),
88
+ since_id: T.untyped,
89
+ fields: T.untyped,
90
+ session: Auth::Session,
91
+ kwargs: T.untyped
92
+ ).returns(T::Array[Province])
93
+ end
94
+ def all(
95
+ country_id: nil,
96
+ since_id: nil,
97
+ fields: nil,
98
+ session: ShopifyAPI::Context.active_session,
99
+ **kwargs
100
+ )
101
+ response = base_find(
102
+ session: session,
103
+ ids: {country_id: country_id},
104
+ params: {since_id: since_id, fields: fields}.merge(kwargs).compact,
105
+ )
106
+
107
+ T.cast(response, T::Array[Province])
108
+ end
109
+
110
+ sig do
111
+ params(
112
+ country_id: T.nilable(T.any(Integer, String)),
113
+ session: Auth::Session,
114
+ kwargs: T.untyped
115
+ ).returns(T.untyped)
116
+ end
117
+ def count(
118
+ country_id: nil,
119
+ session: ShopifyAPI::Context.active_session,
120
+ **kwargs
121
+ )
122
+ request(
123
+ http_method: :get,
124
+ operation: :count,
125
+ session: session,
126
+ ids: {country_id: country_id},
127
+ params: {}.merge(kwargs).compact,
128
+ body: {},
129
+ entity: nil,
130
+ )
131
+ end
132
+
133
+ end
134
+
135
+ end
136
+ end
@@ -0,0 +1,184 @@
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 RecurringApplicationCharge < 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
+ @activated_on = T.let(nil, T.nilable(String))
22
+ @billing_on = T.let(nil, T.nilable(String))
23
+ @cancelled_on = T.let(nil, T.nilable(String))
24
+ @capped_amount = T.let(nil, T.nilable(T.any(String, Integer)))
25
+ @confirmation_url = T.let(nil, T.nilable(String))
26
+ @created_at = T.let(nil, T.nilable(String))
27
+ @currency = T.let(nil, T.nilable(Currency))
28
+ @id = T.let(nil, T.nilable(Integer))
29
+ @name = T.let(nil, T.nilable(String))
30
+ @price = T.let(nil, T.nilable(T.any(String, Float)))
31
+ @return_url = T.let(nil, T.nilable(String))
32
+ @status = T.let(nil, T.nilable(String))
33
+ @terms = T.let(nil, T.nilable(String))
34
+ @test = T.let(nil, T.nilable(T::Boolean))
35
+ @trial_days = T.let(nil, T.nilable(Integer))
36
+ @trial_ends_on = T.let(nil, T.nilable(String))
37
+ @updated_at = T.let(nil, T.nilable(String))
38
+
39
+ super(session: session, from_hash: from_hash)
40
+ end
41
+
42
+ @has_one = T.let({
43
+ currency: Currency
44
+ }, T::Hash[Symbol, Class])
45
+ @has_many = T.let({}, T::Hash[Symbol, Class])
46
+ @paths = T.let([
47
+ {http_method: :delete, operation: :delete, ids: [:id], path: "recurring_application_charges/<id>.json"},
48
+ {http_method: :get, operation: :get, ids: [], path: "recurring_application_charges.json"},
49
+ {http_method: :get, operation: :get, ids: [:id], path: "recurring_application_charges/<id>.json"},
50
+ {http_method: :post, operation: :post, ids: [], path: "recurring_application_charges.json"},
51
+ {http_method: :put, operation: :customize, ids: [:id], path: "recurring_application_charges/<id>/customize.json"}
52
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
53
+
54
+ sig { returns(T.nilable(String)) }
55
+ attr_reader :activated_on
56
+ sig { returns(T.nilable(String)) }
57
+ attr_reader :billing_on
58
+ sig { returns(T.nilable(String)) }
59
+ attr_reader :cancelled_on
60
+ sig { returns(T.nilable(T.any(String, Integer))) }
61
+ attr_reader :capped_amount
62
+ sig { returns(T.nilable(String)) }
63
+ attr_reader :confirmation_url
64
+ sig { returns(T.nilable(String)) }
65
+ attr_reader :created_at
66
+ sig { returns(T.nilable(Currency)) }
67
+ attr_reader :currency
68
+ sig { returns(T.nilable(Integer)) }
69
+ attr_reader :id
70
+ sig { returns(T.nilable(String)) }
71
+ attr_reader :name
72
+ sig { returns(T.nilable(T.any(String, Float))) }
73
+ attr_reader :price
74
+ sig { returns(T.nilable(String)) }
75
+ attr_reader :return_url
76
+ sig { returns(T.nilable(String)) }
77
+ attr_reader :status
78
+ sig { returns(T.nilable(String)) }
79
+ attr_reader :terms
80
+ sig { returns(T.nilable(T::Boolean)) }
81
+ attr_reader :test
82
+ sig { returns(T.nilable(Integer)) }
83
+ attr_reader :trial_days
84
+ sig { returns(T.nilable(String)) }
85
+ attr_reader :trial_ends_on
86
+ sig { returns(T.nilable(String)) }
87
+ attr_reader :updated_at
88
+
89
+ class << self
90
+ sig do
91
+ params(
92
+ id: T.any(Integer, String),
93
+ fields: T.untyped,
94
+ session: Auth::Session
95
+ ).returns(T.nilable(RecurringApplicationCharge))
96
+ end
97
+ def find(
98
+ id:,
99
+ fields: nil,
100
+ session: ShopifyAPI::Context.active_session
101
+ )
102
+ result = base_find(
103
+ session: session,
104
+ ids: {id: id},
105
+ params: {fields: fields},
106
+ )
107
+ T.cast(result[0], T.nilable(RecurringApplicationCharge))
108
+ end
109
+
110
+ sig do
111
+ params(
112
+ id: T.any(Integer, String),
113
+ session: Auth::Session
114
+ ).returns(T.untyped)
115
+ end
116
+ def delete(
117
+ id:,
118
+ session: ShopifyAPI::Context.active_session
119
+ )
120
+ request(
121
+ http_method: :delete,
122
+ operation: :delete,
123
+ session: session,
124
+ ids: {id: id},
125
+ params: {},
126
+ )
127
+ end
128
+
129
+ sig do
130
+ params(
131
+ since_id: T.untyped,
132
+ fields: T.untyped,
133
+ session: Auth::Session,
134
+ kwargs: T.untyped
135
+ ).returns(T::Array[RecurringApplicationCharge])
136
+ end
137
+ def all(
138
+ since_id: nil,
139
+ fields: nil,
140
+ session: ShopifyAPI::Context.active_session,
141
+ **kwargs
142
+ )
143
+ response = base_find(
144
+ session: session,
145
+ ids: {},
146
+ params: {since_id: since_id, fields: fields}.merge(kwargs).compact,
147
+ )
148
+
149
+ T.cast(response, T::Array[RecurringApplicationCharge])
150
+ end
151
+
152
+ sig do
153
+ params(session: Auth::Session)
154
+ .returns(T.nilable(RecurringApplicationCharge))
155
+ end
156
+ def current(session: ShopifyAPI::Context.active_session)
157
+ charges = all(session: session)
158
+ charges.select { |charge| charge.status == "active" }.first
159
+ end
160
+ end
161
+
162
+ sig do
163
+ params(
164
+ body: T.untyped,
165
+ kwargs: T.untyped
166
+ ).returns(T.untyped)
167
+ end
168
+ def customize(
169
+ body: nil,
170
+ **kwargs
171
+ )
172
+ self.class.request(
173
+ http_method: :put,
174
+ operation: :customize,
175
+ session: @session,
176
+ ids: {id: @id},
177
+ params: {}.merge(kwargs).compact,
178
+ body: body,
179
+ entity: self,
180
+ )
181
+ end
182
+
183
+ end
184
+ end