Minh Triet
Minh Triet

Reputation: 1250

How to use the result of Custom Search API of Google API Ruby Client

I have this piece of code

require 'google/api_client'
require 'google/api_client/client_secrets'
require 'google/api_client/auth/installed_app'

search_client = Google::APIClient.new(
  :application_name => 'Application'
)

google_search = search_client.discovered_api('customsearch')

# Load client secrets from your client_secrets.json.
client_secrets = Google::APIClient::ClientSecrets.load   

search_client.authorization = nil

response = search_client.execute(google_search.cse.list, 'q' => 'query')

After I load that file in IRB, I got the result like

#<Google::APIClient::Result:0xad56844>
=> true

How can I use that result, like parse it to something meaningful?

Upvotes: 0

Views: 87

Answers (1)

Nir Alfasi
Nir Alfasi

Reputation: 53535

Add after the last line:

status, headers, body = response

Upvotes: 1

Related Questions