shopify_api 13.0.0 → 13.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +7 -7
  4. data/README.md +0 -7
  5. data/docs/getting_started.md +1 -8
  6. data/lib/shopify_api/admin_versions.rb +2 -1
  7. data/lib/shopify_api/context.rb +1 -0
  8. data/lib/shopify_api/rest/base.rb +5 -1
  9. data/lib/shopify_api/rest/resources/2022_04/fulfillment_order.rb +3 -7
  10. data/lib/shopify_api/rest/resources/2022_04/shop.rb +2 -2
  11. data/lib/shopify_api/rest/resources/2022_07/fulfillment_order.rb +3 -7
  12. data/lib/shopify_api/rest/resources/2022_07/shop.rb +2 -2
  13. data/lib/shopify_api/rest/resources/2022_10/fulfillment_order.rb +3 -7
  14. data/lib/shopify_api/rest/resources/2022_10/shop.rb +2 -2
  15. data/lib/shopify_api/rest/resources/2023_01/fulfillment_order.rb +3 -7
  16. data/lib/shopify_api/rest/resources/2023_01/shop.rb +2 -2
  17. data/lib/shopify_api/rest/resources/2023_04/shop.rb +2 -2
  18. data/lib/shopify_api/rest/resources/2023_07/abandoned_checkout.rb +190 -0
  19. data/lib/shopify_api/rest/resources/2023_07/access_scope.rb +58 -0
  20. data/lib/shopify_api/rest/resources/2023_07/apple_pay_certificate.rb +105 -0
  21. data/lib/shopify_api/rest/resources/2023_07/application_charge.rb +109 -0
  22. data/lib/shopify_api/rest/resources/2023_07/application_credit.rb +91 -0
  23. data/lib/shopify_api/rest/resources/2023_07/article.rb +265 -0
  24. data/lib/shopify_api/rest/resources/2023_07/asset.rb +118 -0
  25. data/lib/shopify_api/rest/resources/2023_07/assigned_fulfillment_order.rb +86 -0
  26. data/lib/shopify_api/rest/resources/2023_07/balance.rb +50 -0
  27. data/lib/shopify_api/rest/resources/2023_07/blog.rb +162 -0
  28. data/lib/shopify_api/rest/resources/2023_07/cancellation_request.rb +83 -0
  29. data/lib/shopify_api/rest/resources/2023_07/carrier_service.rb +116 -0
  30. data/lib/shopify_api/rest/resources/2023_07/checkout.rb +209 -0
  31. data/lib/shopify_api/rest/resources/2023_07/collect.rb +142 -0
  32. data/lib/shopify_api/rest/resources/2023_07/collection.rb +110 -0
  33. data/lib/shopify_api/rest/resources/2023_07/collection_listing.rb +155 -0
  34. data/lib/shopify_api/rest/resources/2023_07/comment.rb +283 -0
  35. data/lib/shopify_api/rest/resources/2023_07/country.rb +137 -0
  36. data/lib/shopify_api/rest/resources/2023_07/currency.rb +57 -0
  37. data/lib/shopify_api/rest/resources/2023_07/custom_collection.rb +187 -0
  38. data/lib/shopify_api/rest/resources/2023_07/customer.rb +329 -0
  39. data/lib/shopify_api/rest/resources/2023_07/customer_address.rb +201 -0
  40. data/lib/shopify_api/rest/resources/2023_07/customer_saved_search.rb +169 -0
  41. data/lib/shopify_api/rest/resources/2023_07/deprecated_api_call.rb +57 -0
  42. data/lib/shopify_api/rest/resources/2023_07/discount_code.rb +222 -0
  43. data/lib/shopify_api/rest/resources/2023_07/dispute.rb +111 -0
  44. data/lib/shopify_api/rest/resources/2023_07/dispute_evidence.rb +117 -0
  45. data/lib/shopify_api/rest/resources/2023_07/dispute_file_upload.rb +81 -0
  46. data/lib/shopify_api/rest/resources/2023_07/draft_order.rb +275 -0
  47. data/lib/shopify_api/rest/resources/2023_07/event.rb +148 -0
  48. data/lib/shopify_api/rest/resources/2023_07/fulfillment.rb +231 -0
  49. data/lib/shopify_api/rest/resources/2023_07/fulfillment_event.rb +166 -0
  50. data/lib/shopify_api/rest/resources/2023_07/fulfillment_order.rb +312 -0
  51. data/lib/shopify_api/rest/resources/2023_07/fulfillment_request.rb +87 -0
  52. data/lib/shopify_api/rest/resources/2023_07/fulfillment_service.rb +130 -0
  53. data/lib/shopify_api/rest/resources/2023_07/gift_card.rb +218 -0
  54. data/lib/shopify_api/rest/resources/2023_07/gift_card_adjustment.rb +118 -0
  55. data/lib/shopify_api/rest/resources/2023_07/image.rb +157 -0
  56. data/lib/shopify_api/rest/resources/2023_07/inventory_item.rb +108 -0
  57. data/lib/shopify_api/rest/resources/2023_07/inventory_level.rb +179 -0
  58. data/lib/shopify_api/rest/resources/2023_07/location.rb +167 -0
  59. data/lib/shopify_api/rest/resources/2023_07/locations_for_move.rb +56 -0
  60. data/lib/shopify_api/rest/resources/2023_07/marketing_event.rb +209 -0
  61. data/lib/shopify_api/rest/resources/2023_07/metafield.rb +344 -0
  62. data/lib/shopify_api/rest/resources/2023_07/mobile_platform_application.rb +110 -0
  63. data/lib/shopify_api/rest/resources/2023_07/order.rb +488 -0
  64. data/lib/shopify_api/rest/resources/2023_07/order_risk.rb +142 -0
  65. data/lib/shopify_api/rest/resources/2023_07/page.rb +194 -0
  66. data/lib/shopify_api/rest/resources/2023_07/payment.rb +140 -0
  67. data/lib/shopify_api/rest/resources/2023_07/payment_gateway.rb +143 -0
  68. data/lib/shopify_api/rest/resources/2023_07/payment_transaction.rb +107 -0
  69. data/lib/shopify_api/rest/resources/2023_07/payout.rb +97 -0
  70. data/lib/shopify_api/rest/resources/2023_07/policy.rb +69 -0
  71. data/lib/shopify_api/rest/resources/2023_07/price_rule.rb +223 -0
  72. data/lib/shopify_api/rest/resources/2023_07/product.rb +223 -0
  73. data/lib/shopify_api/rest/resources/2023_07/product_listing.rb +196 -0
  74. data/lib/shopify_api/rest/resources/2023_07/product_resource_feedback.rb +88 -0
  75. data/lib/shopify_api/rest/resources/2023_07/province.rb +132 -0
  76. data/lib/shopify_api/rest/resources/2023_07/recurring_application_charge.rb +172 -0
  77. data/lib/shopify_api/rest/resources/2023_07/redirect.rb +139 -0
  78. data/lib/shopify_api/rest/resources/2023_07/refund.rb +151 -0
  79. data/lib/shopify_api/rest/resources/2023_07/resource_feedback.rb +73 -0
  80. data/lib/shopify_api/rest/resources/2023_07/script_tag.rb +155 -0
  81. data/lib/shopify_api/rest/resources/2023_07/shipping_zone.rb +83 -0
  82. data/lib/shopify_api/rest/resources/2023_07/shop.rb +221 -0
  83. data/lib/shopify_api/rest/resources/2023_07/smart_collection.rb +216 -0
  84. data/lib/shopify_api/rest/resources/2023_07/storefront_access_token.rb +87 -0
  85. data/lib/shopify_api/rest/resources/2023_07/tender_transaction.rb +93 -0
  86. data/lib/shopify_api/rest/resources/2023_07/theme.rb +123 -0
  87. data/lib/shopify_api/rest/resources/2023_07/transaction.rb +184 -0
  88. data/lib/shopify_api/rest/resources/2023_07/usage_charge.rb +102 -0
  89. data/lib/shopify_api/rest/resources/2023_07/user.rb +138 -0
  90. data/lib/shopify_api/rest/resources/2023_07/variant.rb +212 -0
  91. data/lib/shopify_api/rest/resources/2023_07/webhook.rb +168 -0
  92. data/lib/shopify_api/version.rb +1 -1
  93. data/shopify_api.gemspec +1 -1
  94. metadata +77 -9
@@ -0,0 +1,111 @@
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
+ sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void }
16
+ def initialize(session: ShopifyAPI::Context.active_session)
17
+ super(session: session)
18
+
19
+ @amount = T.let(nil, T.nilable(String))
20
+ @currency = T.let(nil, T.nilable(String))
21
+ @evidence_due_by = T.let(nil, T.nilable(String))
22
+ @evidence_sent_on = T.let(nil, T.nilable(String))
23
+ @finalized_on = T.let(nil, T.nilable(String))
24
+ @id = T.let(nil, T.nilable(Integer))
25
+ @network_reason_code = T.let(nil, T.nilable(String))
26
+ @order_id = T.let(nil, T.nilable(Integer))
27
+ @reason = T.let(nil, T.nilable(String))
28
+ @status = T.let(nil, T.nilable(String))
29
+ @type = T.let(nil, T.nilable(String))
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: :get, operation: :get, ids: [], path: "shopify_payments/disputes.json"},
36
+ {http_method: :get, operation: :get, ids: [:id], path: "shopify_payments/disputes/<id>.json"}
37
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
38
+
39
+ sig { returns(T.nilable(String)) }
40
+ attr_reader :amount
41
+ sig { returns(T.nilable(String)) }
42
+ attr_reader :currency
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :evidence_due_by
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :evidence_sent_on
47
+ sig { returns(T.nilable(String)) }
48
+ attr_reader :finalized_on
49
+ sig { returns(T.nilable(Integer)) }
50
+ attr_reader :id
51
+ sig { returns(T.nilable(String)) }
52
+ attr_reader :network_reason_code
53
+ sig { returns(T.nilable(Integer)) }
54
+ attr_reader :order_id
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :reason
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :status
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :type
61
+
62
+ class << self
63
+ sig do
64
+ params(
65
+ id: T.any(Integer, String),
66
+ session: Auth::Session
67
+ ).returns(T.nilable(Dispute))
68
+ end
69
+ def find(
70
+ id:,
71
+ session: ShopifyAPI::Context.active_session
72
+ )
73
+ result = base_find(
74
+ session: session,
75
+ ids: {id: id},
76
+ params: {},
77
+ )
78
+ T.cast(result[0], T.nilable(Dispute))
79
+ end
80
+
81
+ sig do
82
+ params(
83
+ since_id: T.untyped,
84
+ last_id: T.untyped,
85
+ status: T.untyped,
86
+ initiated_at: T.untyped,
87
+ session: Auth::Session,
88
+ kwargs: T.untyped
89
+ ).returns(T::Array[Dispute])
90
+ end
91
+ def all(
92
+ since_id: nil,
93
+ last_id: nil,
94
+ status: nil,
95
+ initiated_at: nil,
96
+ session: ShopifyAPI::Context.active_session,
97
+ **kwargs
98
+ )
99
+ response = base_find(
100
+ session: session,
101
+ ids: {},
102
+ params: {since_id: since_id, last_id: last_id, status: status, initiated_at: initiated_at}.merge(kwargs).compact,
103
+ )
104
+
105
+ T.cast(response, T::Array[Dispute])
106
+ end
107
+
108
+ end
109
+
110
+ end
111
+ end
@@ -0,0 +1,117 @@
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 DisputeEvidence < 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
+ @access_activity_log = T.let(nil, T.nilable(String))
20
+ @billing_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
21
+ @cancellation_policy_disclosure = T.let(nil, T.nilable(String))
22
+ @cancellation_rebuttal = T.let(nil, T.nilable(String))
23
+ @created_at = T.let(nil, T.nilable(String))
24
+ @customer_email_address = T.let(nil, T.nilable(String))
25
+ @customer_first_name = T.let(nil, T.nilable(String))
26
+ @customer_last_name = T.let(nil, T.nilable(String))
27
+ @dispute_evidence_files = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
28
+ @fulfillments = T.let(nil, T.nilable(T::Array[T.untyped]))
29
+ @id = T.let(nil, T.nilable(Integer))
30
+ @payments_dispute_id = T.let(nil, T.nilable(Integer))
31
+ @product_description = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
32
+ @refund_policy_disclosure = T.let(nil, T.nilable(String))
33
+ @refund_refusal_explanation = T.let(nil, T.nilable(String))
34
+ @shipping_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
35
+ @submitted = T.let(nil, T.nilable(T::Boolean))
36
+ @uncategorized_text = T.let(nil, T.nilable(String))
37
+ @updated_on = T.let(nil, T.nilable(String))
38
+ end
39
+
40
+ @has_one = T.let({}, T::Hash[Symbol, Class])
41
+ @has_many = T.let({
42
+ fulfillments: Fulfillment
43
+ }, T::Hash[Symbol, Class])
44
+ @paths = T.let([
45
+ {http_method: :get, operation: :get, ids: [:dispute_id], path: "shopify_payments/disputes/<dispute_id>/dispute_evidences.json"},
46
+ {http_method: :put, operation: :put, ids: [:dispute_id], path: "shopify_payments/disputes/<dispute_id>/dispute_evidences.json"}
47
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
48
+
49
+ sig { returns(T.nilable(String)) }
50
+ attr_reader :access_activity_log
51
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
52
+ attr_reader :billing_address
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :cancellation_policy_disclosure
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :cancellation_rebuttal
57
+ sig { returns(T.nilable(String)) }
58
+ attr_reader :created_at
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :customer_email_address
61
+ sig { returns(T.nilable(String)) }
62
+ attr_reader :customer_first_name
63
+ sig { returns(T.nilable(String)) }
64
+ attr_reader :customer_last_name
65
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
66
+ attr_reader :dispute_evidence_files
67
+ sig { returns(T.nilable(T::Array[Fulfillment])) }
68
+ attr_reader :fulfillments
69
+ sig { returns(T.nilable(Integer)) }
70
+ attr_reader :id
71
+ sig { returns(T.nilable(Integer)) }
72
+ attr_reader :payments_dispute_id
73
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
74
+ attr_reader :product_description
75
+ sig { returns(T.nilable(String)) }
76
+ attr_reader :refund_policy_disclosure
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :refund_refusal_explanation
79
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
80
+ attr_reader :shipping_address
81
+ sig { returns(T.nilable(T::Boolean)) }
82
+ attr_reader :submitted
83
+ sig { returns(T.nilable(String)) }
84
+ attr_reader :uncategorized_text
85
+ sig { returns(T.nilable(String)) }
86
+ attr_reader :updated_on
87
+
88
+ class << self
89
+ sig do
90
+ returns(String)
91
+ end
92
+ def primary_key()
93
+ "dispute_id"
94
+ end
95
+
96
+ sig do
97
+ params(
98
+ dispute_id: T.any(Integer, String),
99
+ session: Auth::Session
100
+ ).returns(T.nilable(DisputeEvidence))
101
+ end
102
+ def find(
103
+ dispute_id:,
104
+ session: ShopifyAPI::Context.active_session
105
+ )
106
+ result = base_find(
107
+ session: session,
108
+ ids: {dispute_id: dispute_id},
109
+ params: {},
110
+ )
111
+ T.cast(result[0], T.nilable(DisputeEvidence))
112
+ end
113
+
114
+ end
115
+
116
+ end
117
+ end
@@ -0,0 +1,81 @@
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 DisputeFileUpload < 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
+ @dispute_evidence_id = T.let(nil, T.nilable(Integer))
20
+ @dispute_evidence_type = T.let(nil, T.nilable(String))
21
+ @file_size = T.let(nil, T.nilable(Integer))
22
+ @file_type = T.let(nil, T.nilable(String))
23
+ @filename = T.let(nil, T.nilable(String))
24
+ @id = T.let(nil, T.nilable(Integer))
25
+ @original_filename = T.let(nil, T.nilable(String))
26
+ @shop_id = T.let(nil, T.nilable(Integer))
27
+ @url = T.let(nil, T.nilable(String))
28
+ end
29
+
30
+ @has_one = T.let({}, T::Hash[Symbol, Class])
31
+ @has_many = T.let({}, T::Hash[Symbol, Class])
32
+ @paths = T.let([
33
+ {http_method: :delete, operation: :delete, ids: [:dispute_id, :id], path: "shopify_payments/disputes/<dispute_id>/dispute_file_uploads/<id>.json"},
34
+ {http_method: :post, operation: :post, ids: [:dispute_id], path: "shopify_payments/disputes/<dispute_id>/dispute_file_uploads.json"}
35
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
36
+
37
+ sig { returns(T.nilable(Integer)) }
38
+ attr_reader :dispute_evidence_id
39
+ sig { returns(T.nilable(String)) }
40
+ attr_reader :dispute_evidence_type
41
+ sig { returns(T.nilable(Integer)) }
42
+ attr_reader :file_size
43
+ sig { returns(T.nilable(String)) }
44
+ attr_reader :file_type
45
+ sig { returns(T.nilable(String)) }
46
+ attr_reader :filename
47
+ sig { returns(T.nilable(Integer)) }
48
+ attr_reader :id
49
+ sig { returns(T.nilable(String)) }
50
+ attr_reader :original_filename
51
+ sig { returns(T.nilable(Integer)) }
52
+ attr_reader :shop_id
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :url
55
+
56
+ class << self
57
+ sig do
58
+ params(
59
+ id: T.any(Integer, String),
60
+ dispute_id: T.nilable(T.any(Integer, String)),
61
+ session: Auth::Session
62
+ ).returns(T.untyped)
63
+ end
64
+ def delete(
65
+ id:,
66
+ dispute_id: nil,
67
+ session: ShopifyAPI::Context.active_session
68
+ )
69
+ request(
70
+ http_method: :delete,
71
+ operation: :delete,
72
+ session: session,
73
+ ids: {id: id, dispute_id: dispute_id},
74
+ params: {},
75
+ )
76
+ end
77
+
78
+ end
79
+
80
+ end
81
+ end
@@ -0,0 +1,275 @@
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 DraftOrder < 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
+ @applied_discount = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
20
+ @billing_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
21
+ @completed_at = T.let(nil, T.nilable(String))
22
+ @created_at = T.let(nil, T.nilable(String))
23
+ @currency = T.let(nil, T.nilable(String))
24
+ @customer = T.let(nil, T.nilable(Customer))
25
+ @email = T.let(nil, T.nilable(String))
26
+ @id = T.let(nil, T.nilable(Integer))
27
+ @invoice_sent_at = T.let(nil, T.nilable(String))
28
+ @invoice_url = T.let(nil, T.nilable(String))
29
+ @line_items = T.let(nil, T.nilable(T::Array[T.untyped]))
30
+ @name = T.let(nil, T.nilable(String))
31
+ @note = T.let(nil, T.nilable(String))
32
+ @note_attributes = T.let(nil, T.nilable(T::Array[T.untyped]))
33
+ @order_id = T.let(nil, T.nilable(Integer))
34
+ @payment_terms = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
35
+ @shipping_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
36
+ @shipping_line = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
37
+ @source_name = T.let(nil, T.nilable(String))
38
+ @status = T.let(nil, T.nilable(String))
39
+ @subtotal_price = T.let(nil, T.nilable(String))
40
+ @tags = T.let(nil, T.nilable(String))
41
+ @tax_exempt = T.let(nil, T.nilable(T::Boolean))
42
+ @tax_exemptions = T.let(nil, T.nilable(T::Array[T.untyped]))
43
+ @tax_lines = T.let(nil, T.nilable(T::Array[T.untyped]))
44
+ @taxes_included = T.let(nil, T.nilable(T::Boolean))
45
+ @total_price = T.let(nil, T.nilable(String))
46
+ @total_tax = T.let(nil, T.nilable(String))
47
+ @updated_at = T.let(nil, T.nilable(String))
48
+ end
49
+
50
+ @has_one = T.let({
51
+ customer: Customer
52
+ }, T::Hash[Symbol, Class])
53
+ @has_many = T.let({}, T::Hash[Symbol, Class])
54
+ @paths = T.let([
55
+ {http_method: :delete, operation: :delete, ids: [:id], path: "draft_orders/<id>.json"},
56
+ {http_method: :get, operation: :count, ids: [], path: "draft_orders/count.json"},
57
+ {http_method: :get, operation: :get, ids: [], path: "draft_orders.json"},
58
+ {http_method: :get, operation: :get, ids: [:id], path: "draft_orders/<id>.json"},
59
+ {http_method: :post, operation: :post, ids: [], path: "draft_orders.json"},
60
+ {http_method: :post, operation: :send_invoice, ids: [:id], path: "draft_orders/<id>/send_invoice.json"},
61
+ {http_method: :put, operation: :complete, ids: [:id], path: "draft_orders/<id>/complete.json"},
62
+ {http_method: :put, operation: :put, ids: [:id], path: "draft_orders/<id>.json"}
63
+ ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]])
64
+
65
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
66
+ attr_reader :applied_discount
67
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
68
+ attr_reader :billing_address
69
+ sig { returns(T.nilable(String)) }
70
+ attr_reader :completed_at
71
+ sig { returns(T.nilable(String)) }
72
+ attr_reader :created_at
73
+ sig { returns(T.nilable(String)) }
74
+ attr_reader :currency
75
+ sig { returns(T.nilable(Customer)) }
76
+ attr_reader :customer
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :email
79
+ sig { returns(T.nilable(Integer)) }
80
+ attr_reader :id
81
+ sig { returns(T.nilable(String)) }
82
+ attr_reader :invoice_sent_at
83
+ sig { returns(T.nilable(String)) }
84
+ attr_reader :invoice_url
85
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
86
+ attr_reader :line_items
87
+ sig { returns(T.nilable(String)) }
88
+ attr_reader :name
89
+ sig { returns(T.nilable(String)) }
90
+ attr_reader :note
91
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
92
+ attr_reader :note_attributes
93
+ sig { returns(T.nilable(Integer)) }
94
+ attr_reader :order_id
95
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
96
+ attr_reader :payment_terms
97
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
98
+ attr_reader :shipping_address
99
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
100
+ attr_reader :shipping_line
101
+ sig { returns(T.nilable(String)) }
102
+ attr_reader :source_name
103
+ sig { returns(T.nilable(String)) }
104
+ attr_reader :status
105
+ sig { returns(T.nilable(String)) }
106
+ attr_reader :subtotal_price
107
+ sig { returns(T.nilable(String)) }
108
+ attr_reader :tags
109
+ sig { returns(T.nilable(T::Boolean)) }
110
+ attr_reader :tax_exempt
111
+ sig { returns(T.nilable(T::Array[String])) }
112
+ attr_reader :tax_exemptions
113
+ sig { returns(T.nilable(T::Array[T::Hash[T.untyped, T.untyped]])) }
114
+ attr_reader :tax_lines
115
+ sig { returns(T.nilable(T::Boolean)) }
116
+ attr_reader :taxes_included
117
+ sig { returns(T.nilable(String)) }
118
+ attr_reader :total_price
119
+ sig { returns(T.nilable(String)) }
120
+ attr_reader :total_tax
121
+ sig { returns(T.nilable(String)) }
122
+ attr_reader :updated_at
123
+
124
+ class << self
125
+ sig do
126
+ params(
127
+ id: T.any(Integer, String),
128
+ fields: T.untyped,
129
+ session: Auth::Session
130
+ ).returns(T.nilable(DraftOrder))
131
+ end
132
+ def find(
133
+ id:,
134
+ fields: nil,
135
+ session: ShopifyAPI::Context.active_session
136
+ )
137
+ result = base_find(
138
+ session: session,
139
+ ids: {id: id},
140
+ params: {fields: fields},
141
+ )
142
+ T.cast(result[0], T.nilable(DraftOrder))
143
+ end
144
+
145
+ sig do
146
+ params(
147
+ id: T.any(Integer, String),
148
+ session: Auth::Session
149
+ ).returns(T.untyped)
150
+ end
151
+ def delete(
152
+ id:,
153
+ session: ShopifyAPI::Context.active_session
154
+ )
155
+ request(
156
+ http_method: :delete,
157
+ operation: :delete,
158
+ session: session,
159
+ ids: {id: id},
160
+ params: {},
161
+ )
162
+ end
163
+
164
+ sig do
165
+ params(
166
+ fields: T.untyped,
167
+ limit: T.untyped,
168
+ since_id: T.untyped,
169
+ updated_at_min: T.untyped,
170
+ updated_at_max: T.untyped,
171
+ ids: T.untyped,
172
+ status: T.untyped,
173
+ session: Auth::Session,
174
+ kwargs: T.untyped
175
+ ).returns(T::Array[DraftOrder])
176
+ end
177
+ def all(
178
+ fields: nil,
179
+ limit: nil,
180
+ since_id: nil,
181
+ updated_at_min: nil,
182
+ updated_at_max: nil,
183
+ ids: nil,
184
+ status: nil,
185
+ session: ShopifyAPI::Context.active_session,
186
+ **kwargs
187
+ )
188
+ response = base_find(
189
+ session: session,
190
+ ids: {},
191
+ params: {fields: fields, limit: limit, since_id: since_id, updated_at_min: updated_at_min, updated_at_max: updated_at_max, ids: ids, status: status}.merge(kwargs).compact,
192
+ )
193
+
194
+ T.cast(response, T::Array[DraftOrder])
195
+ end
196
+
197
+ sig do
198
+ params(
199
+ since_id: T.untyped,
200
+ status: T.untyped,
201
+ updated_at_max: T.untyped,
202
+ updated_at_min: T.untyped,
203
+ session: Auth::Session,
204
+ kwargs: T.untyped
205
+ ).returns(T.untyped)
206
+ end
207
+ def count(
208
+ since_id: nil,
209
+ status: nil,
210
+ updated_at_max: nil,
211
+ updated_at_min: nil,
212
+ session: ShopifyAPI::Context.active_session,
213
+ **kwargs
214
+ )
215
+ request(
216
+ http_method: :get,
217
+ operation: :count,
218
+ session: session,
219
+ ids: {},
220
+ params: {since_id: since_id, status: status, updated_at_max: updated_at_max, updated_at_min: updated_at_min}.merge(kwargs).compact,
221
+ body: {},
222
+ entity: nil,
223
+ )
224
+ end
225
+
226
+ end
227
+
228
+ sig do
229
+ params(
230
+ body: T.untyped,
231
+ kwargs: T.untyped
232
+ ).returns(T.untyped)
233
+ end
234
+ def send_invoice(
235
+ body: nil,
236
+ **kwargs
237
+ )
238
+ self.class.request(
239
+ http_method: :post,
240
+ operation: :send_invoice,
241
+ session: @session,
242
+ ids: {id: @id},
243
+ params: {}.merge(kwargs).compact,
244
+ body: body,
245
+ entity: self,
246
+ )
247
+ end
248
+
249
+ sig do
250
+ params(
251
+ payment_gateway_id: T.untyped,
252
+ payment_pending: T.untyped,
253
+ body: T.untyped,
254
+ kwargs: T.untyped
255
+ ).returns(T.untyped)
256
+ end
257
+ def complete(
258
+ payment_gateway_id: nil,
259
+ payment_pending: nil,
260
+ body: nil,
261
+ **kwargs
262
+ )
263
+ self.class.request(
264
+ http_method: :put,
265
+ operation: :complete,
266
+ session: @session,
267
+ ids: {id: @id},
268
+ params: {payment_gateway_id: payment_gateway_id, payment_pending: payment_pending}.merge(kwargs).compact,
269
+ body: body,
270
+ entity: self,
271
+ )
272
+ end
273
+
274
+ end
275
+ end