RWSC stands for Rakuten Web Service Client. This is the Rakuten Web Service API Wrapper for Ruby.
This README covers the basic usage.
Step 1. Install the gem:
sudo gem install rwsc
Step 2. Require the gem (You may need to also require rubygems, depending on your setup):
require 'rubygems' require 'rwsc'
Step 3. Use the gem to make a call to the API:
result_object = Rwsc::ItemSearch.find(:keyword => “cool stuff that they only have in Japan”, :developerId => [Your_Rakuten_Developer_ID]*)
Other params to try:
:developerId :affiliateId :keyword :shopCode :genreId :catalogCode :hits :page :sort :minPrice :maxPrice :availability :field :carrier :imageFlag :orFlag :NGKeyword :genreInformationFlag :purchaseType :shipOverseasFlag :shipOverseasArea :asurakuFlag :asurakuArea :pointRateFlag :pointRate :postageFlag :creditCardFlag
Step 4. Get a response:
The information you get is in a data_hash, wrapped in the result_object. To access any underlying data, just call the keys of the hash as methods on your result_object. (ie. result_object.items)
This is a hash of hashes and arrays, so you might have to drill down to get the info you're looking for.
Anyways, these are the keys of the big data_hash: “items” “hits” “args” “status” “carrier” “page_count” “last” “first” “count” “page”
For more info on what is supported by this particular API (Item search), check out webservice.rakuten.co.jp/api/itemsearch/ **
With google translate as your friend, you should be able to glean the request params and response body.
Use of RWSC through a Proxy
When you have to connect through a proxy server, you should also set these variables before your call to Rwsc::ItemSearch.find:
Rwsc::Config.proxy_host = "YOUR_PROXY_HOST" Rwsc::Config.proxy_port = YOUR_PROXY_PORT == If you want to development Please install rr >= 1.0.2 and rspec >= 2.2.0 .
*What's that? You don't have a Rakuten developer ID? You can click the top link on the blue box in the upper left corner on this page: webservice.rakuten.co.jp/
With good luck and google translate, you might be able to get by. But feel free to get in touch with github.com/evanburchard if you have any questions.
**And yes, those are 24 other APIs to the left, just waiting to be implemented. Fork away!