开发者

Ruby OAuth : display request header?

I'm using the ruby oauth gem for an xAuth implementation.

Here is the code I have so far (and it works):

require "RubyGems"
require "oauth"
require "json"
require 'active_support'

consumer = OAuth::Consumer.new(consumer_key,consumer_secret,:site=>site)

access_token = consumer.get_access_token(nil,{},{:x_auth_mode=>x_auth_mode,:x_auth_username=>x_auth_username,:x_auth_password=>x_auth_password,})

response = access_token.get("#{site}/service.json")
body = ActiveSupport::JSON.decode(response.body).inspect

I was wondering if there was any way of printing (via 'puts') what the access_token.get Request header looks like?

(i.e. the header in a request that looks like):

OAuth realm="", oauth_timestamp="1311358709", oauth_version="1.0", oauth_consumer_key="开发者_如何学Cx",oauth_signature="x%2B%2Bdjzy7mE%3D", oauth_token="x", oauth_nonce="7A3BFB3C-E25B-4FA1-B856-F7DF2AF38FA8", oauth_signature_method="HMAC-SHA1"

Is there some way I can turn on debugging to display this data in the gem file? (I'm using Mac OS)


You can do this through the rails console.

type bundle exec rails c in your terminal while you are located in your project directory

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜