Ruby on Rails with Gizmoojo’s Amazon ECS module

March 27, 2006 at 9:09 pm | In Amazon, Ruby on Rails, amazonecs, gizmoojo | 10 Comments

Gizmoojo has a back end module that uses amazon web services and my previous post talks about how easy it was to use REST with AWS. This weekend was a fun one because I had actually written some code to use the amazonecs module that is going to drive some features of Gizmoojo. The amazonecs module is a Ruby class/module that I wrote to do backend work with Amazon Ecommerce Services (part of the Amazon web services). And of course, there is already Ruby/Amazon available but it's just wasn't what I was looking for ( I think it only works with Amazon ECS ver 3.0 and the current Amazon ECS is veriosn 4.0) plus I was looking for more "fun" in writing one up for Gizmoojo.

So I thought it would be nice to share a little bit of this. Now, I call this module "amazonecs" so in my rails controller, to do something with amazon web service is easy.

First of all you need to include the module in your controller rb file

include amazonecs

so for example if I wanna do a search on item using keyword/s all I need to do in the controller is as easy as that.

class AmazonSearchController < ApplicationController
def searchitem
mysearch = Amazonecs.new
@items = Array.new
@item = Electronics.new
keywords = ['ipod','speakers']
# 0 – amazon.com (us locale)
# "Medium" – SearchGroup

@items = mysearch.searchitem(0,"Electronics",keywords,"Medium")
if @items.nil?
#do your error handling or no results found.
else
@item.populate(@items[0])
end
end
end

And of course over at our AmazonSearch view for the searchitem.rhtml, I can get the information about the first item thru the attr_reader of the Electronics class.

Item ASIN : <%= @item.ASIN %> <br/>

Item Price: <%= @item.ListPrice %> <br/>


Click <a href="<%= @item.DetailURLPage %>">here</a> to see this item.

10 Comments »

RSS feed for comments on this post. TrackBack URI

  1. I’m working on an app that will hook into AWS. I’d love to see your code, if you’re willing to share! Thanks!

  2. yup.. I had thought about open sourcing the Amazon ECS but had not make up my mind about it yet.

  3. Would you mind sharing? I’m just getting into Ruby, and this would be hot!

  4. [...] As mentioned in my previous post, Gizmoojo.com has an Amazon ECS module used for runnning advertisments and stuff like that, so once in a while, I find myself going through the Amazon Web Service forum. One particular thread caught my attention and it goes like that " I'm being sued by Sony for displaying products from the web service". Going through the thread, I am totally amazed by what Sony is doing. Basically, they have engaged this law firm Ellis & Venable calling themselves Net Enforcers to protect their licensed trademarks, logos, and other copyrighted materials. To me, this is just major silliness. Here you have a web site that is trying to push thier products through the use of Amazon.com web service, definitely their authorized dealers, and there you have Sony, trying to stop these web shops from SELLING THEIR PRODUCTS. I must be missing something here… go figure…. corporate mess….. [...]

  5. what exactly is the point of this post if you do not plan on sharing the module? Why bother showing your function calls if you do not share the functions. What if instead of freely publishing the rails framework, 43things had just published a blog that said “we’ve built this framework for internal use that really makes life easy for us and us alone.” That’d would’ve been kind of lame.

  6. Sorry Bart if this post upset you. There are many reasons that I have yet to make this open source. One, I write ugly code 8^). So its not ready to meet the world. And this is my blog, so I think I am entitled to publish blog about anything, including lame things.

  7. you are correct, sorry about the whiney comment.

  8. There’s also this:
    http://amazon-ecs.rubyforge.org/doc/

  9. I have carried out huge work and collected the most interesting
    sites about online business in the Internet

    I choose only update and developing ones and collected them in the same place.
    They are accessible for everybody.
    I offer you to acquaint with them ( online investing bookmak http://urlmarker.com/bookmarks.php/boksir124 )
    If somebody can supplement my list please publish here your research or bookmark

    PS I am sorry if my message out of forum topic or it`s not interesting to community.


Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.