Class: Amazon::AWS::ItemSearch

Inherits:
Operation show all
Defined in:
lib/amazon/aws.rb

Overview

This is the class for the most common type of AWS look-up, an ItemSearch. This allows you to search for items that match a set of broad criteria. It returns items for sale by Amazon merchants and most types of seller.

Constant Summary collapse

SEARCH_INDICES =

Not all search indices work in all locales. It is the user’s responsibility to ensure that a given index is valid within a given locale.

According to the AWS documentation:

  • All searches through all indices (but currently exists only in the US locale).

  • Blended combines DVD, Electronics, Toys, VideoGames, PCHardware, Tools, SportingGoods, Books, Software, Music, GourmetFood, Kitchen and Apparel.

  • Merchants combines all search indices for a merchant given with MerchantId.

  • Music combines the Classical, DigitalMusic, and MusicTracks indices.

  • Video combines the DVD and VHS search indices.

%w[
    All
    Apparel   Hobbies        PetSupplies
    Automotive    HomeGarden      Photo
    Baby    Jewelry       Software
    Beauty    Kitchen       SoftwareVideoGames
    Blended   Magazines      SportingGoods
    Books   Merchants      Tools
    Classical   Miscellaneous      Toys
    DigitalMusic  Music        VHS
    DVD     MusicalInstruments  Video
    Electronics   MusicTracks      VideoGames
    ForeignBooks  OfficeProducts      Wireless
    GourmetFood   OutdoorLiving      WirelessAccessories
    HealthPersonalCare  PCHardware
]

Constants inherited from Operation

Operation::ALL_PARAMETERS, Operation::OPERATIONS, Operation::OPT_PARAMETERS, Operation::PARAMETERS

Instance Attribute Summary

Attributes inherited from Operation

#kind, #params

Instance Method Summary collapse

Methods inherited from Operation

#batch_parameters

Constructor Details

#initialize(search_index, parameters) ⇒ ItemSearch

Search AWS for items. search_index must be one of SEARCH_INDICES and parameters is a hash of relevant search parameters.

Example:

is = ItemSearch.new( 'Books', { 'Title' => 'ruby programming' } )

In the above example, we search for books with Ruby Programming in the title.



803
804
805
806
807
808
809
810
# File 'lib/amazon/aws.rb', line 803

def initialize(search_index, parameters)
  unless SEARCH_INDICES.include? search_index.to_s
    raise "Invalid search index: #{search_index}"
  end

  parameter_check( parameters )
  super( { 'SearchIndex' => search_index }.merge( parameters ) )
end