すごく簡単だった。
gem install amazon-ecs
をインスコして
require ‘amazon/ecs’
def book_search
Amazon::Ecs.options = {
:aWS_access_key_id => ‘# your accesskey’,
:associate_tag => “#Associate ID”,
:country => :jp
}
@res = Amazon::Ecs.item_lookup(params[:book][:asin], {
:response_group => ‘Medium’,
})
end
がcontrollerで
<table>
<tr>
<td width=”10%”>画像</td>
<td width=”40%”>タイトル</td>
<td width=”20%”>作者</td>
<td width=”10%”>出版社</td>
</tr>
<% @res.items.each do |item| %>
<tr>
<td>
<% if item.get_hash(‘smallimage’) != nil %>
<%=image_tag(item.get_hash(‘smallimage’)[:url], :alt => item.get(‘title’)) %>
<% end %>
</td>
<td><%= item.get(‘title’) %></td>
<td><%= item.get_array(‘author’).join(“, “) %></td>
<td><%= item.get(‘publisher’) %></td>
</tr>
<% end %>
</table>
viewはこんな感じで、終了。
# your accesskeyはここからゲト。
I really like your site
Thank you so much for this post. I use the reviewazon plugin. Reviewazon is the easy and simple way to add amazon affiliate product to your website.