shopify_api 13.1.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/BREAKING_CHANGES_FOR_V10.md +231 -0
  3. data/CHANGELOG.md +8 -1
  4. data/Gemfile.lock +5 -5
  5. data/README.md +10 -34
  6. data/docs/README.md +0 -1
  7. data/docs/getting_started.md +20 -3
  8. data/docs/usage/custom_apps.md +75 -0
  9. data/docs/usage/graphql.md +63 -18
  10. data/docs/usage/oauth.md +160 -27
  11. data/docs/usage/rest.md +204 -62
  12. data/docs/usage/webhooks.md +22 -4
  13. data/lib/shopify_api/admin_versions.rb +2 -1
  14. data/lib/shopify_api/context.rb +5 -3
  15. data/lib/shopify_api/rest/base.rb +22 -14
  16. data/lib/shopify_api/rest/resources/2022_10/assigned_fulfillment_order.rb +5 -3
  17. data/lib/shopify_api/rest/resources/2022_10/customer_address.rb +10 -0
  18. data/lib/shopify_api/rest/resources/2022_10/fulfillment_request.rb +10 -0
  19. data/lib/shopify_api/rest/resources/2022_10/order_risk.rb +5 -3
  20. data/lib/shopify_api/rest/resources/2023_01/assigned_fulfillment_order.rb +5 -3
  21. data/lib/shopify_api/rest/resources/2023_01/balance.rb +4 -0
  22. data/lib/shopify_api/rest/resources/2023_01/customer_address.rb +10 -0
  23. data/lib/shopify_api/rest/resources/2023_01/fulfillment_request.rb +10 -0
  24. data/lib/shopify_api/rest/resources/2023_01/order.rb +3 -0
  25. data/lib/shopify_api/rest/resources/2023_01/order_risk.rb +5 -3
  26. data/lib/shopify_api/rest/resources/2023_01/shop.rb +0 -3
  27. data/lib/shopify_api/rest/resources/2023_01/variant.rb +1 -5
  28. data/lib/shopify_api/rest/resources/2023_04/assigned_fulfillment_order.rb +5 -3
  29. data/lib/shopify_api/rest/resources/2023_04/balance.rb +4 -0
  30. data/lib/shopify_api/rest/resources/2023_04/customer_address.rb +10 -0
  31. data/lib/shopify_api/rest/resources/2023_04/fulfillment_request.rb +10 -0
  32. data/lib/shopify_api/rest/resources/2023_04/order.rb +3 -0
  33. data/lib/shopify_api/rest/resources/2023_04/order_risk.rb +5 -3
  34. data/lib/shopify_api/rest/resources/2023_04/shop.rb +0 -3
  35. data/lib/shopify_api/rest/resources/2023_04/variant.rb +1 -5
  36. data/lib/shopify_api/rest/resources/2023_07/assigned_fulfillment_order.rb +5 -3
  37. data/lib/shopify_api/rest/resources/2023_07/balance.rb +4 -0
  38. data/lib/shopify_api/rest/resources/2023_07/customer_address.rb +10 -0
  39. data/lib/shopify_api/rest/resources/2023_07/fulfillment_request.rb +10 -0
  40. data/lib/shopify_api/rest/resources/2023_07/order.rb +3 -0
  41. data/lib/shopify_api/rest/resources/2023_07/order_risk.rb +5 -3
  42. data/lib/shopify_api/rest/resources/2023_07/report.rb +121 -0
  43. data/lib/shopify_api/rest/resources/2023_07/shop.rb +0 -3
  44. data/lib/shopify_api/rest/resources/2023_07/variant.rb +1 -5
  45. data/lib/shopify_api/rest/resources/2023_10/abandoned_checkout.rb +190 -0
  46. data/lib/shopify_api/rest/resources/2023_10/access_scope.rb +58 -0
  47. data/lib/shopify_api/rest/resources/2023_10/apple_pay_certificate.rb +105 -0
  48. data/lib/shopify_api/rest/resources/2023_10/application_charge.rb +109 -0
  49. data/lib/shopify_api/rest/resources/2023_10/application_credit.rb +91 -0
  50. data/lib/shopify_api/rest/resources/2023_10/article.rb +265 -0
  51. data/lib/shopify_api/rest/resources/2023_10/asset.rb +118 -0
  52. data/lib/shopify_api/rest/resources/2023_10/assigned_fulfillment_order.rb +88 -0
  53. data/lib/shopify_api/rest/resources/2023_10/balance.rb +54 -0
  54. data/lib/shopify_api/rest/resources/2023_10/blog.rb +162 -0
  55. data/lib/shopify_api/rest/resources/2023_10/cancellation_request.rb +83 -0
  56. data/lib/shopify_api/rest/resources/2023_10/carrier_service.rb +116 -0
  57. data/lib/shopify_api/rest/resources/2023_10/checkout.rb +209 -0
  58. data/lib/shopify_api/rest/resources/2023_10/collect.rb +142 -0
  59. data/lib/shopify_api/rest/resources/2023_10/collection.rb +110 -0
  60. data/lib/shopify_api/rest/resources/2023_10/collection_listing.rb +155 -0
  61. data/lib/shopify_api/rest/resources/2023_10/comment.rb +283 -0
  62. data/lib/shopify_api/rest/resources/2023_10/country.rb +137 -0
  63. data/lib/shopify_api/rest/resources/2023_10/currency.rb +57 -0
  64. data/lib/shopify_api/rest/resources/2023_10/custom_collection.rb +187 -0
  65. data/lib/shopify_api/rest/resources/2023_10/customer.rb +329 -0
  66. data/lib/shopify_api/rest/resources/2023_10/customer_address.rb +211 -0
  67. data/lib/shopify_api/rest/resources/2023_10/deprecated_api_call.rb +57 -0
  68. data/lib/shopify_api/rest/resources/2023_10/discount_code.rb +222 -0
  69. data/lib/shopify_api/rest/resources/2023_10/dispute.rb +111 -0
  70. data/lib/shopify_api/rest/resources/2023_10/dispute_evidence.rb +117 -0
  71. data/lib/shopify_api/rest/resources/2023_10/dispute_file_upload.rb +81 -0
  72. data/lib/shopify_api/rest/resources/2023_10/draft_order.rb +275 -0
  73. data/lib/shopify_api/rest/resources/2023_10/event.rb +148 -0
  74. data/lib/shopify_api/rest/resources/2023_10/fulfillment.rb +231 -0
  75. data/lib/shopify_api/rest/resources/2023_10/fulfillment_event.rb +166 -0
  76. data/lib/shopify_api/rest/resources/2023_10/fulfillment_order.rb +312 -0
  77. data/lib/shopify_api/rest/resources/2023_10/fulfillment_request.rb +97 -0
  78. data/lib/shopify_api/rest/resources/2023_10/fulfillment_service.rb +130 -0
  79. data/lib/shopify_api/rest/resources/2023_10/gift_card.rb +218 -0
  80. data/lib/shopify_api/rest/resources/2023_10/gift_card_adjustment.rb +118 -0
  81. data/lib/shopify_api/rest/resources/2023_10/image.rb +157 -0
  82. data/lib/shopify_api/rest/resources/2023_10/inventory_item.rb +108 -0
  83. data/lib/shopify_api/rest/resources/2023_10/inventory_level.rb +179 -0
  84. data/lib/shopify_api/rest/resources/2023_10/location.rb +167 -0
  85. data/lib/shopify_api/rest/resources/2023_10/locations_for_move.rb +56 -0
  86. data/lib/shopify_api/rest/resources/2023_10/marketing_event.rb +209 -0
  87. data/lib/shopify_api/rest/resources/2023_10/metafield.rb +344 -0
  88. data/lib/shopify_api/rest/resources/2023_10/mobile_platform_application.rb +110 -0
  89. data/lib/shopify_api/rest/resources/2023_10/order.rb +491 -0
  90. data/lib/shopify_api/rest/resources/2023_10/order_risk.rb +144 -0
  91. data/lib/shopify_api/rest/resources/2023_10/page.rb +194 -0
  92. data/lib/shopify_api/rest/resources/2023_10/payment.rb +140 -0
  93. data/lib/shopify_api/rest/resources/2023_10/payment_gateway.rb +143 -0
  94. data/lib/shopify_api/rest/resources/2023_10/payment_transaction.rb +107 -0
  95. data/lib/shopify_api/rest/resources/2023_10/payout.rb +97 -0
  96. data/lib/shopify_api/rest/resources/2023_10/policy.rb +69 -0
  97. data/lib/shopify_api/rest/resources/2023_10/price_rule.rb +223 -0
  98. data/lib/shopify_api/rest/resources/2023_10/product.rb +223 -0
  99. data/lib/shopify_api/rest/resources/2023_10/product_listing.rb +196 -0
  100. data/lib/shopify_api/rest/resources/2023_10/product_resource_feedback.rb +88 -0
  101. data/lib/shopify_api/rest/resources/2023_10/province.rb +132 -0
  102. data/lib/shopify_api/rest/resources/2023_10/recurring_application_charge.rb +172 -0
  103. data/lib/shopify_api/rest/resources/2023_10/redirect.rb +139 -0
  104. data/lib/shopify_api/rest/resources/2023_10/refund.rb +151 -0
  105. data/lib/shopify_api/rest/resources/2023_10/report.rb +121 -0
  106. data/lib/shopify_api/rest/resources/2023_10/resource_feedback.rb +73 -0
  107. data/lib/shopify_api/rest/resources/2023_10/script_tag.rb +155 -0
  108. data/lib/shopify_api/rest/resources/2023_10/shipping_zone.rb +83 -0
  109. data/lib/shopify_api/rest/resources/2023_10/shop.rb +218 -0
  110. data/lib/shopify_api/rest/resources/2023_10/smart_collection.rb +216 -0
  111. data/lib/shopify_api/rest/resources/2023_10/storefront_access_token.rb +87 -0
  112. data/lib/shopify_api/rest/resources/2023_10/tender_transaction.rb +93 -0
  113. data/lib/shopify_api/rest/resources/2023_10/theme.rb +123 -0
  114. data/lib/shopify_api/rest/resources/2023_10/transaction.rb +184 -0
  115. data/lib/shopify_api/rest/resources/2023_10/usage_charge.rb +102 -0
  116. data/lib/shopify_api/rest/resources/2023_10/user.rb +138 -0
  117. data/lib/shopify_api/rest/resources/2023_10/variant.rb +208 -0
  118. data/lib/shopify_api/rest/resources/2023_10/webhook.rb +168 -0
  119. data/lib/shopify_api/version.rb +1 -1
  120. data/lib/shopify_api/webhooks/registration.rb +19 -4
  121. data/lib/shopify_api/webhooks/registrations/event_bridge.rb +1 -1
  122. data/lib/shopify_api/webhooks/registrations/http.rb +1 -1
  123. data/lib/shopify_api/webhooks/registrations/pub_sub.rb +2 -1
  124. data/lib/shopify_api/webhooks/registry.rb +9 -5
  125. metadata +80 -6
  126. data/.github/workflows/stale.yml +0 -43
  127. data/docs/issues.md +0 -39
  128. data/docs/usage/session_storage.md +0 -46
@@ -0,0 +1,162 @@
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 Blog < 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
+ @admin_graphql_api_id = T.let(nil, T.nilable(String))
20
+ @commentable = T.let(nil, T.nilable(String))
21
+ @created_at = T.let(nil, T.nilable(String))
22
+ @feedburner = T.let(nil, T.nilable(String))
23
+ @feedburner_location = T.let(nil, T.nilable(String))
24
+ @handle = T.let(nil, T.nilable(String))
25
+ @id = T.let(nil, T.nilable(Integer))
26
+ @metafields = T.let(nil, T.nilable(T::Array[T.untyped]))
27
+ @tags = T.let(nil, T.nilable(String))
28
+ @template_suffix = T.let(nil, T.nilable(String))
29
+ @title = T.let(nil, T.nilable(String))
30
+ @updated_at = T.let(nil, T.nilable(String))
31
+ end
32
+
33
+ @has_one = T.let({}, T::Hash[Symbol, Class])
34
+ @has_many = T.let({
35
+ metafields: Metafield
36
+ }, T::Hash[Symbol, Class])
37
+ @paths = T.let([
38
+ {http_method: :delete, operation: :delete, ids: [:id], path: "blogs/<id>.json"},
39
+ {http_method: :get, operation: :count, ids: [], path: "blogs/count.json"},
40
+ {http_method: :get, operation: :get, ids: [], path: "blogs.json"},
41
+ {http_method: :get, operation: :get, ids: [:id], path: "blogs/<id>.json"},
42
+ {http_method: :post, operation: :post, ids: [], path: "blogs.json"},
43
+ {http_method: :put, operation: :put, ids: [:id], path: "blogs/<id>.json"}
44
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
45
+
46
+ sig { returns(T.nilable(String)) }
47
+ attr_reader :admin_graphql_api_id
48
+ sig { returns(T.nilable(String)) }
49
+ attr_reader :commentable
50
+ sig { returns(T.nilable(String)) }
51
+ attr_reader :created_at
52
+ sig { returns(T.nilable(String)) }
53
+ attr_reader :feedburner
54
+ sig { returns(T.nilable(String)) }
55
+ attr_reader :feedburner_location
56
+ sig { returns(T.nilable(String)) }
57
+ attr_reader :handle
58
+ sig { returns(T.nilable(Integer)) }
59
+ attr_reader :id
60
+ sig { returns(T.nilable(T::Array[Metafield])) }
61
+ attr_reader :metafields
62
+ sig { returns(T.nilable(String)) }
63
+ attr_reader :tags
64
+ sig { returns(T.nilable(String)) }
65
+ attr_reader :template_suffix
66
+ sig { returns(T.nilable(String)) }
67
+ attr_reader :title
68
+ sig { returns(T.nilable(String)) }
69
+ attr_reader :updated_at
70
+
71
+ class << self
72
+ sig do
73
+ params(
74
+ id: T.any(Integer, String),
75
+ fields: T.untyped,
76
+ session: Auth::Session
77
+ ).returns(T.nilable(Blog))
78
+ end
79
+ def find(
80
+ id:,
81
+ fields: nil,
82
+ session: ShopifyAPI::Context.active_session
83
+ )
84
+ result = base_find(
85
+ session: session,
86
+ ids: {id: id},
87
+ params: {fields: fields},
88
+ )
89
+ T.cast(result[0], T.nilable(Blog))
90
+ end
91
+
92
+ sig do
93
+ params(
94
+ id: T.any(Integer, String),
95
+ session: Auth::Session
96
+ ).returns(T.untyped)
97
+ end
98
+ def delete(
99
+ id:,
100
+ session: ShopifyAPI::Context.active_session
101
+ )
102
+ request(
103
+ http_method: :delete,
104
+ operation: :delete,
105
+ session: session,
106
+ ids: {id: id},
107
+ params: {},
108
+ )
109
+ end
110
+
111
+ sig do
112
+ params(
113
+ limit: T.untyped,
114
+ since_id: T.untyped,
115
+ handle: T.untyped,
116
+ fields: T.untyped,
117
+ session: Auth::Session,
118
+ kwargs: T.untyped
119
+ ).returns(T::Array[Blog])
120
+ end
121
+ def all(
122
+ limit: nil,
123
+ since_id: nil,
124
+ handle: nil,
125
+ fields: nil,
126
+ session: ShopifyAPI::Context.active_session,
127
+ **kwargs
128
+ )
129
+ response = base_find(
130
+ session: session,
131
+ ids: {},
132
+ params: {limit: limit, since_id: since_id, handle: handle, fields: fields}.merge(kwargs).compact,
133
+ )
134
+
135
+ T.cast(response, T::Array[Blog])
136
+ end
137
+
138
+ sig do
139
+ params(
140
+ session: Auth::Session,
141
+ kwargs: T.untyped
142
+ ).returns(T.untyped)
143
+ end
144
+ def count(
145
+ session: ShopifyAPI::Context.active_session,
146
+ **kwargs
147
+ )
148
+ request(
149
+ http_method: :get,
150
+ operation: :count,
151
+ session: session,
152
+ ids: {},
153
+ params: {}.merge(kwargs).compact,
154
+ body: {},
155
+ entity: nil,
156
+ )
157
+ end
158
+
159
+ end
160
+
161
+ end
162
+ end
@@ -0,0 +1,83 @@
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 CancellationRequest < 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
+ @fulfillment_order_id = T.let(nil, T.nilable(Integer))
20
+ end
21
+
22
+ @has_one = T.let({}, T::Hash[Symbol, Class])
23
+ @has_many = T.let({}, T::Hash[Symbol, Class])
24
+ @paths = T.let([
25
+ {http_method: :post, operation: :accept, ids: [:fulfillment_order_id], path: "fulfillment_orders/<fulfillment_order_id>/cancellation_request/accept.json"},
26
+ {http_method: :post, operation: :post, ids: [:fulfillment_order_id], path: "fulfillment_orders/<fulfillment_order_id>/cancellation_request.json"},
27
+ {http_method: :post, operation: :reject, ids: [:fulfillment_order_id], path: "fulfillment_orders/<fulfillment_order_id>/cancellation_request/reject.json"}
28
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
29
+
30
+ sig { returns(T.nilable(Integer)) }
31
+ attr_reader :fulfillment_order_id
32
+
33
+ class << self
34
+ end
35
+
36
+ sig do
37
+ params(
38
+ message: T.untyped,
39
+ body: T.untyped,
40
+ kwargs: T.untyped
41
+ ).returns(T.untyped)
42
+ end
43
+ def accept(
44
+ message: nil,
45
+ body: nil,
46
+ **kwargs
47
+ )
48
+ self.class.request(
49
+ http_method: :post,
50
+ operation: :accept,
51
+ session: @session,
52
+ ids: {fulfillment_order_id: @fulfillment_order_id},
53
+ params: {message: message}.merge(kwargs).compact,
54
+ body: body,
55
+ entity: self,
56
+ )
57
+ end
58
+
59
+ sig do
60
+ params(
61
+ message: T.untyped,
62
+ body: T.untyped,
63
+ kwargs: T.untyped
64
+ ).returns(T.untyped)
65
+ end
66
+ def reject(
67
+ message: nil,
68
+ body: nil,
69
+ **kwargs
70
+ )
71
+ self.class.request(
72
+ http_method: :post,
73
+ operation: :reject,
74
+ session: @session,
75
+ ids: {fulfillment_order_id: @fulfillment_order_id},
76
+ params: {message: message}.merge(kwargs).compact,
77
+ body: body,
78
+ entity: self,
79
+ )
80
+ end
81
+
82
+ end
83
+ end
@@ -0,0 +1,116 @@
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 CarrierService < 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
+ @active = T.let(nil, T.nilable(T::Boolean))
20
+ @admin_graphql_api_id = T.let(nil, T.nilable(String))
21
+ @callback_url = T.let(nil, T.nilable(String))
22
+ @carrier_service_type = T.let(nil, T.nilable(String))
23
+ @format = T.let(nil, T.nilable(String))
24
+ @id = T.let(nil, T.nilable(Integer))
25
+ @name = T.let(nil, T.nilable(String))
26
+ @service_discovery = T.let(nil, T.nilable(T::Boolean))
27
+ end
28
+
29
+ @has_one = T.let({}, T::Hash[Symbol, Class])
30
+ @has_many = T.let({}, T::Hash[Symbol, Class])
31
+ @paths = T.let([
32
+ {http_method: :delete, operation: :delete, ids: [:id], path: "carrier_services/<id>.json"},
33
+ {http_method: :get, operation: :get, ids: [], path: "carrier_services.json"},
34
+ {http_method: :get, operation: :get, ids: [:id], path: "carrier_services/<id>.json"},
35
+ {http_method: :post, operation: :post, ids: [], path: "carrier_services.json"},
36
+ {http_method: :put, operation: :put, ids: [:id], path: "carrier_services/<id>.json"}
37
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
38
+
39
+ sig { returns(T.nilable(T::Boolean)) }
40
+ attr_reader :active
41
+ sig { returns(T.nilable(String)) }
42
+ attr_reader :admin_graphql_api_id
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :callback_url
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :carrier_service_type
47
+ sig { returns(T.nilable(String)) }
48
+ attr_reader :format
49
+ sig { returns(T.nilable(Integer)) }
50
+ attr_reader :id
51
+ sig { returns(T.nilable(String)) }
52
+ attr_reader :name
53
+ sig { returns(T.nilable(T::Boolean)) }
54
+ attr_reader :service_discovery
55
+
56
+ class << self
57
+ sig do
58
+ params(
59
+ id: T.any(Integer, String),
60
+ session: Auth::Session
61
+ ).returns(T.nilable(CarrierService))
62
+ end
63
+ def find(
64
+ id:,
65
+ session: ShopifyAPI::Context.active_session
66
+ )
67
+ result = base_find(
68
+ session: session,
69
+ ids: {id: id},
70
+ params: {},
71
+ )
72
+ T.cast(result[0], T.nilable(CarrierService))
73
+ end
74
+
75
+ sig do
76
+ params(
77
+ id: T.any(Integer, String),
78
+ session: Auth::Session
79
+ ).returns(T.untyped)
80
+ end
81
+ def delete(
82
+ id:,
83
+ session: ShopifyAPI::Context.active_session
84
+ )
85
+ request(
86
+ http_method: :delete,
87
+ operation: :delete,
88
+ session: session,
89
+ ids: {id: id},
90
+ params: {},
91
+ )
92
+ end
93
+
94
+ sig do
95
+ params(
96
+ session: Auth::Session,
97
+ kwargs: T.untyped
98
+ ).returns(T::Array[CarrierService])
99
+ end
100
+ def all(
101
+ session: ShopifyAPI::Context.active_session,
102
+ **kwargs
103
+ )
104
+ response = base_find(
105
+ session: session,
106
+ ids: {},
107
+ params: {}.merge(kwargs).compact,
108
+ )
109
+
110
+ T.cast(response, T::Array[CarrierService])
111
+ end
112
+
113
+ end
114
+
115
+ end
116
+ end
@@ -0,0 +1,209 @@
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 Checkout < 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
+ @billing_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
20
+ @line_items = T.let(nil, T.nilable(T::Array[T.untyped]))
21
+ @applied_discount = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
22
+ @buyer_accepts_marketing = T.let(nil, T.nilable(T::Boolean))
23
+ @created_at = T.let(nil, T.nilable(String))
24
+ @currency = T.let(nil, T.nilable(String))
25
+ @customer_id = T.let(nil, T.nilable(Integer))
26
+ @discount_code = T.let(nil, T.nilable(DiscountCode))
27
+ @email = T.let(nil, T.nilable(String))
28
+ @gift_cards = T.let(nil, T.nilable(T::Array[T.untyped]))
29
+ @order = T.let(nil, T.nilable(Order))
30
+ @payment_due = T.let(nil, T.nilable(String))
31
+ @payment_url = T.let(nil, T.nilable(String))
32
+ @phone = T.let(nil, T.nilable(String))
33
+ @presentment_currency = T.let(nil, T.nilable(String))
34
+ @requires_shipping = T.let(nil, T.nilable(T::Boolean))
35
+ @reservation_time = T.let(nil, T.nilable(String))
36
+ @reservation_time_left = T.let(nil, T.nilable(Integer))
37
+ @shipping_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
38
+ @shipping_line = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
39
+ @shipping_rate = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
40
+ @source_identifier = T.let(nil, T.nilable(String))
41
+ @source_name = T.let(nil, T.nilable(String))
42
+ @source_url = T.let(nil, T.nilable(String))
43
+ @subtotal_price = T.let(nil, T.nilable(String))
44
+ @tax_lines = T.let(nil, T.nilable(T::Array[T.untyped]))
45
+ @taxes_included = T.let(nil, T.nilable(T::Boolean))
46
+ @token = T.let(nil, T.nilable(String))
47
+ @total_price = T.let(nil, T.nilable(String))
48
+ @total_tax = T.let(nil, T.nilable(String))
49
+ @updated_at = T.let(nil, T.nilable(String))
50
+ @user_id = T.let(nil, T.nilable(Integer))
51
+ @web_url = T.let(nil, T.nilable(String))
52
+ end
53
+
54
+ @has_one = T.let({
55
+ discount_code: DiscountCode,
56
+ order: Order
57
+ }, T::Hash[Symbol, Class])
58
+ @has_many = T.let({
59
+ gift_cards: GiftCard
60
+ }, T::Hash[Symbol, Class])
61
+ @paths = T.let([
62
+ {http_method: :get, operation: :get, ids: [:token], path: "checkouts/<token>.json"},
63
+ {http_method: :get, operation: :shipping_rates, ids: [:token], path: "checkouts/<token>/shipping_rates.json"},
64
+ {http_method: :post, operation: :complete, ids: [:token], path: "checkouts/<token>/complete.json"},
65
+ {http_method: :post, operation: :post, ids: [], path: "checkouts.json"},
66
+ {http_method: :put, operation: :put, ids: [:token], path: "checkouts/<token>.json"}
67
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
68
+
69
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
70
+ attr_reader :billing_address
71
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
72
+ attr_reader :line_items
73
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
74
+ attr_reader :applied_discount
75
+ sig { returns(T.nilable(T::Boolean)) }
76
+ attr_reader :buyer_accepts_marketing
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :created_at
79
+ sig { returns(T.nilable(String)) }
80
+ attr_reader :currency
81
+ sig { returns(T.nilable(Integer)) }
82
+ attr_reader :customer_id
83
+ sig { returns(T.nilable(DiscountCode)) }
84
+ attr_reader :discount_code
85
+ sig { returns(T.nilable(String)) }
86
+ attr_reader :email
87
+ sig { returns(T.nilable(T::Array[GiftCard])) }
88
+ attr_reader :gift_cards
89
+ sig { returns(T.nilable(Order)) }
90
+ attr_reader :order
91
+ sig { returns(T.nilable(String)) }
92
+ attr_reader :payment_due
93
+ sig { returns(T.nilable(String)) }
94
+ attr_reader :payment_url
95
+ sig { returns(T.nilable(String)) }
96
+ attr_reader :phone
97
+ sig { returns(T.nilable(String)) }
98
+ attr_reader :presentment_currency
99
+ sig { returns(T.nilable(T::Boolean)) }
100
+ attr_reader :requires_shipping
101
+ sig { returns(T.nilable(String)) }
102
+ attr_reader :reservation_time
103
+ sig { returns(T.nilable(Integer)) }
104
+ attr_reader :reservation_time_left
105
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
106
+ attr_reader :shipping_address
107
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
108
+ attr_reader :shipping_line
109
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
110
+ attr_reader :shipping_rate
111
+ sig { returns(T.nilable(String)) }
112
+ attr_reader :source_identifier
113
+ sig { returns(T.nilable(String)) }
114
+ attr_reader :source_name
115
+ sig { returns(T.nilable(String)) }
116
+ attr_reader :source_url
117
+ sig { returns(T.nilable(String)) }
118
+ attr_reader :subtotal_price
119
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
120
+ attr_reader :tax_lines
121
+ sig { returns(T.nilable(T::Boolean)) }
122
+ attr_reader :taxes_included
123
+ sig { returns(T.nilable(String)) }
124
+ attr_reader :token
125
+ sig { returns(T.nilable(String)) }
126
+ attr_reader :total_price
127
+ sig { returns(T.nilable(String)) }
128
+ attr_reader :total_tax
129
+ sig { returns(T.nilable(String)) }
130
+ attr_reader :updated_at
131
+ sig { returns(T.nilable(Integer)) }
132
+ attr_reader :user_id
133
+ sig { returns(T.nilable(String)) }
134
+ attr_reader :web_url
135
+
136
+ class << self
137
+ sig do
138
+ returns(String)
139
+ end
140
+ def primary_key()
141
+ "token"
142
+ end
143
+
144
+ sig do
145
+ params(
146
+ token: T.any(Integer, String),
147
+ session: Auth::Session
148
+ ).returns(T.nilable(Checkout))
149
+ end
150
+ def find(
151
+ token:,
152
+ session: ShopifyAPI::Context.active_session
153
+ )
154
+ result = base_find(
155
+ session: session,
156
+ ids: {token: token},
157
+ params: {},
158
+ )
159
+ T.cast(result[0], T.nilable(Checkout))
160
+ end
161
+
162
+ sig do
163
+ params(
164
+ token: T.any(Integer, String),
165
+ session: Auth::Session,
166
+ kwargs: T.untyped
167
+ ).returns(T.untyped)
168
+ end
169
+ def shipping_rates(
170
+ token:,
171
+ session: ShopifyAPI::Context.active_session,
172
+ **kwargs
173
+ )
174
+ request(
175
+ http_method: :get,
176
+ operation: :shipping_rates,
177
+ session: session,
178
+ ids: {token: token},
179
+ params: {}.merge(kwargs).compact,
180
+ body: {},
181
+ entity: nil,
182
+ )
183
+ end
184
+
185
+ end
186
+
187
+ sig do
188
+ params(
189
+ body: T.untyped,
190
+ kwargs: T.untyped
191
+ ).returns(T.untyped)
192
+ end
193
+ def complete(
194
+ body: nil,
195
+ **kwargs
196
+ )
197
+ self.class.request(
198
+ http_method: :post,
199
+ operation: :complete,
200
+ session: @session,
201
+ ids: {token: @token},
202
+ params: {}.merge(kwargs).compact,
203
+ body: body,
204
+ entity: self,
205
+ )
206
+ end
207
+
208
+ end
209
+ end