Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acts_as_amazon_product

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acts_as_amazon_product

  • 1.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= ActsAsAmazonProduct

This "acts_as" module makes it extremely simple to add Amazon integration to an existing model.

== Setup

This code does not require changing any current database tables. It only requires adding one migration for a single new table used to cache responses from Amazon. Run the following to create the migration:

script/generate acts_as_amazon_product_migration

== Using acts_as_amazon_product

Add the "acts_as" line to your model. Only :access_key is required. The :asin and :name assignments override what attributes in your class should be used for a direct lookup (item_looup) or general search (item_search). If no value is assigned to :asin then a general search is made and the first item (sorted by salesrank) is assigned (this functionality will likely change).

require 'acts_as_amazon_product'

class Book < ActiveRecord::Base
  acts_as_amazon_product :asin => 'isbn', :name => 'title', 
			:access_key => '0123456', :associate_tag => 'assoc-20'
end

You can now access the Amazon data in your views like so (see):

@book = Book.new(:title => 'Getting Things Done')
@book.amazon.isbn
@book.amazon.title
@book.amazon.author
@book.amazon.small_image_url

or
@book.amazon.get('itemattributes/foobar')

== Unit tests

There are tests you can run in the [gem]/test directory. Just create a test/config.yml from the example and run "Rake test" from the [gem] directory.

= Credits acts_as_amazon_product was created by Scott Nedderman and Chris Beck from netphase.com

We'd love to here how you like it. Also, if you'd like us to help out with your next project, let us know.

http://netphase.com

FAQs

Package last updated on 25 Jul 2009

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc