Module: Paapi

Defined in:
lib/paapi.rb,
lib/paapi/item.rb,
lib/paapi/client.rb,
lib/paapi/listing.rb,
lib/paapi/version.rb,
lib/paapi/response.rb

Defined Under Namespace

Classes: Client, Error, Item, Listing, Locale, NotImplemented, Operation, Response

Constant Summary collapse

SEARCH_PARAMS =
%i[keywords actor, artist, author, brand title].freeze
DEFAULT_PARTNER_TYPE =
'Associates'
DEFAULT_MARKET =
:us
DEFAULT_CONDITION =
'Any'
DEFAULT_RESOURCES =
[
  'Images.Primary.Large',
  'ItemInfo.ByLineInfo',
  'ItemInfo.ContentInfo',
  'ItemInfo.ExternalIds',
  'ItemInfo.Features',
  'ItemInfo.ManufactureInfo',
  'ItemInfo.ProductInfo',
  'ItemInfo.TechnicalInfo', # Includes format when Kindle
  'ItemInfo.Title',
  'ItemInfo.TradeInInfo',
  'Offers.Listings.Availability.Message',
  'Offers.Listings.Condition',
  'Offers.Listings.Condition.SubCondition',
  'Offers.Listings.DeliveryInfo.IsAmazonFulfilled',
  'Offers.Listings.DeliveryInfo.IsFreeShippingEligible',
  'Offers.Listings.DeliveryInfo.IsPrimeEligible',
  'Offers.Listings.MerchantInfo',
  'Offers.Listings.Price',
  'Offers.Listings.SavingBasis'
].freeze
MARKETPLACES =
{
  au: Locale.new(:au, 'Australia',	          'webservices.amazon.com.au', 'us-west-2'),
  br: Locale.new(:br, 'Brazil',	              'webservices.amazon.com.br', 'us-east-1'),
  ca: Locale.new(:ca, 'Canada',	              'webservices.amazon.ca',	   'us-east-1'),
  fr: Locale.new(:fr, 'France',	              'webservices.amazon.fr',	   'eu-west-1'),
  de: Locale.new(:de, 'Germany',	            'webservices.amazon.de',	   'eu-west-1'),
  in: Locale.new(:in, 'India',	              'webservices.amazon.in',	   'eu-west-1'),
  it: Locale.new(:it, 'Italy',	              'webservices.amazon.it',	   'eu-west-1'),
  jp: Locale.new(:jp, 'Japan',	              'webservices.amazon.co.jp',	 'us-west-2'),
  mx: Locale.new(:mx, 'Mexico',	              'webservices.amazon.com.mx', 'us-east-1'),
  es: Locale.new(:es, 'Spain',                'webservices.amazon.es',	   'eu-west-1'),
  tr: Locale.new(:tk, 'Turkey',	              'webservices.amazon.com.tr', 'eu-west-1'),
  ae: Locale.new(:ae, 'United Arab Emirates',	'webservices.amazon.ae',	   'eu-west-1'),
  uk: Locale.new(:uk, 'United Kingdom',	      'webservices.amazon.co.uk',	 'eu-west-1'),
  us: Locale.new(:us, 'United States',	      'webservices.amazon.com',	   'us-east-1'),
}.freeze
OPERATIONS =
{
  get_browse_nodes: Operation.new( 'GetBrowseNodes', 'getbrowsenodes', 'POST', 'ProductAdvertisingAPI' ),
  get_items:        Operation.new( 'GetItems',       'getitems',       'POST', 'ProductAdvertisingAPI' ),
  get_variations:   Operation.new( 'GetVariations',  'getvariations',  'POST', 'ProductAdvertisingAPI' ),
  search_items:     Operation.new( 'SearchItems',    'searchitems',    'POST', 'ProductAdvertisingAPI' )
}.freeze
VERSION =
'0.1.6'

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.access_keyObject

Returns the value of attribute access_key.



70
71
72
# File 'lib/paapi.rb', line 70

def access_key
  @access_key
end

.conditionObject

Returns the value of attribute condition.



70
71
72
# File 'lib/paapi.rb', line 70

def condition
  @condition
end

.marketObject

Returns the value of attribute market.



70
71
72
# File 'lib/paapi.rb', line 70

def market
  @market
end

.partner_marketObject

Returns the value of attribute partner_market.



70
71
72
# File 'lib/paapi.rb', line 70

def partner_market
  @partner_market
end

.partner_tagObject

Returns the value of attribute partner_tag.



70
71
72
# File 'lib/paapi.rb', line 70

def partner_tag
  @partner_tag
end

.partner_typeObject

Returns the value of attribute partner_type.



70
71
72
# File 'lib/paapi.rb', line 70

def partner_type
  @partner_type
end

.resourcesObject

Returns the value of attribute resources.



70
71
72
# File 'lib/paapi.rb', line 70

def resources
  @resources
end

.secret_keyObject

Returns the value of attribute secret_key.



70
71
72
# File 'lib/paapi.rb', line 70

def secret_key
  @secret_key
end

.test_modeObject

Returns the value of attribute test_mode.



70
71
72
# File 'lib/paapi.rb', line 70

def test_mode
  @test_mode
end

Class Method Details

.configure {|_self| ... } ⇒ Object Also known as: config

Yields:

  • (_self)

Yield Parameters:

  • _self (Paapi)

    the object that the method was called on



80
81
82
83
# File 'lib/paapi.rb', line 80

def configure
  yield self
  true
end

Instance Method Details

#symbolize_keys(hash) ⇒ Object



87
88
89
# File 'lib/paapi.rb', line 87

def symbolize_keys(hash)
  Hash[hash.map{|k,v| v.is_a?(Hash) ? [k.to_sym, symbolize_keys(v)] : [k.to_sym, v] }]
end