Module: Peddler::Reports::SellerCoupon

Defined in:
lib/peddler/reports/seller_coupon.rb,
lib/peddler/reports/seller_coupon/report.rb,
lib/peddler/reports/seller_coupon/asin_details.rb,
lib/peddler/reports/seller_coupon/coupon_details.rb,
lib/peddler/reports/seller_coupon/report_options.rb,
lib/peddler/reports/seller_coupon/report_specification.rb

Overview

This report contains data to help sellers optimize their coupons and adjust their advertising strategies. This report supports start dates up to two years before the current date.

Constant Summary collapse

Report =

This report contains data to help sellers optimize their coupons and adjust their advertising strategies. This report supports start dates up to two years before the current date.

Structure.new do
  # @return [Array<CouponDetails>] A list of included coupons.
  attribute(:coupons, [CouponDetails])

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

Contains details about an asin.

Structure.new do
  # @return [String] The asin of the product.
  attribute(:asin, String)
end
CouponDetails =

Contains details about a coupon.

Structure.new do
  # @return [Array<AsinDetails>] Products associated with the coupon.
  attribute(:asins, [ASINDetails])

  # @return [Float] Percentage of the allocated budget that has been spent, equal to the budgetSpent divided by
  # budget.
  attribute(:budget_percentage_used, Float, from: "budgetPercentageUsed")

  # @return [Float] Total amount spent by the seller on the coupon, including clip fees and redemption fees.
  # Currency value. Represents a gross value, including purchases that were returned or cancelled.
  attribute(:budget_spent, Float, from: "budgetSpent")

  # @return [Integer] Number of times the coupon has been applied on the product page by unique customers.
  attribute(:clips, Integer)

  # @return [String] Unique identifier of the coupon.
  attribute(:coupon_id, String, from: "couponId")

  # @return [String] The ISO 4217 currency code of all currency values in the coupon.
  attribute(:currency_code, String, from: "currencyCode")

  # @return [String] Customer segment that the coupon is available to.
  attribute(:customer_segment, String, from: "customerSegment")

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

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

  # @return [String] Merchant customer ID associated with the coupon.
  attribute(:merchant_id, String, from: "merchantId")

  # @return [Integer] Number of times the coupon has been used for a purchase. Represents a gross value, including
  # purchases that were returned or cancelled.
  attribute(:redemptions, Integer)

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

  # @return [Float] Total amount saved by customers redeeming the coupon. Currency value. Represents a gross
  # value, including purchases that were returned or cancelled.
  attribute(:total_discount, Float, from: "totalDiscount")

  # @return [Float] The budget allocated to the coupon to cover discount offering and clip/redemption fees.
  # Currency value.
  attribute?(:budget, Float)

  # @return [Float] The budget remaining for the coupon, equal to budget minus budgetSpent. Currency value.
  # Represents a gross value, including purchases that were returned or cancelled.
  attribute?(:budget_remaining, Float, from: "budgetRemaining")

  # @return [Float] Discount amount the customer receives. Reflects a percentage when discountType is
  # PERCENT_OFF_LIST_PRICE and a currency value when discountType is AMOUNT_OFF_LIST_PRICE.
  attribute?(:discount_amount, Float, from: "discountAmount")

  # @return [String] Whether the discount is given as a fixed amount or a percentage off the list price.
  attribute?(:discount_type, String, from: "discountType")

  # @return [String] The name given to the coupon.
  attribute?(:name, String)

  # @return [Float] Total revenue generated by redemptions of the coupon after the discount. Currency value.
  # Represents a gross value, including purchases that were returned or cancelled.
  attribute?(:sales, Float)

  # @return [String] The message displayed with the coupon on the product page.
  attribute?(:website_message, String, from: "websiteMessage")
end
ReportOptions =

Report options specifying parameters couponStartDateFrom and couponStartDateTo.

Structure.new do
  # @return [Time] The start of a date-time range in UTC used for selecting coupons to report on. All coupons with
  # a start date-time that falls within the range will be included.
  attribute(:coupon_start_date_from, Time, from: "couponStartDateFrom")

  # @return [Time] The end of a date-time range in UTC used for selecting coupons to report on. All coupons with a
  # start date-time that falls within the range will be included.
  attribute(:coupon_start_date_to, Time, from: "couponStartDateTo")
end
ReportSpecification =

Summarizes the original report request.

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

  # @return [ReportOptions] Report options specifying parameters couponStartDateFrom and couponStartDateTo.
  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



13
14
15
# File 'lib/peddler/reports/seller_coupon.rb', line 13

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