oauth2 gemがオブジェクト内のvariabelを渡す方法に問題があるようです。そのため、modeとparam_nameは途中で失われるようです。この問題の解決策は、省略形を使用する代わりに、正しいパラメーターを使用して新しいAccessTokenオブジェクトを作成することです。この例はFoursquaresAPIに対してテストされており、機能します。
require "oauth2"
client = OAuth2::Client.new(
"CLIENT_ID",
"CLIENT_SECRET",
:authorize_url => "/oauth2/authorize",
:token_url => "/oauth2/access_token",
:site => "https://foursquare.com/"
)
puts client.auth_code.authorize_url(:redirect_uri => "http://localhost:4000")
code = gets.chomp
token = client.auth_code.get_token(code, :redirect_uri => "http://localhost:4000")
token = OAuth2::AccessToken.new(client, token.token, {
:mode => :query,
:param_name => "oauth_token",
})
response = token.get('https://api.foursquare.com/v2/users/self/checkins')
puts response.body