Class: Weekdone::Cli::Credential

Inherits:
Object
  • Object
show all
Defined in:
lib/weekdone/cli/credential.rb

Class Method Summary collapse

Class Method Details

.read_credentialObject



3
4
5
6
7
8
9
# File 'lib/weekdone/cli/credential.rb', line 3

def self.read_credential
  File.open(ENV['HOME'] + "/.weekdone/credentials", "r") do |f|
    @credential = JSON.parse(f.gets)
  end

  @credential
end

.write_credential(token_hash) ⇒ Object



11
12
13
14
15
# File 'lib/weekdone/cli/credential.rb', line 11

def self.write_credential(token_hash)
  File.open(ENV['HOME'] + "/.weekdone/credentials", "w") do |f|
    f.write(token_hash.to_json)
  end
end