class Gleis::Token

This class manages the authentication token granted from the API server

Public Class Methods

check() click to toggle source
# File lib/gleis/token.rb, line 11
def self.check
  return File.read(Config::TOKEN_FILE) if File.exist?(Config::TOKEN_FILE)

  abort('Not authenticated, please login first.')
end
delete() click to toggle source
# File lib/gleis/token.rb, line 17
def self.delete
  File.delete(Config::TOKEN_FILE) if File.exist?(Config::TOKEN_FILE)
end
save(token) click to toggle source
# File lib/gleis/token.rb, line 4
def self.save(token)
  abort('No tokens received.') unless token
  f = File.new(Config::TOKEN_FILE, 'w', 0o0640)
  f.write(token)
  f.close
end