Module: Peddler::Notifications::B2BAnyOfferChanged

Defined in:
lib/peddler/notifications/b2b_any_offer_changed.rb,
lib/peddler/notifications/b2b_any_offer_changed/offer.rb,
lib/peddler/notifications/b2b_any_offer_changed/points.rb,
lib/peddler/notifications/b2b_any_offer_changed/payload.rb,
lib/peddler/notifications/b2b_any_offer_changed/summary.rb,
lib/peddler/notifications/b2b_any_offer_changed/ships_from.rb,
lib/peddler/notifications/b2b_any_offer_changed/offer_count.rb,
lib/peddler/notifications/b2b_any_offer_changed/lowest_price.rb,
lib/peddler/notifications/b2b_any_offer_changed/notification.rb,
lib/peddler/notifications/b2b_any_offer_changed/buy_box_price.rb,
lib/peddler/notifications/b2b_any_offer_changed/shipping_time.rb,
lib/peddler/notifications/b2b_any_offer_changed/prime_information.rb,
lib/peddler/notifications/b2b_any_offer_changed/offer_change_trigger.rb,
lib/peddler/notifications/b2b_any_offer_changed/notification_metadata.rb,
lib/peddler/notifications/b2b_any_offer_changed/seller_feedback_rating.rb,
lib/peddler/notifications/b2b_any_offer_changed/quantity_discount_price_type.rb,
lib/peddler/notifications/b2b_any_offer_changed/b2b_any_offer_changed_notification.rb

Constant Summary collapse

Offer =
Structure.new do
  # @return [:boolean] Indicates whether the offer is fulfilled by Amazon
  attribute(:fulfilled_by_amazon, :boolean, null: false, from: "IsFulfilledByAmazon")

  # @return [Money]
  attribute(:listing_price, Money, null: false, from: "ListingPrice")

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

  # @return [Money]
  attribute(:shipping, Money, null: false, from: "Shipping")

  # @return [Hash]
  attribute(:shipping_time, Hash, null: false, from: "ShippingTime")

  # @return [String] The subcondition of the item
  attribute(:sub_condition, String, null: false, from: "SubCondition")

  # @return [String] Information about the condition of the item
  attribute?(:condition_notes, String, from: "ConditionNotes")

  # @return [:boolean] Indicates whether the offer is currently in the Buy Box. There can be up to two Buy Box
  #   winners at any time per ASIN, one that is eligible for Prime and one that is not eligible for Prime
  attribute?(:buy_box_winner, :boolean, from: "IsBuyBoxWinner")

  # @return [:boolean] Indicates whether the seller of the item is eligible to win the Buy Box
  attribute?(:featured_merchant, :boolean, from: "IsFeaturedMerchant")

  # @return [Points]
  attribute?(:points, Points, from: "Points")

  # @return [PrimeInformation]
  attribute?(:prime_information, PrimeInformation, from: "PrimeInformation")

  # @return [Array<QuantityDiscountPriceType>] Contains a list of pricing information that includes special
  #   pricing when buying in bulk
  attribute?(:quantity_discount_price, [QuantityDiscountPriceType], from: "QuantityDiscountPrice")

  # @return [SellerFeedbackRating]
  attribute?(:seller_feedback_rating, SellerFeedbackRating, from: "SellerFeedbackRating")

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

Notification payload data

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

  # @return [Array<LowestPrice>] A list that contains the lowest prices of the item for the given conditions,
  #   fulfillment channels, quantity tiers, and discount types
  attribute(:lowest_prices, [LowestPrice], null: false, from: "LowestPrices")

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

  # @return [Array<BuyBoxPrice>] A list that contains the Buy Box price of the item for the given conditions,
  #   quantity tiers, and discount types
  attribute?(:buy_box_prices, [BuyBoxPrice], from: "BuyBoxPrices")
end
ShipsFrom =
Structure.new do
  # @return [String]
  attribute?(:country, String, from: "Country")

  # @return [String]
  attribute?(:state, String, from: "State")
end
OfferCount =
Structure.new do
  # @return [String]
  attribute(:condition, String, null: false, from: "Condition")

  # @return [String]
  attribute(:fulfillment_channel, String, null: false, from: "FulfillmentChannel")

  # @return [Integer] The total number of offers for the specified condition and fulfillment channel
  attribute?(:offer_count, Integer, from: "OfferCount")
end
LowestPrice =
Structure.new do
  # @return [String]
  attribute(:condition, String, null: false, from: "Condition")

  # @return [String]
  attribute(:fulfillment_channel, String, null: false, from: "FulfillmentChannel")

  # @return [Money]
  attribute(:listing_price, Money, null: false, from: "ListingPrice")

  # @return [String]
  attribute(:offer_type, String, null: false, from: "OfferType")

  # @return [String]
  attribute(:quantity_tier, String, null: false, from: "QuantityTier")

  # @return [String]
  attribute?(:discount_type, String, from: "DiscountType")

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

  # @return [Points]
  attribute?(:points, Points, from: "Points")

  # @return [Money]
  attribute?(:shipping, Money, from: "Shipping")
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, null: false, from: "EventTime")

  # @return [String]
  attribute(:notification_metadata, String, null: false, from: "NotificationMetadata")

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

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

  # @return [Payload]
  attribute(:payload, Payload, null: false, from: "Payload")

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

  # @return [Money]
  attribute(:listing_price, Money, null: false, from: "ListingPrice")

  # @return [String]
  attribute(:offer_type, String, null: false, from: "OfferType")

  # @return [String]
  attribute(:quantity_tier, String, null: false, from: "QuantityTier")

  # @return [String]
  attribute?(:discount_type, String, from: "DiscountType")

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

  # @return [Points]
  attribute?(:points, Points, from: "Points")

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

  # @return [Money]
  attribute?(:shipping, Money, from: "Shipping")
end
ShippingTime =
Structure.new do
  # @return [String] Indicates whether the item is available for shipping now, or on a known or an unknown date in
  #   the future
  attribute?(:availability_type, String, from: "AvailabilityType")

  # @return [String] The date when the item will be available for shipping. Only displayed for items that are not
  #   currently available for shipping
  attribute?(:available_date, String, from: "AvailableDate")

  # @return [Integer] The maximum time, in hours, that the item will likely be shipped after the order has been
  #   placed
  attribute?(:maximum_hours, Integer, from: "MaximumHours")

  # @return [Integer] The minimum time, in hours, that the item will likely be shipped after the order has been
  #   placed
  attribute?(:minimum_hours, Integer, from: "MinimumHours")
end
PrimeInformation =
Structure.new do
  # @return [:boolean] Indicates whether the offer is an Amazon Prime offer throughout the entire marketplace
  #   where it is listed
  attribute?(:national_prime, :boolean, from: "IsNationalPrime")

  # @return [:boolean] Indicates whether the offer is an Amazon Prime offer
  attribute?(:prime, :boolean, from: "IsPrime")
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, null: false, from: "ASIN")

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

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

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

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

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

  # @return [String] A unique identifier for the subscription which resulted in this notification
  attribute(:subscription_id, String, null: false, from: "SubscriptionId")
end
SellerFeedbackRating =
Structure.new do
  # @return [Integer] The count of feedback received about the seller
  attribute(:feedback_count, Integer, null: false, from: "FeedbackCount")

  # @return [Float] The percentage of positive feedback for the seller in the past 365 days
  attribute?(:seller_positive_feedback_rating, Float, from: "SellerPositiveFeedbackRating")
end
QuantityDiscountPriceType =

Contains pricing information that includes special pricing when buying in bulk.

Structure.new do
  # @return [Money] The price at this quantity tier.
  attribute(:listing_price, Money, null: false, from: "ListingPrice")

  # @return [String] Indicates the type of quantity discount this price applies to.
  attribute(:quantity_discount_type, String, null: false, from: "QuantityDiscountType")

  # @return [Integer] Indicates at what quantity this price becomes active.
  attribute(:quantity_tier, Integer, null: false, from: "QuantityTier")
end
B2BAnyOfferChangedNotification =
Structure.new do
  # @return [OfferChangeTrigger]
  attribute(:offer_change_trigger, OfferChangeTrigger, null: false, from: "OfferChangeTrigger")

  # @return [Array<Offer>] The top 20 competitive B2B offers for the item and condition that triggered the
  #   notification
  attribute(:offers, [Offer], null: false, from: "Offers")

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

  # @return [Summary]
  attribute(:summary, Summary, null: false, from: "Summary")
end

Class Method Summary collapse

Class Method Details

.parse(hash) ⇒ Object



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

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