Class: ShopifyAPI::Fulfillment

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_07/fulfillment.rb,
lib/shopify_api/rest/resources/2022_10/fulfillment.rb,
lib/shopify_api/rest/resources/2023_01/fulfillment.rb,
lib/shopify_api/rest/resources/2023_04/fulfillment.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_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) ⇒ Fulfillment

Returns a new instance of Fulfillment.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 16

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

  @created_at = T.let(nil, T.nilable(String))
  @id = T.let(nil, T.nilable(Integer))
  @line_items = T.let(nil, T.nilable(T::Array[T.untyped]))
  @location_id = T.let(nil, T.nilable(Integer))
  @name = T.let(nil, T.nilable(String))
  @notify_customer = T.let(nil, T.nilable(T::Boolean))
  @order_id = T.let(nil, T.nilable(Integer))
  @origin_address = T.let(nil, T.nilable(T::Array[T.untyped]))
  @receipt = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @service = T.let(nil, T.nilable(String))
  @shipment_status = T.let(nil, T.nilable(String))
  @status = T.let(nil, T.nilable(String))
  @tracking_company = T.let(nil, T.nilable(String))
  @tracking_numbers = T.let(nil, T.nilable(T::Array[T.untyped]))
  @tracking_urls = T.let(nil, T.nilable(T::Array[T.untyped]))
  @updated_at = T.let(nil, T.nilable(String))
  @variant_inventory_management = 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

#created_atObject (readonly)

Returns the value of attribute created_at.



51
52
53
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 51

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



53
54
55
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 53

def id
  @id
end

#line_itemsObject (readonly)

Returns the value of attribute line_items.



55
56
57
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 55

def line_items
  @line_items
end

#location_idObject (readonly)

Returns the value of attribute location_id.



57
58
59
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 57

def location_id
  @location_id
end

#nameObject (readonly)

Returns the value of attribute name.



59
60
61
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 59

def name
  @name
end

#notify_customerObject (readonly)

Returns the value of attribute notify_customer.



61
62
63
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 61

def notify_customer
  @notify_customer
end

#order_idObject (readonly)

Returns the value of attribute order_id.



63
64
65
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 63

def order_id
  @order_id
end

#origin_addressObject (readonly)

Returns the value of attribute origin_address.



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

def origin_address
  @origin_address
end

#receiptObject (readonly)

Returns the value of attribute receipt.



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

def receipt
  @receipt
end

#serviceObject (readonly)

Returns the value of attribute service.



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

def service
  @service
end

#shipment_statusObject (readonly)

Returns the value of attribute shipment_status.



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

def shipment_status
  @shipment_status
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#tracking_companyObject (readonly)

Returns the value of attribute tracking_company.



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

def tracking_company
  @tracking_company
end

#tracking_numbersObject (readonly)

Returns the value of attribute tracking_numbers.



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

def tracking_numbers
  @tracking_numbers
end

#tracking_urlsObject (readonly)

Returns the value of attribute tracking_urls.



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

def tracking_urls
  @tracking_urls
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#variant_inventory_managementObject (readonly)

Returns the value of attribute variant_inventory_management.



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

def variant_inventory_management
  @variant_inventory_management
end

Class Method Details

.all(fulfillment_order_id: nil, order_id: nil, created_at_max: nil, created_at_min: nil, fields: nil, limit: nil, since_id: nil, updated_at_max: nil, updated_at_min: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 123

def all(
  fulfillment_order_id: nil,
  order_id: nil,
  created_at_max: nil,
  created_at_min: nil,
  fields: nil,
  limit: nil,
  since_id: nil,
  updated_at_max: nil,
  updated_at_min: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  response = base_find(
    session: session,
    ids: {fulfillment_order_id: fulfillment_order_id, order_id: order_id},
    params: {created_at_max: created_at_max, created_at_min: created_at_min, fields: fields, limit: limit, since_id: since_id, updated_at_max: updated_at_max, updated_at_min: updated_at_min}.merge(kwargs).compact,
  )

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

.count(order_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 156

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

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



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 94

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

Instance Method Details

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



184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/shopify_api/rest/resources/2022_07/fulfillment.rb', line 184

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

#update_tracking(notify_customer: nil, tracking_info: nil, body: nil, **kwargs) ⇒ Object



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

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