Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

asin

> 编程语言
Open source

:books: :package: Amazon Simple INterface - Support for ItemLookup, SimilarityLookup, Search, BrowseNode and Cart Operations

170 stars0 likes2 views
WebsiteGitHub

About

:books: :package: Amazon Simple INterface - Support for ItemLookup, SimilarityLookup, Search, BrowseNode and Cart Operations

Infos

ASIN is a simple, extensible wrapper for parts of the REST-API of Amazon Product Advertising API (aka Associates Web Service aka Amazon E-Commerce Service).

For more information on the REST calls, have a look at the whole Amazon E-Commerce-API.

Have a look at the RDOC for this project, if you like browsing some docs.

The gem runs smoothly with Rails and is tested against multiple rubies. See .travis.yml for details.

Upgrading from Version 1.x

Version 2 removes all the SimpleXXX classes in favor of Hashie::Rash.

The old API is available if you require ASIN::Adapter:

ruby
require 'asin'
require 'asin/adapter'

It's also a good starting point for looking into writing your own asin-adapter.

Installation

bash
gem install asin

or in your Gemfile:

ruby
gem 'asin'

Configuration

Rails style initializer (config/initializers/asin.rb):

ruby
ASIN::Configuration.configure do |config|
  config.secret        = 'your-secret'
  config.key           = 'your-key'
  config.associate_tag = 'your-tag'
end

Have a look at ASIN::Configuration class for all the details.

Usage

ASIN is designed as a module, so you can include it into any object you like:

ruby
# require and include
require 'asin'
include ASIN::Client

# lookup an ASIN
lookup '1430218150'

# lookup multiple items by ASIN
lookup ['1430218150','1934356549']

But you can also use the instance method to get a proxy-object:

…

There is an additional set of methods to support AWS cart operations:

ruby
client = ASIN::Client.instance

# create a cart with an item
cart = client.create_cart({:asin => '1430218150', :quantity => 1})
cart.cart_items.cart_item
# => []

# clear everything from the cart
cart = client.clear_cart(cart)
cart.cart_items.cart_item
# => []

# update items in the cart
cart = client.update_items(cart, {:cart_item_id => cart.items.first.CartItemId, :action => :SaveForLater}, {:cart_item_id # => cart.items.first.CartItemId, :quantity => 7})
cart.saved_for_later_items.saved_for_later_item
# => []

It's also possible to access browse nodes:

ruby
client = ASIN::Client.instance

# create a cart with an item
node = client.browse_node('17', :ResponseGroup => :TopSellers)
node.first.browse_node_id
# => '163357'
node.first.name
# => 'Literature & Fiction'

Confiture

ASIN uses Confiture as a Configuration gem. See the Confiture documentation for different configuration styles.

License

"THE (extended) BEER-WARE LICENSE" (Revision 42.0815): phoet contributed to this project.

As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me some beers in return.

Issues· 2 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubyamazonasinruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言