Sha256: 5cdefb5214e920f895cbe826b4a2d8b597ccbcc4ce78c9938a14be4d3cd24d73

Contents?: true

Size: 712 Bytes

Versions: 6

Compression:

Stored size: 712 Bytes

Contents

require 'drive_env/version'
require 'googleauth'
require 'googleauth/stores/file_token_store'

module DriveEnv
  autoload :Cli,     'drive_env/cli'
  autoload :Config,  'drive_env/config'

  class << self
    def authorizer(client_id, client_secret, token_store_file)
      unless @authorizer
        client_id = Google::Auth::ClientId.new(client_id, client_secret)
        scope = %w[
          https://www.googleapis.com/auth/drive
          https://spreadsheets.google.com/feeds/
        ]
        token_store = Google::Auth::Stores::FileTokenStore.new(file: token_store_file)
        @authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store)
      end
      @authorizer
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
drive_env-0.3.1 lib/drive_env.rb
drive_env-0.3.0 lib/drive_env.rb
drive_env-0.2.2 lib/drive_env.rb
drive_env-0.2.1 lib/drive_env.rb
drive_env-0.2.0 lib/drive_env.rb
drive_env-0.2.pre1 lib/drive_env.rb