Vacuum is a Ruby wrapper to [various Amazon Web Services (AWS) APIs] 3.
![vacuum] 4
Vacuum knows the [Amazon Product Advertising API] 5 [inside out] 6.
request = Vacuum.new(:product_advertising) do |config|
config.locale 'US'
config.key 'key'
config.secret 'secret'
config.tag 'tag'
end
# Use an alternative Faraday adapter.
# request.connection do |builder|
# builder.adapter :typhoeus
# end
# A barebone search request.
request.build operation: 'ItemSearch',
search_index: 'Books',
keywords: 'Deleuze'
response = request.get
# A less verbose search.
request.search :books, 'Deleuze'
if response.valid?
# response.code
# response.body
# response.errors
# response.xml # The Nokogiri XML doc
# response.to_hash
response.find('Item') do |item|
p item['ASIN']
end
end
The wrapper to the [Amazon Marketplace Web Services API] 7 is a work-in-progress.
request = Vacuum.new(:mws_products) do |config|
config.locale 'US'
config.key 'key'
config.secret 'secret'
config.marketplace 'marketplace'
config.seller 'seller'
end
request.build 'Action' => 'GetLowestOfferListingsForASIN',
'ASINList.ASIN.1' => '0231081596'
offers = request.get.find 'GetLowestOfferListingsForASINResult'
Vacuum should work with EC2, S3, IAM, SimpleDB, SQS, SNS, SES, ELB, CW, and so on. Implement and send a pull request.
![vacuums] 8
Workers queuing to crawl AWS.