Sha256: f464c342c449ef64d8c49de573cadf0f4516fbd16f90d38e7a77a0562dbf8387

Contents?: true

Size: 960 Bytes

Versions: 5

Compression:

Stored size: 960 Bytes

Contents

module ShipCompliant
  # == ShipCompliant::GetInventoryDetails
  #
  # Provides inventory details for each Product on a Fulfillment Location,
  # Fulfillment Account basis.
  #
  #   result = ShipCompliant::GetInventoryDetails.call
  #   product = result.products_for_location('WineShipping').first
  #
  #   product.inventory_levels #=> {
  #     available: 25,
  #     reserved: 13
  #   }
  class GetInventoryDetails

    # Returns inventory details for the specified criteria. The method may be
    # called without any parameters to return all products with Available
    # inventory.
    #
    #   ShipCompliant::GetInventoryDetails.call({
    #     brand_key: 'BRAND-KEY',
    #     fulfillment_location: 'WineShipping'
    #   })
    def self.call(query = {})
      query.deep_transform_keys! { |k| k.to_s.camelize }
      result = ShipCompliant.client.call(:get_inventory_details, query)
      GetInventoryDetailsResult.new(result)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ship_compliant-0.2.1 lib/ship_compliant/get_inventory_details.rb
ship_compliant-0.2.0 lib/ship_compliant/get_inventory_details.rb
ship_compliant-0.1.2 lib/ship_compliant/get_inventory_details.rb
ship_compliant-0.1.1 lib/ship_compliant/get_inventory_details.rb
ship_compliant-0.1.0 lib/ship_compliant/get_inventory_details.rb