I am trying to simply send a request to google's hosted model sample.sentiment. I cannot figure out how to authorize with Oauth 2.0 via google, and I am getting endless amounts of hours. If you could provide me the code to this is would be helpful. Here is what I am working off of.
client = Google::APIClient.new({:application_name => "CCE",:application_version => "1.0"} )
plus = client.discovered_api('prediction')
# Initialize OAuth 2.0 client
client.authorization.client_id = 'my client id'
client.authorization.client_secret = 'my client secret'
client.authorization.redirect_uri = 'my callback url'
client.authorization.scope = 'https://www.googleapis.com/auth/prediction'
# Request authorization
redirect_uri = client.authorization.authorization_uri
# Wait for authorization code then exchange for token
client.authorization.code = '....'
client.authorization.fetch_access_token!
# Make an API call
result = client.execute(
:api_method => plus.activities.list,
:parameters => {'hostedModelName' => 'sample.sentiment', 'userId' => ''})
`