Class: GoogleRefresh::Token
- Inherits:
-
Object
- Object
- GoogleRefresh::Token
- Defined in:
- lib/google_refresh.rb
Constant Summary collapse
- ACCESS_TOKEN_FAILURE_MESSAGE =
'Failed to Retrieve Access Token'- ACCESS_TYPE =
'offline'- CONTENT_TYPE =
'application/x-www-form-urlencoded'- DEFAULT_SCOPE =
%w[profile email]
- GOOGLE_AUTHORIZE_URL =
'https://accounts.google.com/o/oauth2/auth'- GOOGLE_TOKEN_URL =
'https://accounts.google.com/o/oauth2/token'- GRANT_TYPE =
'refresh_token'- MISSING_CLIENT_ID_ERROR_MESSAGE =
'Missing Client Id'- MISSING_CLIENT_SECRET_ERROR_MESSAGE =
'Missing Client Secret'- MISSING_REFRESH_TOKEN_ERROR_MESSAGE =
'Missing Refresh Token'- OAUTH_TOKEN_FAILURE_MESSAGE =
'Failed to Retrieve Oauth Token'
Instance Method Summary collapse
-
#initialize(client_id, client_secret, redirect_uri, refresh_token, scope = nil) ⇒ Token
constructor
A new instance of Token.
- #retrieve_oauth2_token ⇒ Object
- #retrieve_string_token ⇒ Object
Constructor Details
#initialize(client_id, client_secret, redirect_uri, refresh_token, scope = nil) ⇒ Token
Returns a new instance of Token.
20 21 22 23 24 25 26 |
# File 'lib/google_refresh.rb', line 20 def initialize(client_id, client_secret, redirect_uri, refresh_token, scope=nil) @client_id = client_id @client_secret = client_secret @redirect_uri = redirect_uri @refresh_token = refresh_token @scope = scope || DEFAULT_SCOPE end |
Instance Method Details
#retrieve_oauth2_token ⇒ Object
33 34 35 36 37 38 |
# File 'lib/google_refresh.rb', line 33 def retrieve_oauth2_token ensure_credentials_are_present get_access_token create_outh2_client return_oauth2_token end |
#retrieve_string_token ⇒ Object
28 29 30 31 |
# File 'lib/google_refresh.rb', line 28 def retrieve_string_token ensure_credentials_are_present get_access_token end |