Class: Google::Authorization

Inherits:
Client
  • Object
show all
Defined in:
lib/gcal_unit/authorization.rb

Overview

Public: API methods to authorize a specific user for the API calls.

Instance Method Summary collapse

Methods inherited from Client

#http_delete, #http_get, #http_post, #http_put, #initialize

Constructor Details

This class inherits a constructor from Google::Client

Instance Method Details

#refreshObject

Public: Returns a new access token for a specific refresh token.

Returns a hash of metadata for refreshed user access.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gcal_unit/authorization.rb', line 10

def refresh
  options = {
    :body => {
      :client_id => Google.configuration.client_id,
      :client_secret => Google.configuration.client_secret,
      :refresh_token => @token,
      :grant_type => 'refresh_token'
    },
    :headers => {
      'Content-Type' => 'application/x-www-form-urlencoded'
    }
  }
  http_post "/o/oauth2/token", options
end