Skip to content

Commit

Permalink
Define find rather than all for AssignedFulfillmentOrder and Fulf…
Browse files Browse the repository at this point in the history
…illmentOrder
  • Loading branch information
karmakaze committed Jan 8, 2020
1 parent b0350cb commit e3eeb3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/shopify_api/resources/assigned_fulfillment_order.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ShopifyAPI
class AssignedFulfillmentOrder < Base
def self.all(options = {})
assigned_fulfillment_orders = super(options)
def self.find(scope, *args)
assigned_fulfillment_orders = super(scope, *args)
assigned_fulfillment_orders.map { |afo| FulfillmentOrder.new(afo.attributes) }
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/shopify_api/resources/fulfillment_order.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module ShopifyAPI
class FulfillmentOrder < Base
def self.all(options = {})
order_id = options.dig(:params, :order_id)
raise ShopifyAPI::ValidationException, "'order_id' is required" if order_id.nil? || order_id == ''
def self.find(scope, *args)
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
order.fulfillment_orders(args.first[:params].except(:order_id))
end

def fulfillments(options = {})
Expand Down

0 comments on commit e3eeb3b

Please sign in to comment.