Module: Peddler::Reports::VendorInventory

Defined in:
lib/peddler/reports/vendor_inventory.rb,
lib/peddler/reports/vendor_inventory/report.rb,
lib/peddler/reports/vendor_inventory/report_options.rb,
lib/peddler/reports/vendor_inventory/inventory_by_asin.rb,
lib/peddler/reports/vendor_inventory/inventory_aggregate.rb,
lib/peddler/reports/vendor_inventory/report_specification.rb

Overview

This report shares inventory data of a vendor's items both at an aggregated level (across the vendor's entire catalog of items) and at a per-ASIN level. Data is available at different date range aggregation levels: DAY, WEEK, MONTH, QUARTER, YEAR. Requests can span multiple date range periods. For example, if the customer specified reportPeriod=WEEK and a dataStartTime and dataEndTime that are 3 weeks apart, the report would contain data for each of those 3 contiguous weeks.

Constant Summary collapse

Report =

This report shares inventory data of a vendor's items both at an aggregated level (across the vendor's entire catalog of items) and at a per-ASIN level. Data is available at different date range aggregation levels: DAY, WEEK, MONTH, QUARTER, YEAR. Requests can span multiple date range periods. For example, if the customer specified reportPeriod=WEEK and a dataStartTime and dataEndTime that are 3 weeks apart, the report would contain data for each of those 3 contiguous weeks.

Structure.new do
  # @return [Array<InventoryAggregate>]
  attribute(:inventory_aggregate, [InventoryAggregate], from: "inventoryAggregate")

  # @return [Array<InventoryByAsin>]
  attribute(:inventory_by_asin, [InventoryByASIN], from: "inventoryByAsin")

  # @return [Hash] The report summary including a reporting date range, distributor view, selling program, and
  # last updated date in the input.
  attribute(:report_specification, ReportSpecification, from: "reportSpecification")
end
ReportOptions =

Report options specifying parameters such as reportPeriod, distributorView, and sellingProgram.

Structure.new do
  # @return [String] The distributor view.
  attribute(:distributor_view, String, from: "distributorView")

  # @return [String] Determines what granularity of data is expected in the report. Valid values are: DAY, WEEK,
  # MONTH, QUARTER, YEAR.
  attribute(:report_period, String, from: "reportPeriod")

  # @return [String] The selling program.
  attribute(:selling_program, String, from: "sellingProgram")
end
InventoryByASIN =

Describes ASIN-aggregated inventory metrics for the vendor's account.

Structure.new do
  # @return [String] The Amazon Standard Identification Number.
  attribute(:asin, String)

  # @return [Date] The end date of the aggregated data.
  attribute(:end_date, Date, from: "endDate")

  # @return [Money] Cost of the inventory that Amazon received from the vendor, minus the cost of the inventory
  # that was returned to the vendor. The cost returned to the vendor takes into account any products that were
  # returned due to damaged merchandise. This number can be negative if more cost was returned than received.
  attribute(:net_received_inventory_cost, Money, from: "netReceivedInventoryCost")

  # @return [Integer] Units received from the vendor minus any units that were returned to the vendor. This number
  # can be negative if more units were returned than received.
  attribute(:net_received_inventory_units, Integer, from: "netReceivedInventoryUnits")

  # @return [Integer] Number of units contained in Amazon’s confirmed purchase orders that are not yet received by
  # Amazon. This number can be negative if the vendor has shipped more units than Amazon has requested.
  attribute(:open_purchase_order_units, Integer, from: "openPurchaseOrderUnits")

  # @return [Money] The cost of the inventory in Amazon fulfillment centers that is in sellable condition on the
  # last day of the selected time window. Backorders count as negative cost, and can cause this value to be
  # negative overall.
  attribute(:sellable_on_hand_inventory_cost, Money, from: "sellableOnHandInventoryCost")

  # @return [Integer] The number of units in Amazon fulfillment centers that is in sellable condition on the last
  # day of the selected time window. Backorders count as negative units, and can cause this value to be negative
  # overall.
  attribute(:sellable_on_hand_inventory_units, Integer, from: "sellableOnHandInventoryUnits")

  # @return [Date] The start date of the aggregated data.
  attribute(:start_date, Date, from: "startDate")

  # @return [Money] The cost of the inventory in Amazon fulfillment centers that is at least 90 days old, and is
  # in a sellable condition on the last day of the selected time window. Backorders count as a negative cost, and
  # can cause this value to be negative overall. Inventory age is computed based on when the inventory was
  # received by Amazon.
  attribute?(:aged90_plus_days_sellable_inventory_cost, Money, from: "aged90PlusDaysSellableInventoryCost")

  # @return [Integer] The number of units in Amazon fulfillment centers that is at least 90 days old, and is in a
  # sellable condition on the last day of the selected time window. Backorders count as negative units, and can
  # cause this value to be negative overall. Inventory age is computed based on when the inventory was received by
  # Amazon.
  attribute?(:aged90_plus_days_sellable_inventory_units, Integer, from: "aged90PlusDaysSellableInventoryUnits")

  # @return [Float] Average number of days between the submission of each purchase order unit and the time of
  # receipt in Amazon's fulfillment centers.
  attribute?(:average_vendor_lead_time_days, Float, from: "averageVendorLeadTimeDays")

  # @return [Float] The number of units shipped (less customer returns), divided by the sum of the number of units
  # held by Amazon at the beginning of this time window and the number of units received during this time window.
  # This number could be negative if more units were returned than were shipped. This number can be greater than 1
  # if some inventory was sold while in transit between fulfillment centers.
  attribute?(:sell_through_rate, Float, from: "sellThroughRate")

  # @return [Integer] Number of units that have been ordered (or pre-ordered) but have not yet shipped.
  attribute?(:unfilled_customer_ordered_units, Integer, from: "unfilledCustomerOrderedUnits")

  # @return [Money] The cost of the excess inventory on the last day of the selected time window based on
  # forecasted demand. Note that the forecasted demand may have already included some amount of excess inventory
  # that makes economic sense to hold. This is the amount of inventory beyond the forecasted demand.
  attribute?(:unhealthy_inventory_cost, Money, from: "unhealthyInventoryCost")

  # @return [Integer] The number of excess inventory units on the last day of the selected time window based on
  # forecasted demand. Note that the forecasted demand may have already included some amount of excess inventory
  # that makes economic sense to hold. This is the amount of inventory beyond the forecasted demand.
  attribute?(:unhealthy_inventory_units, Integer, from: "unhealthyInventoryUnits")

  # @return [Money] The cost of the inventory in Amazon fulfillment centers that is in unsellable condition on the
  # last day of the selected time window.
  attribute?(:unsellable_on_hand_inventory_cost, Money, from: "unsellableOnHandInventoryCost")

  # @return [Integer] The number of units in Amazon fulfillment centers that are in unsellable condition on the
  # last day of the selected time window.
  attribute?(:unsellable_on_hand_inventory_units, Integer, from: "unsellableOnHandInventoryUnits")

  # @return [Float] The number of units that were confirmed by the vendor, divided by the number of units Amazon
  # asked for. This rate will be 1 if all units that were requested during this time window were confirmed. This
  # rate can be larger than 1 if the vendor has confirmed a greater quantity of units than Amazon requested.
  attribute?(:vendor_confirmation_rate, Float, from: "vendorConfirmationRate")
end
InventoryAggregate =

Describes the aggregated inventory metrics for all ASINs in the vendor's account.

Structure.new do
  # @return [Date] The end date of the aggregated data.
  attribute(:end_date, Date, from: "endDate")

  # @return [Money] Cost of the inventory that Amazon received from the vendor, minus the cost of the inventory
  # that was returned to the vendor. The cost returned to the vendor takes into account any products that were
  # returned due to damaged merchandise. This number can be negative if more cost was returned than received.
  attribute(:net_received_inventory_cost, Money, from: "netReceivedInventoryCost")

  # @return [Integer] Units received from the vendor minus any units that were returned to the vendor. This number
  # can be negative if more units were returned than received.
  attribute(:net_received_inventory_units, Integer, from: "netReceivedInventoryUnits")

  # @return [Integer] Number of units contained in Amazon’s confirmed purchase orders that are not yet received by
  # Amazon. This number can be negative if the vendor has shipped more units than Amazon has requested.
  attribute(:open_purchase_order_units, Integer, from: "openPurchaseOrderUnits")

  # @return [Money] The cost of the inventory in Amazon fulfillment centers that is in a sellable condition on the
  # last day of the selected time window. Backorders count as a negative cost, and can cause this value to be
  # negative overall.
  attribute(:sellable_on_hand_inventory_cost, Money, from: "sellableOnHandInventoryCost")

  # @return [Integer] The number of units in Amazon fulfillment centers that is in a sellable condition on the
  # last day of the selected time window. Backorders count as negative units, and can cause this value to be
  # negative overall.
  attribute(:sellable_on_hand_inventory_units, Integer, from: "sellableOnHandInventoryUnits")

  # @return [Date] The start date of the aggregated data.
  attribute(:start_date, Date, from: "startDate")

  # @return [Money] The cost of the inventory in Amazon fulfillment centers that is at least 90 days old, and is
  # in a sellable condition on the last day of the selected time window. Backorders count as negative cost, and
  # can cause this value to be negative overall. Inventory age is computed based on when the inventory was
  # received by Amazon.
  attribute?(:aged90_plus_days_sellable_inventory_cost, Money, from: "aged90PlusDaysSellableInventoryCost")

  # @return [Integer] The number of units in Amazon fulfillment centers that is at least 90 days old, and is in a
  # sellable condition on the last day of the selected time window. Backorders count as negative units, and can
  # cause this value to be negative overall. Inventory age is computed based on when the inventory was received by
  # Amazon.
  attribute?(:aged90_plus_days_sellable_inventory_units, Integer, from: "aged90PlusDaysSellableInventoryUnits")

  # @return [Float] Average number of days between the submission of each purchase order unit and the time of
  # receipt in Amazon's fulfillment centers.
  attribute?(:average_vendor_lead_time_days, Float, from: "averageVendorLeadTimeDays")

  # @return [Float] The out of stock rate on all products that are procurable. This is calculated by out of stock
  # glance views on a procurable ASIN divided by the total glance views.
  attribute?(:procurable_product_out_of_stock_rate, Float, from: "procurableProductOutOfStockRate")

  # @return [Float] The purchase order units received by Amazon in comparison to the purchase order units
  # confirmed by the vendor. This is calculated as the received quantity divided by the confirmed quantity.
  attribute?(:receive_fill_rate, Float, from: "receiveFillRate")

  # @return [Float] The number of units shipped (less customer returns), divided by the sum of the number of units
  # held by Amazon at the beginning of this time window and the number of units received during this time window.
  # This number could be negative if more units were returned than were shipped. This number can be greater than 1
  # if some inventory was sold while in transit between fulfillment centers.
  attribute?(:sell_through_rate, Float, from: "sellThroughRate")

  # @return [Float] The percentage of time an ASIN is available to be shipped to the customer from a fulfillment
  # center, versus the selection Amazon intended to carry.
  attribute?(:uft, Float)

  # @return [Integer] The number of units that have been ordered (or pre-ordered) but have not yet shipped.
  attribute?(:unfilled_customer_ordered_units, Integer, from: "unfilledCustomerOrderedUnits")

  # @return [Money] The cost of the excess inventory on the last day of the selected time window based on
  # forecasted demand. Note that the forecasted demand may have already included some amount of excess inventory
  # that makes economic sense to hold. This is the amount of inventory beyond the forecasted demand.
  attribute?(:unhealthy_inventory_cost, Money, from: "unhealthyInventoryCost")

  # @return [Integer] The number of excess inventory units on the last day of the selected time window based on
  # forecasted demand. Note that the forecasted demand may have already included some amount of excess inventory
  # that makes economic sense to hold. This is the amount of inventory beyond the forecasted demand.
  attribute?(:unhealthy_inventory_units, Integer, from: "unhealthyInventoryUnits")

  # @return [Money] The cost of the inventory in Amazon fulfillment centers that is in unsellable condition on the
  # last day of the selected time window.
  attribute?(:unsellable_on_hand_inventory_cost, Money, from: "unsellableOnHandInventoryCost")

  # @return [Integer] The number of units in Amazon fulfillment centers that are in unsellable condition on the
  # last day of the selected time window.
  attribute?(:unsellable_on_hand_inventory_units, Integer, from: "unsellableOnHandInventoryUnits")

  # @return [Float] The number of units that were confirmed by the vendor, divided by the number of units Amazon
  # asked for. This rate will be 1 if all units that were requested during this time window were confirmed. This
  # rate can be larger than 1 if the vendor has confirmed a greater quantity of units than Amazon requested.
  attribute?(:vendor_confirmation_rate, Float, from: "vendorConfirmationRate")
end
ReportSpecification =

The report summary including a reporting date range, distributor view, selling program, and last updated date in the input.

Structure.new do
  # @return [Date] Determines the end date of the report - the time component is ignored. For WEEK, MONTH,
  # QUARTER, and YEAR reportPeriods, this value must correspond to the last day in the specified reportPeriod. For
  # example, dataEndTime must be a Saturday for the WEEK reportPeriod.
  attribute(:data_end_time, Date, from: "dataEndTime")

  # @return [Date] Determines the start date of the report - the time component is ignored. For WEEK, MONTH,
  # QUARTER, and YEAR reportPeriods, this value must correspond to the first day in the specified reportPeriod.
  # For example, dataStartTime must be a Sunday for the WEEK reportPeriod.
  attribute(:data_start_time, Date, from: "dataStartTime")

  # @return [Date] The date when the report was last updated. Follows the
  # {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} Date format of YYYY-MM-DD.
  attribute(:last_updated_date, Date, from: "lastUpdatedDate")

  # @return [Array<String>] This parameter must match the marketplaceId of the selling partner account (each
  # selling partner account belongs to only one marketplaceId).
  attribute(:marketplace_ids, [String], from: "marketplaceIds")

  # @return [ReportOptions] Report options specifying parameters such as reportPeriod, distributorView, and
  # sellingProgram.
  attribute(:report_options, ReportOptions, from: "reportOptions")

  # @return [String] The type of report.
  attribute(:report_type, String, from: "reportType")
end

Class Method Summary collapse

Class Method Details

.parse(hash) ⇒ Object



16
17
18
# File 'lib/peddler/reports/vendor_inventory.rb', line 16

def parse(hash)
  Report.parse(hash)
end