使用google_api_client gem在用户的供稿中不显示Google +时刻 [英] Google + moments not visible on user's feed using google_api_client gem
问题描述
我正在尝试使用google api客户端发布到用户流,我正在使用下面提到的代码
I am trying to post to user's stream using google api client, I am using below mentioned code
require 'google/api_client'
require 'google/api_client/client_secrets'
require 'google/api_client/auth/installed_app'
client = Google::APIClient.new
client.authorization.client_id = CLIENT_ID
client.authorization.client_secret = CLIENT_SECRET
client.authorization.access_token = USER_ACCESS_TOKEN
plus = client.discovered_api('plus', 'v1')
moment = {
:type => 'http://schemas.google.com/AddActivity',
:target => { :id => Time.now.to_i.to_s,
:description => 'well this is it',
:name => 'Well this is it'
}
}
req_opts = { :api_method => plus.moments.insert,
:parameters => { :collection => 'vault', :userId => 'me', },
:body_object => moment
}
response = client.execute!(req_opts).body
执行上述代码后,我得到如下响应
After executing the above code I am getting the response as follow
{"kind"=>"plus#moment",
"type"=>"http://schemas.google.com/AddActivity",
"target"=>{"kind"=>"plus#itemScope", "id"=>"1422863753", "description"=>"well this is it", "name"=>"Well this is it"}}
但是当我转到用户的个人资料时,我无法在个人资料中的任何地方看到此活动.
But when I go to user's profile then I am not able to see this activity anywhere in profile.
推荐答案
注意:此刻方法不会直接写入用户的Google+流.它们而是写入用户的个人资料,并且不一定要被其他用户查看,具体取决于用户的首选共享设置.
Note: The moment methods do not write directly to a user's Google+ stream. They instead write to a user's profile, and are not necessarily viewable by others depending on the user's preferred sharing settings.
要查找可以看到的时刻,请查看有关页面的个人资料,然后查找具有Google+登录功能的应用"部分.
To find where moments are visible, view the profile about page and look for the "Apps with Google+ Sign-in" section.
这篇关于使用google_api_client gem在用户的供稿中不显示Google +时刻的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!