Sha256: 0514e3683e28ddb2e570e07c9fce841b2adba5b9096269a2301e6b109fd14f89

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

# A word of caution: It seems Amazon will deprecate multiple requests
# on October 15 2010. We're petitioning them not to.

require "spec_helper"

module Sucker
  describe "Twenty items in one request" do
    before do
      @worker = Sucker.new(
        :locale => "us",
        :key    => amazon["key"],
        :secret => amazon["secret"])

      # Prep worker
      @worker << {
        "Operation"                       => "ItemLookup",
        "ItemLookup.Shared.IdType"        => "ASIN",
        "ItemLookup.Shared.Condition"     => "All",
        "ItemLookup.Shared.MerchantId"    => "All",
        "ItemLookup.Shared.ResponseGroup" => "OfferFull" }

      # Push twenty ASINs to worker
      @asins = %w{
        0816614024 0143105825 0485113600 0816616779 0942299078
        0816614008 144006654X 0486400360 0486417670 087220474X
        0486454398 0268018359 1604246014 184467598X 0312427182
        1844674282 0745640974 0745646441 0826489540 1844672972 }
      @worker << {
        "ItemLookup.1.ItemId" => @asins[0, 10],
        "ItemLookup.2.ItemId" => @asins[10, 10] }

      Sucker.stub(@worker)

      @items = @worker.get.node("Item")
    end

    it "returns 20 items" do
      @items.count.should eql 20
      @items.map { |item| item["ASIN"] }.should eql @asins
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sucker-0.9.2 spec/integration/twenty_items_in_one_request_spec.rb
sucker-0.9.1 spec/integration/twenty_items_in_one_request_spec.rb
sucker-0.9.0 spec/integration/twenty_items_in_one_request_spec.rb
sucker-0.8.0 spec/integration/twenty_items_in_one_request_spec.rb