Module: Lexdrill::AuthMode
- Defined in:
- lib/lexdrill/auth_mode.rb
Overview
Global "how to authenticate to Google Sheets" choice: "remote" (service
account, no interactive sign-in) or "oauth" (personal Google login).
Independent of which workbook is active — see Lexdrill::Workbooks for
that. Set via drill remote / drill oauth (no arguments).
Constant Summary collapse
- PATH =
Lexdrill::Config.path("auth-mode")
- REMOTE =
"remote"- OAUTH =
"oauth"- VALID =
[REMOTE, OAUTH].freeze
Class Method Summary collapse
Class Method Details
.current ⇒ Object
17 18 19 20 21 22 |
# File 'lib/lexdrill/auth_mode.rb', line 17 def self.current return nil unless File.exist?(PATH) value = File.read(PATH).strip VALID.include?(value) ? value : nil end |
.set(mode) ⇒ Object
13 14 15 |
# File 'lib/lexdrill/auth_mode.rb', line 13 def self.set(mode) File.write(PATH, mode) end |