Sha256: c3f82cde9a58259d5835662244ef62513cbeb96d90f023c7386054e98d62028b

Contents?: true

Size: 694 Bytes

Versions: 13

Compression:

Stored size: 694 Bytes

Contents

module Kosher
  class Request < Sucker::Request
    def initialize(args={})
      super
      add_parameters
    end

    def batchify(asins)
      self.<<({ 'ItemLookup.1.ItemId' => asins[0, 10] })
      self.<<({ 'ItemLookup.2.ItemId' => asins[10, 10] }) if asins.size > 10
    end

    def get
      Algorithm.new(super)
    end

    private

    def add_parameters
      self.<<({
        'Operation'                       => 'ItemLookup',
        'ItemLookup.Shared.IdType'        => 'ASIN',
        'ItemLookup.Shared.Condition'     => 'All',
        'ItemLookup.Shared.MerchantId'    => 'All',
        'ItemLookup.Shared.ResponseGroup' => ['OfferFull', 'SalesRank'] })
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
kosher-0.1.12 lib/kosher/request.rb
kosher-0.1.11 lib/kosher/request.rb
kosher-0.1.10 lib/kosher/request.rb
kosher-0.1.9 lib/kosher/request.rb
kosher-0.1.8 lib/kosher/request.rb
kosher-0.1.7 lib/kosher/request.rb
kosher-0.1.6 lib/kosher/request.rb
kosher-0.1.5 lib/kosher/request.rb
kosher-0.1.4 lib/kosher/request.rb
kosher-0.1.3 lib/kosher/request.rb
kosher-0.1.2 lib/kosher/request.rb
kosher-0.1.1 lib/kosher/request.rb
kosher-0.1.0 lib/kosher/request.rb