Jesús Gabriel y Galán said:
A simple google search for "ruby https net http" yields:
http://snippets.dzone.com/posts/show/788
maybe you can start from here and make some tests.
Or show us what you have tried and what are the errors?
Jesus.
First I will include my code and then 2 responses.
require 'net/http'
require 'net/https'
require 'rubygems'
require 'oauth'
oauth_consumer_key = "xxx"
oauth_consumer_secret = "yyy"
@consumer = OAuth::Consumer.new(oauth_consumer_key,
oauth_consumer_secret, {:site => "
http://openapi.etsy.com",

auth_callback => "oob", :request_token_path =>
"/v2/sandbox/oauth/request_token", :authorize_path =>
"/v2/sandbox/oauth/authorize", :access_token_path =>
"/v2/sandbox/oauth/access_token" })
@request_token = @consumer.get_request_token
http = Net::HTTP.new('etsy.com', 443)
http.use_ssl = true
path =
"oauth/signin?oauth_consumer_key=#{oauth_consumer_key}&oauth_token=#{@request_token.token}"
resp = http.get(path)
puts 'Code = ' + resp.code
puts 'Message = ' + resp.message
resp.each {|key, val| puts key + ' = ' + val}
# done
Here is the response the code yielded:
$ ruby sec.rb
warning: peer certificate won't be verified in this SSL session
Code = 301
Message = Moved Permanently
location =
http://www.etsy.com/oauth/signin?oauth_consumer_key=xxx&oauth_token=yyy
expires = Thu, 19 Nov 1981 08:52:00 GMT
connection = close
content-type = text/html; charset=UTF-8
server = Apache
date = Wed, 08 Sep 2010 12:43:15 GMT
content-length = 0
cache-control = no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
pragma = no-cache
###########################################################
I then used the same code except I changed the path variable to include
the 'https'
path =
"
https://oauth/signin?oauth_consumer_key=#{oauth_consumer_key}&oauth_token=#{@request_token.token}"
Then I received this response:
$ ruby sec.rb
warning: peer certificate won't be verified in this SSL session
Code = 302
Message = Found
location =
http://etsy.comhttps://etsy.com/oauth/signin?oauth_consumer_key=xxx&oauth_token=yyy
connection = close
server = BigIP
content-length = 0
#end
In the second response the location is weird. It did however produce a
"302".
In the first response the location says: HTTP, but the url should be
HTTPS