Method: GAAPI::Query#execute
- Defined in:
- lib/gaapi/query.rb
#execute ⇒ GAAPI::Response
Send the requested query to Google Analytics and return the response.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gaapi/query.rb', line 34 def execute uri = URI.parse("https://analyticsreporting.googleapis.com/v4/reports:batchGet") https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true # https.set_debug_output($stdout) request = Net::HTTP::Post.new(uri.request_uri, "Content-Type" => "application/json", "Authorization" => "Bearer #{access_token}") request.body = query.to_json Response.new(https.request(request)) end |