Skip to content

Commit daca0cf

Browse files
committed
Removed options for location_for_move
1 parent 7a81d00 commit daca0cf

4 files changed

+48
-0
lines changed

lib/shopify_api/resources/fulfillment_order.rb

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ def fulfillments(options = {})
1717
fulfillment_hashes.map { |fulfillment_hash| Fulfillment.new(fulfillment_hash) }
1818
end
1919

20+
def locations_for_move
21+
locations_for_move_hashes = get(:locations_for_move, {})
22+
23+
locations_for_move_hashes.map do |locations_for_move_hash|
24+
FulfillmentOrderLocationsForMove.new(locations_for_move_hash)
25+
end
26+
end
27+
2028
def move(new_location_id:)
2129
body = {
2230
fulfillment_order: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ShopifyAPI
2+
class FulfillmentOrderLocationsForMove < Base
3+
end
4+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"location": {
4+
"id": 1059367776,
5+
"name": "Alpha Location"
6+
},
7+
"message": "Current location.",
8+
"movable": false
9+
},
10+
{
11+
"location": {
12+
"id": 1059367777,
13+
"name": "Bravo Location"
14+
},
15+
"message": "No items are stocked at this location.",
16+
"movable": false
17+
}
18+
]

test/fulfillment_order_test.rb

+18
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,24 @@ def setup
5757
end
5858
end
5959

60+
context "#locations_for_move" do
61+
should "be able to list locations for a fulfillment order" do
62+
fulfillment_order = ShopifyAPI::FulfillmentOrder.find(519788021)
63+
fake "fulfillment_orders/#{fulfillment_order.id}/locations_for_move", method: :get,
64+
body: load_fixture('fulfillment_order_locations_for_move')
65+
66+
locations_for_move = fulfillment_order.locations_for_move
67+
68+
assert_equal 2, locations_for_move.count
69+
location_for_move = locations_for_move.first
70+
assert location_for_move.is_a?(ShopifyAPI::FulfillmentOrderLocationsForMove)
71+
72+
location = location_for_move.location
73+
assert location.is_a?(ShopifyAPI::Location)
74+
assert_equal 1059367776,location.id
75+
end
76+
end
77+
6078
context "#move" do
6179
should "move a fulfillment order to a new_location_id" do
6280
fulfillment_order = ShopifyAPI::FulfillmentOrder.find(519788021)

0 commit comments

Comments
 (0)