Has anyone built a site with RoR that uses the REST interface to Amazon? How would this be done? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Fri, Jul 29, 2005, Doug Perry wrote:> Has anyone built a site with RoR that uses the REST interface to Amazon? How > would this be done?There is at least one Ruby library for the Amazon API. It doesn''t seem to be available as a gem, but it''s available here: http://www.caliban.org/ruby/ruby-amazon.shtml One option would be to require that library in a model and write some wrapper functions to encapsulate the functionality you want. You could also write some wrappers and drop them in your lib directory. There are probably other options, too :) Ben
I also used this site when I learned how to use Ruby/Amazon: http://gleepglop.com/journal/articles/2005/06/06/amazon-on-rails And I wrote a little about my experience on my blog: http://www.roryhansen.ca/?p=25 The Ruby/Amazon library makes it really easy to use the Amazon Web Services. The only confusing part, I felt, was learning what methods you''d use to access the retrieved data. I can''t remember off hand, but I think you can call a properties method on the response object to output all of the available data access methods. On 7/29/05, Ben Bleything <ben-TGHtUsa5cOzMFIMGWPqnnw@public.gmane.org> wrote:> On Fri, Jul 29, 2005, Doug Perry wrote: > > Has anyone built a site with RoR that uses the REST interface to Amazon? How > > would this be done? > > There is at least one Ruby library for the Amazon API. It doesn''t seem > to be available as a gem, but it''s available here: > http://www.caliban.org/ruby/ruby-amazon.shtml > > One option would be to require that library in a model and write some > wrapper functions to encapsulate the functionality you want. You could > also write some wrappers and drop them in your lib directory. > > There are probably other options, too :) > > Ben > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I''m still trying to grok AWS. I''m exploring building a storefront where my products are handled by Amazon. If I built a zShop with categories and such, how would I break the products down by category? Example: /store/foo Is all category foo /store/bar Are all products under the category bar. I grok the mechanics of controllers, views, and the dispatcher. Just looking to see if I can accomplsh what I think I can with Rails and AWS. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 7/29/05, Doug Perry <doug.perry-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m still trying to grok AWS. I''m exploring building a storefront where my > products are handled by Amazon. If I built a zShop with categories and such, > how would I break the products down by category? > > Example: > > /store/foo > Is all category foo > > /store/bar > Are all products under the category bar. > > I grok the mechanics of controllers, views, and the dispatcher. Just > looking to see if I can accomplsh what I think I can with Rails and AWS.This is really just a routing question. The more generaly "Rails" way would be to do something like: /store/category/foo or /store/category/bar Assuming, of course, that "store" is the controller. If you''re looking to do something where you use just "/store" as the action of some other controller, you can just make the route in a way such that "foo" and "bar" would be found in params[:id]. Make sense? Which are you looking to do? Keep in mind that routes are quite flexible, so you could even define one like: map.category ''/store/:name'', :controller => ''browse'', :action => ''category'' That would go to controller "browse" and action "category" and stick the foo, bar, etc in the params[:name] parameter. And to answer the original question, I wrote my own libraries to handle the AWS REST interface and then used ActiveRecord-based models to interface with those. The advantage was that I was able to add some builting caching in a MySQL database and have a handy ActiveRecord-style interface, but still have access to all the AWS content. Honestly, it''s not super-clean right now, but if I have some time maybe I can clean it up and open source it. I looked at the Ruby/Amazon library, but there was something about it''s interface that I didn''t care for (can''t remember what, exactly, it was anymore). Cheers. bs.
On 7/29/05, Ben Schumacher <benschumacher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Honestly, it''s not super-clean right now, but if I have some > time maybe I can clean it up and open source it.Please do. Pretty please. ;-)
+1. Ruby/Amazon is not being developed any further, from what I understand, so it makes sense to have a RoR system that handles ECS 4+. I''ll have to devote some energy to hooking Amazon to my site and this looks like a component we can all share. On 7/29/05, Cristiano Dias <crisdias-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 7/29/05, Ben Schumacher <benschumacher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Honestly, it''s not super-clean right now, but if I have some > > time maybe I can clean it up and open source it. > > Please do. Pretty please. ;-) > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I''ve done a little work hooking AWS 4.0 to my site. I used the Ruby/Amazon library, which is AWS 3 I believe, but I crudely hacked it to work with 4.0. Here are some samples in case they help anyone. My action to call it from Rails: def amazon_request(asin, weight, location, tocache) #need error checking here. If amazon is down, it breaks the page @DEV_TOKEN = MY_CONFIG["amazonToken"] # development token request = Request.new(@DEV_TOKEN, MY_CONFIG["amazonID"], location, tocache) response = request.asin_search(asin, weight) products = response.products return products[0] end And an example of how I call it: product_overview = amazon_request(item.asin, ''Small'', ''us'', true) I can send my hacked search.rb, file, which contains the asin_search function, from within the Ruby/Amazon if anyone is interested. You can mail me off list. Steve On 7/29/05, Bill Katz <billkatz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> +1. Ruby/Amazon is not being developed any further, from what I > understand, so it makes sense to have a RoR system that handles ECS > 4+. I''ll have to devote some energy to hooking Amazon to my site and > this looks like a component we can all share. >