Class: ShopifyAPI::FulfillmentOrder
- Inherits:
-
Base
- Object
- ActiveResource::Base
- Base
- ShopifyAPI::FulfillmentOrder
show all
- Defined in:
- lib/shopify_api/resources/fulfillment_order.rb
Constant Summary
collapse
- MINIMUM_VERSION =
'2020-01'
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
activate_session, api_version, api_version=, #as_json, clear_session, early_july_pagination?, #encode, headers, init_prefix, init_prefix_explicit, #persisted?, prefix, prefix=, prefix_source, resource_prefix, resource_prefix=, version_validation!
Methods included from Countable
#count
Constructor Details
#initialize(attributes = {}, persisted = false) ⇒ FulfillmentOrder
Returns a new instance of FulfillmentOrder.
Class Method Details
.find(scope, *args) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 11
def self.find(scope, *args)
ShopifyAPI::Base.version_validation!(MINIMUM_VERSION)
if scope == :all
order_id = args.first&.dig(:params, :order_id)
raise ShopifyAPI::ValidationException, "'order_id' is required" if order_id.blank?
order = ::ShopifyAPI::Order.new(id: order_id)
order.fulfillment_orders(args.first[:params].except(:order_id))
else
super(scope, *args)
end
end
|
Instance Method Details
#accept_cancellation_request(message: nil) ⇒ Object
116
117
118
119
120
121
122
123
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 116
def accept_cancellation_request(message: nil)
body = {
cancellation_request: {
message: message,
},
}
load_attributes_from_response(post('cancellation_request/accept', {}, body.to_json))
end
|
#accept_fulfillment_request(message: nil) ⇒ Object
89
90
91
92
93
94
95
96
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 89
def accept_fulfillment_request(message: nil)
body = {
fulfillment_request: {
message: message,
},
}
load_attributes_from_response(post('fulfillment_request/accept', {}, body.to_json))
end
|
#cancel ⇒ Object
49
50
51
52
53
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 49
def cancel
keyed_fulfillment_orders = keyed_fulfillment_orders_from_response(post(:cancel, {}, only_id))
load_keyed_fulfillment_order(keyed_fulfillment_orders, 'fulfillment_order')
keyed_fulfillment_orders
end
|
#close(message: nil) ⇒ Object
68
69
70
71
72
73
74
75
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 68
def close(message: nil)
body = {
fulfillment_order: {
message: message,
},
}
load_attributes_from_response(post(:close, {}, body.to_json))
end
|
#fulfillments(options = {}) ⇒ Object
25
26
27
28
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 25
def fulfillments(options = {})
fulfillment_hashes = get(:fulfillments, options)
fulfillment_hashes.map { |fulfillment_hash| Fulfillment.new(fulfillment_hash) }
end
|
#locations_for_move ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 30
def locations_for_move
locations_for_move_hashes = get(:locations_for_move, {})
locations_for_move_hashes.map do |locations_for_move_hash|
FulfillmentOrderLocationsForMove.new(locations_for_move_hash)
end
end
|
#move(new_location_id:) ⇒ Object
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 38
def move(new_location_id:)
body = {
fulfillment_order: {
new_location_id: new_location_id,
},
}
keyed_fulfillment_orders = keyed_fulfillment_orders_from_response(post(:move, {}, body.to_json))
load_keyed_fulfillment_order(keyed_fulfillment_orders, 'original_fulfillment_order')
keyed_fulfillment_orders
end
|
#open ⇒ Object
55
56
57
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 55
def open
load_attributes_from_response(post(:open, {}, only_id))
end
|
#reject_cancellation_request(message: nil) ⇒ Object
125
126
127
128
129
130
131
132
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 125
def reject_cancellation_request(message: nil)
body = {
cancellation_request: {
message: message,
},
}
load_attributes_from_response(post('cancellation_request/reject', {}, body.to_json))
end
|
#reject_fulfillment_request(message: nil) ⇒ Object
98
99
100
101
102
103
104
105
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 98
def reject_fulfillment_request(message: nil)
body = {
fulfillment_request: {
message: message,
},
}
load_attributes_from_response(post('fulfillment_request/reject', {}, body.to_json))
end
|
#request_cancellation(message: nil) ⇒ Object
107
108
109
110
111
112
113
114
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 107
def request_cancellation(message: nil)
body = {
cancellation_request: {
message: message,
},
}
load_attributes_from_response(post(:cancellation_request, {}, body.to_json))
end
|
#request_fulfillment(fulfillment_order_line_items: nil, message: nil) ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 77
def request_fulfillment(fulfillment_order_line_items: nil, message: nil)
body = {
fulfillment_request: {
fulfillment_order_line_items: fulfillment_order_line_items,
message: message,
},
}
keyed_fulfillment_orders = keyed_fulfillment_orders_from_response(post(:fulfillment_request, {}, body.to_json))
load_keyed_fulfillment_order(keyed_fulfillment_orders, 'original_fulfillment_order')
keyed_fulfillment_orders
end
|
#reschedule(new_fulfill_at:) ⇒ Object
59
60
61
62
63
64
65
66
|
# File 'lib/shopify_api/resources/fulfillment_order.rb', line 59
def reschedule(new_fulfill_at:)
body = {
fulfillment_order: {
new_fulfill_at: new_fulfill_at,
},
}
load_attributes_from_response(post(:reschedule, {}, body.to_json))
end
|