Simple code
require 'net/http'
url = URI.parse('get json/other data here [link]')
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res.body
Just wondering how to put the authentication token in php cURL, I do it like
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer xxx'));
I wonder how to do this for Ruby.
source
share