Skip to content

Instantly share code, notes, and snippets.

@yoshiokatsuneo
Last active August 29, 2015 14:07
Show Gist options
  • Save yoshiokatsuneo/5d37e3e795980a0b6758 to your computer and use it in GitHub Desktop.
Save yoshiokatsuneo/5d37e3e795980a0b6758 to your computer and use it in GitHub Desktop.
# Here your code !
require 'net/http'
require 'uri'
require 'pp'
require 'json'
url = URI.parse(URI.escape('https://app.rakuten.co.jp/services/api/IchibaItem/Search/20140222?applicationId=1044477890616064296&keyword=アルゴリズム'))
res = Net::HTTP.start(url.host, url.port, use_ssl: true){|http|
http.get(url.path + "?" + url.query);
}
obj = JSON.parse(res.body)
# puts obj
puts "<table border=1>"
obj['Items'].each{|itemObj|
item = itemObj['Item']
if ! item['mediumImageUrls'][0]
next
end
puts <<_EOT_;
<tr>
<td>
<img src="#{item['mediumImageUrls'][0]['imageUrl']}"/>
</td>
<td>
#{item['itemName']}
</td>
</tr>
_EOT_
}
puts "</table>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment