Class: ShopifyAPI::DraftOrder

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2021_07/draft_order.rb,
lib/shopify_api/rest/resources/2021_10/draft_order.rb,
lib/shopify_api/rest/resources/2022_01/draft_order.rb,
lib/shopify_api/rest/resources/2022_04/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, #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
# File 'lib/shopify_api/rest/resources/2021_07/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))
  @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(Float))
  @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.



65
66
67
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 65

def applied_discount
  @applied_discount
end

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



67
68
69
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 67

def billing_address
  @billing_address
end

#completed_atObject (readonly)

Returns the value of attribute completed_at.



69
70
71
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 69

def completed_at
  @completed_at
end

#created_atObject (readonly)

Returns the value of attribute created_at.



71
72
73
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 71

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



73
74
75
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 73

def currency
  @currency
end

#customerObject (readonly)

Returns the value of attribute customer.



75
76
77
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 75

def customer
  @customer
end

#emailObject (readonly)

Returns the value of attribute email.



77
78
79
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 77

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



79
80
81
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 79

def id
  @id
end

#invoice_sent_atObject (readonly)

Returns the value of attribute invoice_sent_at.



81
82
83
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 81

def invoice_sent_at
  @invoice_sent_at
end

#invoice_urlObject (readonly)

Returns the value of attribute invoice_url.



83
84
85
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 83

def invoice_url
  @invoice_url
end

#line_itemsObject (readonly)

Returns the value of attribute line_items.



85
86
87
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 85

def line_items
  @line_items
end

#nameObject (readonly)

Returns the value of attribute name.



87
88
89
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 87

def name
  @name
end

#noteObject (readonly)

Returns the value of attribute note.



89
90
91
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 89

def note
  @note
end

#note_attributesObject (readonly)

Returns the value of attribute note_attributes.



91
92
93
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 91

def note_attributes
  @note_attributes
end

#order_idObject (readonly)

Returns the value of attribute order_id.



93
94
95
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 93

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/2021_10/draft_order.rb', line 96

def payment_terms
  @payment_terms
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.



95
96
97
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 95

def shipping_address
  @shipping_address
end

#shipping_lineObject (readonly)

Returns the value of attribute shipping_line.



97
98
99
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 97

def shipping_line
  @shipping_line
end

#source_nameObject (readonly)

Returns the value of attribute source_name.



99
100
101
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 99

def source_name
  @source_name
end

#statusObject (readonly)

Returns the value of attribute status.



101
102
103
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 101

def status
  @status
end

#subtotal_priceObject (readonly)

Returns the value of attribute subtotal_price.



103
104
105
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 103

def subtotal_price
  @subtotal_price
end

#tagsObject (readonly)

Returns the value of attribute tags.



105
106
107
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 105

def tags
  @tags
end

#tax_exemptObject (readonly)

Returns the value of attribute tax_exempt.



107
108
109
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 107

def tax_exempt
  @tax_exempt
end

#tax_exemptionsObject (readonly)

Returns the value of attribute tax_exemptions.



109
110
111
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 109

def tax_exemptions
  @tax_exemptions
end

#tax_linesObject (readonly)

Returns the value of attribute tax_lines.



111
112
113
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 111

def tax_lines
  @tax_lines
end

#taxes_includedObject (readonly)

Returns the value of attribute taxes_included.



113
114
115
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 113

def taxes_included
  @taxes_included
end

#total_priceObject (readonly)

Returns the value of attribute total_price.



115
116
117
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 115

def total_price
  @total_price
end

#total_taxObject (readonly)

Returns the value of attribute total_tax.



117
118
119
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 117

def total_tax
  @total_tax
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



119
120
121
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 119

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



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 174

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



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 204

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



148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 148

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



129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 129

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_pending: nil, body: nil, **kwargs) ⇒ Object



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 253

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

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



231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/shopify_api/rest/resources/2021_07/draft_order.rb', line 231

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