I poked around in the client code and found a couple of options.
First, you can create an API client that will make all requests without an access token. The constructor is probably a bit more aggressive than it should be about specifying a default. To work around this you can nil out the authentication method after you've created the client. Your code will look like this:
require 'rubygems'
require 'google/api_client'
require 'httpadapter/adapters/net_http'
@client = Google::APIClient.new(
:key => 'SOME_KEY',
:host => 'www.googleapis.com',
:http_adapter => HTTPAdapter::NetHTTPAdapter.new,
:pretty_print => false
)
@client.authorization = nil
@plus = @client.discovered_api('plus', 'v1')
status, headers, body = @client.execute(
@plus.people.list_by_activity,
'activityId' => 'z12nspyxxufislit423eex442zqpdtqnk',
'collection' => 'plusoners',
'maxResults' => '100'
)
public_activity = JSON.parse(body[0])
Alternatively, you can override the authentication method on a per-request basis. You were pretty close to this one! You had the correct option, you just need to pass it in as the final argument like this:
require 'rubygems'
require 'google/api_client'
require 'httpadapter/adapters/net_http'
@client = Google::APIClient.new(
:key => 'SOME_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}
)
puts status
puts body
public_activity = JSON.parse(body[0])
Thanks to Allen for bringing this one to my attention on Google+ :)