Class: Amazon::AWS::ItemLookup

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

Overview

This class of look-up deals with searching for specific items by some uniquely identifying attribute, such as the ASIN (*A*mazon *S*tandard *I*tem *N*umber).

Direct Known Subclasses

SellerListingLookup

Constant Summary

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(id_type, parameters, *b_parameters) ⇒ ItemLookup

Look up a specific item in the AWS catalogue. id_type is the type of identifier, parameters is a hash that identifies the item to be located and narrows the scope of the search, and b_parameters is an optional hash of further items to be located. Use of b_parameters effectively results in a batch operation being sent to AWS.

Example:

il = ItemLookup.new( 'ASIN', { 'ItemId' => 'B000AE4QEC'

‘MerchantId’ => ‘Amazon’ }, { ‘ItemId’ => ‘B000051WBE’, ‘MerchantId’ => ‘Amazon’ } )

In the above example, we search for two items, based on their ASIN. The use of MerchantId restricts the offers returned to those for sale by Amazon (as opposed to third-party sellers).



880
881
882
883
884
885
886
887
888
889
890
891
# File 'lib/amazon/aws.rb', line 880

def initialize(id_type, parameters, *b_parameters)
  
  id_type_str = 'IdType'
  
  unless b_parameters.empty?
    class_str = self.class.to_s.sub( /^.+::/, '' )
    id_type_str = '%s.Shared.IdType' % [ class_str ]
    parameters = batch_parameters( parameters, *b_parameters )
  end
  
  super( { id_type_str => id_type }.merge( parameters ) )
end