Class: ShopifyAPI::DraftOrder

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_04/draft_order.rb,
lib/shopify_api/rest/resources/2022_07/draft_order.rb,
lib/shopify_api/rest/resources/2022_10/draft_order.rb,
lib/shopify_api/rest/resources/2023_01/draft_order.rb,
lib/shopify_api/rest/resources/2023_04/draft_order.rb,
lib/shopify_api/rest/resources/2023_07/draft_order.rb

Instance Attribute Summary collapse

Attributes inherited from Rest::Base

#errors, #original_state

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rest::Base

base_find, class_name, create_instance, create_instances_from_response, #delete, get_path, has_many?, has_one?, json_body_name, json_response_body_names, #method_missing, next_page?, next_page_info, prev_page?, prev_page_info, primary_key, read_only_attributes, request, #respond_to_missing?, #save, #save!, #to_hash

Constructor Details

#initialize(session: ShopifyAPI::Context.active_session) ⇒ DraftOrder

Returns a new instance of DraftOrder.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 16

def initialize(session: ShopifyAPI::Context.active_session)
  super(session: session)

  @applied_discount = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @billing_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @completed_at = T.let(nil, T.nilable(String))
  @created_at = T.let(nil, T.nilable(String))
  @currency = T.let(nil, T.nilable(String))
  @customer = T.let(nil, T.nilable(Customer))
  @email = T.let(nil, T.nilable(String))
  @id = T.let(nil, T.nilable(Integer))
  @invoice_sent_at = T.let(nil, T.nilable(String))
  @invoice_url = T.let(nil, T.nilable(String))
  @line_items = T.let(nil, T.nilable(T::Array[T.untyped]))
  @name = T.let(nil, T.nilable(String))
  @note = T.let(nil, T.nilable(String))
  @note_attributes = T.let(nil, T.nilable(T::Array[T.untyped]))
  @order_id = T.let(nil, T.nilable(Integer))
  @payment_terms = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @shipping_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @shipping_line = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @source_name = T.let(nil, T.nilable(String))
  @status = T.let(nil, T.nilable(String))
  @subtotal_price = T.let(nil, T.nilable(String))
  @tags = T.let(nil, T.nilable(String))
  @tax_exempt = T.let(nil, T.nilable(T::Boolean))
  @tax_exemptions = T.let(nil, T.nilable(T::Array[T.untyped]))
  @tax_lines = T.let(nil, T.nilable(T::Array[T.untyped]))
  @taxes_included = T.let(nil, T.nilable(T::Boolean))
  @total_price = T.let(nil, T.nilable(String))
  @total_tax = T.let(nil, T.nilable(String))
  @updated_at = T.let(nil, T.nilable(String))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShopifyAPI::Rest::Base

Instance Attribute Details

#applied_discountObject (readonly)

Returns the value of attribute applied_discount.



66
67
68
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 66

def applied_discount
  @applied_discount
end

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



68
69
70
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 68

def billing_address
  @billing_address
end

#completed_atObject (readonly)

Returns the value of attribute completed_at.



70
71
72
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 70

def completed_at
  @completed_at
end

#created_atObject (readonly)

Returns the value of attribute created_at.



72
73
74
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 72

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



74
75
76
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 74

def currency
  @currency
end

#customerObject (readonly)

Returns the value of attribute customer.



76
77
78
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 76

def customer
  @customer
end

#emailObject (readonly)

Returns the value of attribute email.



78
79
80
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 78

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



80
81
82
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 80

def id
  @id
end

#invoice_sent_atObject (readonly)

Returns the value of attribute invoice_sent_at.



82
83
84
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 82

def invoice_sent_at
  @invoice_sent_at
end

#invoice_urlObject (readonly)

Returns the value of attribute invoice_url.



84
85
86
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 84

def invoice_url
  @invoice_url
end

#line_itemsObject (readonly)

Returns the value of attribute line_items.



86
87
88
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 86

def line_items
  @line_items
end

#nameObject (readonly)

Returns the value of attribute name.



88
89
90
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 88

def name
  @name
end

#noteObject (readonly)

Returns the value of attribute note.



90
91
92
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 90

def note
  @note
end

#note_attributesObject (readonly)

Returns the value of attribute note_attributes.



92
93
94
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 92

def note_attributes
  @note_attributes
end

#order_idObject (readonly)

Returns the value of attribute order_id.



94
95
96
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 94

def order_id
  @order_id
end

#payment_termsObject (readonly)

Returns the value of attribute payment_terms.



96
97
98
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 96

def payment_terms
  @payment_terms
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.



98
99
100
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 98

def shipping_address
  @shipping_address
end

#shipping_lineObject (readonly)

Returns the value of attribute shipping_line.



100
101
102
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 100

def shipping_line
  @shipping_line
end

#source_nameObject (readonly)

Returns the value of attribute source_name.



102
103
104
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 102

def source_name
  @source_name
end

#statusObject (readonly)

Returns the value of attribute status.



104
105
106
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 104

def status
  @status
end

#subtotal_priceObject (readonly)

Returns the value of attribute subtotal_price.



106
107
108
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 106

def subtotal_price
  @subtotal_price
end

#tagsObject (readonly)

Returns the value of attribute tags.



108
109
110
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 108

def tags
  @tags
end

#tax_exemptObject (readonly)

Returns the value of attribute tax_exempt.



110
111
112
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 110

def tax_exempt
  @tax_exempt
end

#tax_exemptionsObject (readonly)

Returns the value of attribute tax_exemptions.



112
113
114
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 112

def tax_exemptions
  @tax_exemptions
end

#tax_linesObject (readonly)

Returns the value of attribute tax_lines.



114
115
116
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 114

def tax_lines
  @tax_lines
end

#taxes_includedObject (readonly)

Returns the value of attribute taxes_included.



116
117
118
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 116

def taxes_included
  @taxes_included
end

#total_priceObject (readonly)

Returns the value of attribute total_price.



118
119
120
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 118

def total_price
  @total_price
end

#total_taxObject (readonly)

Returns the value of attribute total_tax.



120
121
122
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 120

def total_tax
  @total_tax
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



122
123
124
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 122

def updated_at
  @updated_at
end

Class Method Details

.all(fields: nil, limit: nil, since_id: nil, updated_at_min: nil, updated_at_max: nil, ids: nil, status: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 177

def all(
  fields: nil,
  limit: nil,
  since_id: nil,
  updated_at_min: nil,
  updated_at_max: nil,
  ids: nil,
  status: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  response = base_find(
    session: session,
    ids: {},
    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,
  )

  T.cast(response, T::Array[DraftOrder])
end

.count(since_id: nil, status: nil, updated_at_max: nil, updated_at_min: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 207

def count(
  since_id: nil,
  status: nil,
  updated_at_max: nil,
  updated_at_min: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  request(
    http_method: :get,
    operation: :count,
    session: session,
    ids: {},
    params: {since_id: since_id, status: status, updated_at_max: updated_at_max, updated_at_min: updated_at_min}.merge(kwargs).compact,
    body: {},
    entity: nil,
  )
end

.delete(id:, session: ShopifyAPI::Context.active_session) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 151

def delete(
  id:,
  session: ShopifyAPI::Context.active_session
)
  request(
    http_method: :delete,
    operation: :delete,
    session: session,
    ids: {id: id},
    params: {},
  )
end

.find(id:, fields: nil, session: ShopifyAPI::Context.active_session) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 132

def find(
  id:,
  fields: nil,
  session: ShopifyAPI::Context.active_session
)
  result = base_find(
    session: session,
    ids: {id: id},
    params: {fields: fields},
  )
  T.cast(result[0], T.nilable(DraftOrder))
end

Instance Method Details

#complete(payment_gateway_id: nil, payment_pending: nil, body: nil, **kwargs) ⇒ Object



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 257

def complete(
  payment_gateway_id: nil,
  payment_pending: nil,
  body: nil,
  **kwargs
)
  self.class.request(
    http_method: :put,
    operation: :complete,
    session: @session,
    ids: {id: @id},
    params: {payment_gateway_id: payment_gateway_id, payment_pending: payment_pending}.merge(kwargs).compact,
    body: body,
    entity: self,
  )
end

#send_invoice(body: nil, **kwargs) ⇒ Object



234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/shopify_api/rest/resources/2022_04/draft_order.rb', line 234

def send_invoice(
  body: nil,
  **kwargs
)
  self.class.request(
    http_method: :post,
    operation: :send_invoice,
    session: @session,
    ids: {id: @id},
    params: {}.merge(kwargs).compact,
    body: body,
    entity: self,
  )
end