Module: Peddler::Reports::Promotion

Defined in:
lib/peddler/reports/promotion.rb,
lib/peddler/reports/promotion/report.rb,
lib/peddler/reports/promotion/report_options.rb,
lib/peddler/reports/promotion/details_by_product.rb,
lib/peddler/reports/promotion/details_by_promotion.rb,
lib/peddler/reports/promotion/report_specification.rb

Overview

The Promotion Performance report contains data to help vendors optimize their promotions and adjust their advertising strategies. Currently three promotion types are supported: Best Deal, Lightning Deal, and Price Discount. This report supports start dates up to two years before the current date.

Constant Summary collapse

Report =

The Promotion Performance report contains data to help vendors optimize their promotions and adjust their advertising strategies. Currently three promotion types are supported: Best Deal, Lightning Deal, and Price Discount. This report supports start dates up to two years before the current date.

Structure.new do
  # @return [Array<DetailsByPromotion>] The list of included promotions.
  attribute(:promotions, [DetailsByPromotion])

  # @return [Hash] Summarizes the original report request.
  attribute(:report_specification, ReportSpecification, from: "reportSpecification")
end
ReportOptions =

Report options specifying the parameters promotionStartDateFrom and promotionStartDateTo.

Structure.new do
  # @return [Time] The start of a date and time range in ISO 8601 format used for selecting promotions to report
  # on. All promotions with a start date-time that falls within the range will be included.
  attribute(:promotion_start_date_from, Time, from: "promotionStartDateFrom")

  # @return [Time] The end of a date and time range in ISO 8601 format used for selecting promotions to report on.
  # All promotions with a start date-time that falls within the range will be included.
  attribute(:promotion_start_date_to, Time, from: "promotionStartDateTo")
end
DetailsByProduct =

An object that contains details about a product.

Structure.new do
  # @return [String] The product ASIN.
  attribute(:asin, String)

  # @return [String] The product name.
  attribute(:product_name, String, from: "productName")

  # @return [Float] The total revenue generated at the ASIN level. For sellers, this is equivalent to "sales" in
  # the Seller Central UI.
  attribute(:product_revenue, Float, from: "productRevenue")

  # @return [String] ISO 4217 currency code of productRevenue.
  attribute(:product_revenue_currency_code, String, from: "productRevenueCurrencyCode")

  # @return [Integer] The number of units sold at the promotional price.
  attribute(:product_units_sold, Integer, from: "productUnitsSold")

  # @return [Float] Total funding provided by the vendor at the ASIN level. For vendors only.
  attribute?(:product_amount_spent, Float, from: "productAmountSpent")

  # @return [String] ISO 4217 currency code of productAmountSpent.
  attribute?(:product_amount_spent_currency_code, String, from: "productAmountSpentCurrencyCode")

  # @return [Integer] The number of customer views of the product detail page.
  attribute?(:product_glance_views, Integer, from: "productGlanceViews")
end
DetailsByPromotion =

An object that contains details about a promotion and every included product.

Structure.new do
  # @return [Time] The promotion creation date-time in ISO 8601 format in UTC.
  attribute(:created_date_time, Time, from: "createdDateTime")

  # @return [String] The mode of creation for the promotion.
  attribute(:creation_channel, String, from: "creationChannel")

  # @return [Time] Promotion end date-time in ISO 8601 format in UTC.
  attribute(:end_date_time, Time, from: "endDateTime")

  # @return [Array<DetailsByProduct>] List of included products and their details.
  attribute(:included_products, [DetailsByProduct], from: "includedProducts")

  # @return [Time] The promotion last updated date-time in ISO 8601 format in UTC.
  attribute(:last_updated_date_time, Time, from: "lastUpdatedDateTime")

  # @return [String] The marketplace the promotion is running in.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [String] The unique identifier of the promotion.
  attribute(:promotion_id, String, from: "promotionId")

  # @return [String] The customer facing name of the promotion.
  attribute(:promotion_name, String, from: "promotionName")

  # @return [Float] The total revenue generated across all ASINs in the promotion. For sellers, this is equivalent
  # to "sales" in the Seller Central UI.
  attribute(:revenue, Float)

  # @return [String] The ISO 4217 currency code of revenue.
  attribute(:revenue_currency_code, String, from: "revenueCurrencyCode")

  # @return [Time] Promotion start date-time in ISO 8601 format in UTC.
  attribute(:start_date_time, Time, from: "startDateTime")

  # @return [String] The state that the promotion is in.
  attribute(:status, String)

  # @return [String] The type of the promotion.
  attribute(:type, String)

  # @return [Integer] The number of units sold across all ASINs in the promotion.
  attribute(:units_sold, Integer, from: "unitsSold")

  # @return [Float] Total funding provided across all ASINs in the promotion. For vendors only.
  attribute?(:amount_spent, Float, from: "amountSpent")

  # @return [String] The ISO 4217 currency code of amountSpent.
  attribute?(:amount_spent_currency_code, String, from: "amountSpentCurrencyCode")

  # @return [String] The ID for the funding agreement. For vendors only.
  attribute?(:funding_agreement_id, String, from: "fundingAgreementId")

  # @return [Integer] The total customer views for all product detail pages.
  attribute?(:glance_views, Integer, from: "glanceViews")

  # @return [String] The merchant customer ID associated with the promotion funding agreement. For sellers only.
  attribute?(:merchant_id, String, from: "merchantId")

  # @return [String] The vendor code associated with the promotion funding agreement. For vendors only.
  attribute?(:vendor_code, String, from: "vendorCode")
end
ReportSpecification =

Summarizes the original report request.

Structure.new do
  # @return [Array<String>] The marketplace IDs specified in the report request.
  attribute(:marketplace_ids, [String], from: "marketplaceIds")

  # @return [ReportOptions] Report options specifying the parameters promotionStartDateFrom and
  # promotionStartDateTo.
  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/promotion.rb', line 14

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