Class: PolyglotCli::IO::Token

Inherits:
Object
  • Object
show all
Extended by:
Helper::Terminal
Defined in:
lib/polyglot_cli/io/token.rb

Constant Summary collapse

AUTH_FILE_PATH =
"#{Dir.home}/.polyglot.auth".freeze

Class Method Summary collapse

Methods included from Helper::Terminal

prompt, success

Class Method Details

.readObject



14
15
16
17
# File 'lib/polyglot_cli/io/token.rb', line 14

def read
  prompt.say("Reading token from #{AUTH_FILE_PATH}")
  File.read(AUTH_FILE_PATH)
end

.write(token) ⇒ Object



9
10
11
12
# File 'lib/polyglot_cli/io/token.rb', line 9

def write(token)
  prompt.say("Writing token to #{AUTH_FILE_PATH}")
  File.open(AUTH_FILE_PATH, 'w') { |f| f.write(token) }
end