Module: Peddler::Notifications::PricingHealth

Defined in:
lib/peddler/notifications/pricing_health.rb,
lib/peddler/notifications/pricing_health/points.rb,
lib/peddler/notifications/pricing_health/payload.rb,
lib/peddler/notifications/pricing_health/summary.rb,
lib/peddler/notifications/pricing_health/sales_rank.rb,
lib/peddler/notifications/pricing_health/offer_count.rb,
lib/peddler/notifications/pricing_health/notification.rb,
lib/peddler/notifications/pricing_health/buy_box_price.rb,
lib/peddler/notifications/pricing_health/merchant_offer.rb,
lib/peddler/notifications/pricing_health/reference_price.rb,
lib/peddler/notifications/pricing_health/offer_change_trigger.rb,
lib/peddler/notifications/pricing_health/notification_metadata.rb

Constant Summary collapse

Points =

The number of Amazon Points offered with the purchase of an item

Structure.new do
  # @return [Integer] The number of Amazon Points offered with the purchase of an item
  attribute(:points_number, Integer, from: "pointsNumber")
end
Payload =

Notification payload data

Structure.new do
  # @return [String] The issue type for the notification
  attribute(:issue_type, String, from: "issueType")

  # @return [String]
  attribute(:merchant_offer, String, from: "merchantOffer")

  # @return [String]
  attribute(:offer_change_trigger, String, from: "offerChangeTrigger")

  # @return [String] The seller identifier for the offer
  attribute(:seller_id, String, from: "sellerId")

  # @return [String]
  attribute(:summary, String)
end
Summary =
Structure.new do
  # @return [Array<OfferCount>] A list that contains the total number of offers that are eligible for the Buy Box
  # for the given conditions and fulfillment channels
  attribute(:buy_box_eligible_offers, [OfferCount], from: "buyBoxEligibleOffers")

  # @return [Array<OfferCount>] A list that contains the total number of offers for the item for the given
  # conditions and fulfillment channels
  attribute(:number_of_offers, [OfferCount], from: "numberOfOffers")

  # @return [String]
  attribute(:reference_price, String, from: "referencePrice")

  # @return [Array<BuyBoxPrice>] A list that contains the Buy Box price of the item for the given conditions
  attribute?(:buy_box_prices, [BuyBoxPrice], from: "buyBoxPrices")

  # @return [Array<SalesRank>] A list that contains the sales rankings of the asin in various product categories
  attribute?(:sales_rankings, [SalesRank], from: "salesRankings")
end
SalesRank =
Structure.new do
  # @return [String] The product category for the rank
  attribute(:product_category_id, String, from: "productCategoryId")

  # @return [Integer] The sales rank of the ASIN
  attribute(:rank, Integer)
end
OfferCount =
Structure.new do
  # @return [String]
  attribute(:condition, String)

  # @return [String]
  attribute(:fulfillment_type, String, from: "fulfillmentType")

  # @return [Integer] The total number of offers for the specified condition and fulfillment channel
  attribute(:offer_count, Integer, from: "offerCount")
end
Notification =

Notification envelope with metadata

Structure.new do
  # @return [String] The date and time (in UTC) that the event which triggered the notification occurred
  attribute(:event_time, String, from: "eventTime")

  # @return [String]
  attribute(:notification_metadata, String, from: "notificationMetadata")

  # @return [String] The notification type. Combined with payload version controls the structure of payload object
  attribute(:notification_type, String, from: "notificationType")

  # @return [String] The notification version. This controls the structure of the notification
  attribute(:notification_version, String, from: "notificationVersion")

  # @return [Payload]
  attribute(:payload, Payload)

  # @return [String] The payload version. Combined with notification type controls the structure of payload
  attribute(:payload_version, String, from: "payloadVersion")
end
BuyBoxPrice =
Structure.new do
  # @return [String]
  attribute(:condition, String)

  # @return [Money]
  attribute(:landed_price, Money, from: "landedPrice")

  # @return [Money]
  attribute(:listing_price, Money, from: "listingPrice")

  # @return [Money]
  attribute(:shipping, Money)

  # @return [String]
  attribute?(:points, String)
end
MerchantOffer =

Offer details of the merchant receiving the notification

Structure.new do
  # @return [String]
  attribute(:condition, String)

  # @return [String]
  attribute(:fulfillment_type, String, from: "fulfillmentType")

  # @return [Money]
  attribute(:landed_price, Money, from: "landedPrice")

  # @return [Money]
  attribute(:listing_price, Money, from: "listingPrice")

  # @return [Money]
  attribute(:shipping, Money)

  # @return [String]
  attribute?(:points, String)
end
ReferencePrice =

A set of reference prices for the given ASIN

Structure.new do
  # @return [Money]
  attribute?(:average_selling_price, Money, from: "averageSellingPrice")

  # @return [Money]
  attribute?(:competitive_price_threshold, Money, from: "competitivePriceThreshold")

  # @return [Money]
  attribute?(:msrp_price, Money, from: "msrpPrice")

  # @return [Money]
  attribute?(:retail_offer_price, Money, from: "retailOfferPrice")
end
OfferChangeTrigger =

The event that caused the notification to be sent

Structure.new do
  # @return [String] The asin for the item that had an offer change
  attribute(:asin, String)

  # @return [String] The condition of the item that had an offer change
  attribute(:item_condition, String, from: "itemCondition")

  # @return [String] The marketplace identifier of the item that had an offer change
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [String] The update time for the offer that caused this notification
  attribute(:time_of_offer_change, String, from: "timeOfOfferChange")
end
NotificationMetadata =
Structure.new do
  # @return [String] The identifier for the application that uses the notifications
  attribute(:application_id, String, from: "applicationId")

  # @return [String] A unique identifier for this notification instance
  attribute(:notification_id, String, from: "notificationId")

  # @return [String] The date and time (in UTC) that the notification was sent
  attribute(:publish_time, String, from: "publishTime")

  # @return [String] A unique identifier for the subscription which resulted in this notification
  attribute(:subscription_id, String, from: "subscriptionId")
end

Class Method Summary collapse

Class Method Details

.parse(hash) ⇒ Object



9
10
11
# File 'lib/peddler/notifications/pricing_health.rb', line 9

def parse(hash)
  Notification.parse(hash)
end