Class: SimpleGdrive::Authorizer

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_gdrive/authorizer.rb

Constant Summary collapse

OOB_URI =
'urn:ietf:wg:oauth:2.0:oob'.freeze
DEFAULT_USER_ID =
'default'.freeze
API_SCOPE =
[Google::Apis::DriveV3::AUTH_DRIVE].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



22
23
24
# File 'lib/simple_gdrive/authorizer.rb', line 22

def self.call
  new.call
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
# File 'lib/simple_gdrive/authorizer.rb', line 12

def call
  FileUtils.mkdir_p File.dirname(::SimpleGdrive.config.credential_file)

  credentials = user_authorizer.get_credentials(DEFAULT_USER_ID)
  # FIXME: rails?
  credentials = request_credentials if credentials.nil? && defined?(Rails::Console)

  credentials
end