Skip to content

Commit

Permalink
Updates from PR review--just use Fulfillment (no V2)
Browse files Browse the repository at this point in the history
  • Loading branch information
karmakaze committed Dec 4, 2019
1 parent 738e870 commit d110aeb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/shopify_api/resources/fulfillment_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def self.all(options = {})
end

def fulfillments(options = {})
fulfillments = get(:fulfillments, options)
fulfillments.map { |fulfillment| FulfillmentV2.new(fulfillment.as_json) }
fulfillment_hashes = get(:fulfillments, options)
fulfillment_hashes.map { |fulfillment_hash| Fulfillment.new(fulfillment_hash) }
end
end
end
4 changes: 0 additions & 4 deletions lib/shopify_api/resources/fulfillment_v2.rb

This file was deleted.

4 changes: 2 additions & 2 deletions lib/shopify_api/resources/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def capture(amount = "", currency: nil)
end

def fulfillment_orders(options = {})
fulfillment_orders = get(:fulfillment_orders, options)
fulfillment_orders.map { |fulfillment_order| FulfillmentOrder.new(fulfillment_order.as_json) }
fulfillment_order_hashes = get(:fulfillment_orders, options)
fulfillment_order_hashes.map { |fulfillment_order_hash| FulfillmentOrder.new(fulfillment_order_hash) }
end

class ClientDetails < Base
Expand Down
4 changes: 2 additions & 2 deletions test/assigned_fulfillment_order_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AssignedFulFillmentOrderTest < Test::Unit::TestCase

assert_equal 2, assigned_fulfillment_orders.count
assigned_fulfillment_orders.each do |fulfillment_order|
assert_equal 'ShopifyAPI::FulfillmentOrder', fulfillment_order.class.name
assert fulfillment_order.is_a?(ShopifyAPI::FulfillmentOrder)
assert_equal 'in_progress', fulfillment_order.status
assert_equal 'cancellation_accepted', fulfillment_order.request_status
end
Expand All @@ -32,7 +32,7 @@ class AssignedFulFillmentOrderTest < Test::Unit::TestCase

assert_equal 2, assigned_fulfillment_orders.count
assigned_fulfillment_orders.each do |fulfillment_order|
assert_equal 'ShopifyAPI::FulfillmentOrder', fulfillment_order.class.name
assert fulfillment_order.is_a?(ShopifyAPI::FulfillmentOrder)
assert_equal assigned_location_id, fulfillment_order.assigned_location_id
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/fulfillment_order_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def setup
context "#find" do
should "be able to find fulfillment order" do
fulfillment_order = ShopifyAPI::FulfillmentOrder.find(519788021)
assert_equal 'ShopifyAPI::FulfillmentOrder', fulfillment_order.class.name
assert fulfillment_order.is_a?(ShopifyAPI::FulfillmentOrder)
assert_equal 519788021, fulfillment_order.id
assert_equal 450789469, fulfillment_order.order_id
end
Expand All @@ -27,7 +27,7 @@ def setup

assert_equal [519788021, 519788022], fulfillment_orders.map(&:id).sort
fulfillment_orders.each do |fulfillment_order|
assert_equal 'ShopifyAPI::FulfillmentOrder', fulfillment_order.class.name
assert fulfillment_order.is_a?(ShopifyAPI::FulfillmentOrder)
assert_equal 450789469, fulfillment_order.order_id
end
end
Expand All @@ -50,7 +50,7 @@ def setup

assert_equal 1, fulfillments.count
fulfillment = fulfillments.first
assert_equal 'ShopifyAPI::FulfillmentV2', fulfillment.class.name
assert fulfillment.is_a?(ShopifyAPI::Fulfillment)
assert_equal 450789469, fulfillment.order_id
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/order_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class OrderTest < Test::Unit::TestCase

assert_equal [519788021, 519788022], fulfillment_orders.map(&:id).sort
fulfillment_orders.each do |fulfillment_order|
assert_equal 'ShopifyAPI::FulfillmentOrder', fulfillment_order.class.name
assert fulfillment_order.is_a?(ShopifyAPI::FulfillmentOrder)
assert_equal 450789469, fulfillment_order.order_id
end
end
Expand Down

0 comments on commit d110aeb

Please sign in to comment.