Class: Lt::Google::Api::Auth::Cli
- Inherits:
-
Object
- Object
- Lt::Google::Api::Auth::Cli
- Defined in:
- lib/lt/google/api/auth/cli.rb
Constant Summary collapse
- CONFIG_SECRET_FILE =
Rails.root.join('config', 'google', 'client_secret.json')
- CONFIG_TOKEN_FILE =
Rails.root.join('config', 'google', 'app_token.yaml')
- SCOPE =
%w(https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/documents).freeze
- USER_ID =
'default'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.authorizer ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/lt/google/api/auth/cli.rb', line 16 def self. @authorizer ||= begin client_id = ::Google::Auth::ClientId.from_file(CONFIG_SECRET_FILE) token_store = ::Google::Auth::Stores::FileTokenStore.new(file: CONFIG_TOKEN_FILE) ::Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store) end end |
Instance Method Details
#authorizer ⇒ Object
24 25 26 |
# File 'lib/lt/google/api/auth/cli.rb', line 24 def self.class. end |
#credentials ⇒ Object
28 29 30 |
# File 'lib/lt/google/api/auth/cli.rb', line 28 def credentials @credentials ||= .get_credentials(USER_ID) end |