我想使用google ruby API 客户端执行与此 API 资源管理器调用等效的操作。
那应该很简单:
require 'rubygems'
require 'google/api_client'
require 'httpadapter/adapters/net_http'
@client = Google::APIClient.new(
:key => MY_SIMPLE_API_SERVER_KEY,
:host => 'www.googleapis.com',
:http_adapter => HTTPAdapter::NetHTTPAdapter.new,
:pretty_print => false
)
@plus = @client.discovered_api('plus', 'v1')
status, headers, body = @client.execute(
@plus.people.list_by_activity,
'activityId' => 'z12nspyxxufislit423eex442zqpdtqnk',
'collection' => 'plusoners',
'maxResults' => '100',
'authenticated' => 'false'
)
public_activity = JSON.parse(body[0])
但是,该execute
调用导致ArgumentError: Missing access token.
我不想让用户登录;我只想访问公共数据。我该怎么做呢?