module Fulfillment::Resources::Inventories
Constants
- FIND_ALL_RESPONSE_MODELS
- FIND_RESPONSE_MODELS
Public Instance Methods
find(fulfillment_method:, wrap: true, **params)
click to toggle source
We don't use a resource ID here but rather the fulfillment method as the ID because different fulfillment methods use different ways of finding resources other than just a plain ID. Any applicable resource ID should be passed to the params.
# File lib/fulfillment/resources/inventories.rb, line 27 def find(fulfillment_method:, wrap: true, **params) response = Request.new("inventories/#{fulfillment_method}", query: params).get return if response.body.nil? || response.body.empty? if wrap Models::Collection.new(FIND_RESPONSE_MODELS[fulfillment_method], response.body) else response.body end end
find_all(fulfillment_method:, wrap: true, **params)
click to toggle source
# File lib/fulfillment/resources/inventories.rb, line 15 def find_all(fulfillment_method:, wrap: true, **params) response = Request.new("inventories", id: fulfillment_method, query: params).get if wrap Models::Collection.new(FIND_ALL_RESPONSE_MODELS[fulfillment_method], response.body) else response.body end end
update(fulfillment_method:, **params)
click to toggle source
# File lib/fulfillment/resources/inventories.rb, line 37 def update(fulfillment_method:, **params) response = Request.new("inventories/#{fulfillment_method}", query: params).put response.success? end