Ruby on rails Can';t拉动谷歌&x2B;具有RoR的API数据

Ruby on rails Can';t拉动谷歌&x2B;具有RoR的API数据,ruby-on-rails,ruby,google-plus,Ruby On Rails,Ruby,Google Plus,几个星期来我一直在处理这个问题,但我仍然没有找到解决办法。我的目标是 验证用户身份 拉取并显示他们的google+api数据 我曾尝试(未成功)改编google提供的google+ruby示例代码,但这对我来说并不正确。然而,我把它作为自己写作的基础。到目前为止,我有: 欢迎光临 class WelcomeController < ApplicationController def index require 'google/api_client' require 'google/ap

几个星期来我一直在处理这个问题,但我仍然没有找到解决办法。我的目标是

  • 验证用户身份
  • 拉取并显示他们的google+api数据
我曾尝试(未成功)改编google提供的google+ruby示例代码,但这对我来说并不正确。然而,我把它作为自己写作的基础。到目前为止,我有:

欢迎光临

class WelcomeController < ApplicationController
def index
require 'google/api_client'
require 'google/api_client/client_secrets'
require 'google/api_client/auth/installed_app'

$credentials = Google::APIClient::ClientSecrets.load

# Initialize the client.
$authorization = Signet::OAuth2::Client.new(
    :authorization_uri => $credentials.authorization_uri,
    :token_credential_uri => $credentials.token_credential_uri,
    :client_id => $credentials.client_id,
    :client_secret => $credentials.client_secret,
    :redirect_uri => $credentials.redirect_uris.first,
    :scope => 'https://www.googleapis.com/auth/plus.login')

@client = Google::APIClient.new(
    :application_name => 'X', #havent changed this at all
    :application_version => 'X' #havent changed this at all
    )

@client.authorization.update_token!(:access_token => 'X', :refresh_token => 'X')#havent changed this at all

# Initialize Google+ API. Note this will make a request to the
# discovery service every time, so be sure to use serialization
# in your production code. Check the samples for more details.
@plus = @client.discovered_api( "plus", "v1" )

# Make an API call.
@google_plus_info = @client.execute(
    :api_method => @plus.activities.list,
    :parameters => {'collection' => 'public', 'userId' => 'VALID USER ID HERE'} #I masked my own userid which I am using for testing
    )
render plain: "api call:\n#{@google_plus_info.data.title}"
end
end

因此,我假设显示标题值不会有问题。但是,我的输出为空(除了api调用:)我缺少什么?

您使用的是rails 4.1.x?是的,我使用的是rails 4.1.5。也在Chrome中测试,没有扩展。
{
"kind": "plus#activityFeed",
"etag": "\"BLAHBLAH\"",
"title": "Google+ List of Activities for Collection PUBLIC",
"updated": "2013-02-02T02:54:10.697Z",
....