Google + moments not visible on user's feed using google_api_client gem

醉酒当歌 提交于 2019-12-25 01:55:59

问题


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.


回答1:


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.

Manage app activities in Google

To find where moments are visible, view the profile about page and look for the "Apps with Google+ Sign-in" section.



来源:https://stackoverflow.com/questions/28273766/google-moments-not-visible-on-users-feed-using-google-api-client-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!