百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

vacuum

> 编程语言
开源

Ruby 中的 Amazon Creators API

562 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

Ruby 中的 Amazon Creators API

Vacuum

Vacuum is a Ruby wrapper to the Amazon Creators API. The API provides programmatic access to product information on the Amazon marketplaces.

Usage

Getting Started

Create a client with your credentials.

ruby
client = Vacuum.new(
  credential_id: "YOUR_CREDENTIAL_ID",
  credential_secret: "YOUR_CREDENTIAL_SECRET",
  version: "2.1"
)

The client handles authentication automatically and caches access tokens for one hour.

You can now access the API using the available operations.

ruby
response = client.search_items(
  marketplace: "www.amazon.com",
  partner_tag: "yourtag-20",
  keywords: "lean startup"
)
response.parse

Versions and Marketplaces

The version determines which authentication endpoint to use. Versions 2.x use Amazon Cognito; versions 3.x use Login with Amazon (LwA).

Version Region
"2.1" North America
"2.2" Europe
"2.3" Far East
"3.1" North America
"3.2" Europe
"3.3" Far East

Operations

Each operation requires marketplace (e.g., "www.amazon.com") and partner_tag parameters.

GetBrowseNodes

Given a BrowseNodeId, the GetBrowseNodes operation returns details about the specified browse node, like name, children and ancestors, depending on the resources specified in the request.

ruby
client.get_browse_nodes(
  marketplace: "www.amazon.com",
  partner_tag: "yourtag-20",
  browse_node_ids: ["283155", "3040"],
  resources: ["browseNodes.ancestor", "browseNodes.children"]
)

GetItems

Given an Item identifier, the GetItems operation returns the item attributes, based on the resources specified in the request.

ruby
client.get_items(
  marketplace: "www.amazon.com",
  partner_tag: "yourtag-20",
  item_ids: ["B0199980K4", "B000HZD168"],
  resources: ["images.primary.small", "itemInfo.title", "itemInfo.features",
              "offersV2.listings.price", "parentASIN"]
)

GetVariations

Given an ASIN, the GetVariations operation returns a set of items that are the same product, but differ according to a consistent theme, for example size and color.

ruby
client.get_variations(
  marketplace: "www.amazon.com",
  partner_tag: "yourtag-20",
  asin: "B00422MCUS",
  resources: ["itemInfo.title", "variationSummary.price.highestPrice",
              "variationSummary.price.lowestPrice",
              "variationSummary.variationDimension"]
)

SearchItems

The SearchItems operation searches for items on Amazon based on a search query. The API returns up to ten items per search request.

ruby
client.search_items(
  marketplace: "www.amazon.com",
  partner_tag: "yourtag-20",
  keywords: "harry potter"
)

Response

Parse the response body into a hash.

ruby
response.parse.dig("searchResult", "items")

Shared Token Cache

By default, each client instance caches its own access token. In multi-process environments like Rails, you can share the token across processes by providing a cache store.

ruby
client = Vacuum.new(
  credential_id: "YOUR_CREDENTIAL_ID",
  credential_secret: "YOUR_CREDENTIAL_SECRET",
  version: "2.1",
  cache: Rails.cache
)

The cache must respond to fetch(key, expires_in:, &block).

Development

Clone the repo and install dependencies.

bash
bundle install

Run tests and Rubocop.

bash
bundle exec rake

To run API tests, copy spec/credentials.yml.example to spec/credentials.yml and fill in your credentials.


Amazon is a $250 billion dollar company that reacts to you buying a vacuum by going THIS GUY LOVES BUYING VACUUMS HERE ARE SOME MORE VACUUMS

— @kibblesmith

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubyamazonamazon-creators-apiamazon-product-advertisingproduct-advertising-api

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

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