Module: Peddler::Reports::VendorSales

Defined in:
lib/peddler/reports/vendor_sales.rb,
lib/peddler/reports/vendor_sales/report.rb,
lib/peddler/reports/vendor_sales/sales_by_asin.rb,
lib/peddler/reports/vendor_sales/report_options.rb,
lib/peddler/reports/vendor_sales/sales_aggregate.rb,
lib/peddler/reports/vendor_sales/report_specification.rb

Overview

This report shares data on the sales performance of 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.

Constant Summary collapse

Report =

This report shares data on the sales performance of 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.

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

  # @return [Array<SalesAggregate>]
  attribute(:sales_aggregate, [SalesAggregate], from: "salesAggregate")

  # @return [Array<SalesByAsin>]
  attribute(:sales_by_asin, [SalesByASIN], from: "salesByAsin")
end
SalesByASIN =

Describes aggregated ASIN-level sales metrics for ASINs in 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 ASIN-level data.
  attribute(:end_date, Date, from: "endDate")

  # @return [Money] Revenue based on the cost of goods sold. Adjustments are made for returns.
  attribute(:shipped_cogs, Money, from: "shippedCogs")

  # @return [Money] Revenue based on units shipped in the selected time frame. Adjustments are made for returns.
  attribute(:shipped_revenue, Money, from: "shippedRevenue")

  # @return [Integer] Number of units shipped to Amazon customers.
  attribute(:shipped_units, Integer, from: "shippedUnits")

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

  # @return [Integer] The quantity of units returned. This field is populated when sellingProgram is RETAIL or
  # BUSINESS.
  attribute?(:customer_returns, Integer, from: "customerReturns")

  # @return [Money] Ordered product sales in the selected time frame. Adjustments are made for returns. This field
  # is populated when distributorView is MANUFACTURING
  attribute?(:ordered_revenue, Money, from: "orderedRevenue")

  # @return [Integer] Number of units ordered by Amazon customers. This field is populated when distributorView is
  # MANUFACTURING
  attribute?(:ordered_units, Integer, from: "orderedUnits")
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
SalesAggregate =

Describes aggregated sales metrics for 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] Revenue based on the cost of goods sold. Adjustments are made for returns.
  attribute(:shipped_cogs, Money, from: "shippedCogs")

  # @return [Money] Revenue based on units shipped in the selected time frame. Adjustments are made for returns.
  attribute(:shipped_revenue, Money, from: "shippedRevenue")

  # @return [Integer] Number of units shipped to Amazon customers.
  attribute(:shipped_units, Integer, from: "shippedUnits")

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

  # @return [Integer] The quantity of units returned. This field is populated when sellingProgram is RETAIL or
  # BUSINESS.
  attribute?(:customer_returns, Integer, from: "customerReturns")

  # @return [Money] Ordered product sales in the selected time frame. Adjustments are made for returns. This field
  # is populated when distributorView is MANUFACTURING.
  attribute?(:ordered_revenue, Money, from: "orderedRevenue")

  # @return [Integer] Number of units ordered by Amazon customers. This field is populated when distributorView is
  # MANUFACTURING.
  attribute?(:ordered_units, Integer, from: "orderedUnits")
end
ReportSpecification =

The report summary including 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 report type.
  attribute(:report_type, String, from: "reportType")
end

Class Method Summary collapse

Class Method Details

.parse(hash) ⇒ Object



14
15
16
# File 'lib/peddler/reports/vendor_sales.rb', line 14

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