require 'net/https'
http= Net::HTTP.new('api.del.icio.us', 443)
http.use_ssl = true
http.start do |http|
req=Net::HTTP::Get.new('/v1/tags/get')
req.basic_auth 'myusername', 'password'
@resp= http.request(req)
end
puts @resp.body
Output:
<?xml version="1.0" encoding="UTF-8"?>
<tags>
<tag count="1" tag="!fromtwitter"/>
<tag count="1" tag="social"/>
<tag count="1" tag="ecommerce"/>
<tag count="1" tag="flipkart"/>
</tags>
links:
http://www.rubyinside.com/nethttp-cheat-sheet-2940.html
https://github.com/augustl/net-http-cheat-sheet
http= Net::HTTP.new('api.del.icio.us', 443)
http.use_ssl = true
http.start do |http|
req=Net::HTTP::Get.new('/v1/tags/get')
req.basic_auth 'myusername', 'password'
@resp= http.request(req)
end
puts @resp.body
Output:
<?xml version="1.0" encoding="UTF-8"?>
<tags>
<tag count="1" tag="!fromtwitter"/>
<tag count="1" tag="social"/>
<tag count="1" tag="ecommerce"/>
<tag count="1" tag="flipkart"/>
</tags>
links:
http://www.rubyinside.com/nethttp-cheat-sheet-2940.html
https://github.com/augustl/net-http-cheat-sheet
No comments:
Post a Comment