Class: TranslateClient::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/translate_client/credentials.rb

Instance Method Summary collapse

Instance Method Details

#auth_tokenObject



11
12
13
14
# File 'lib/translate_client/credentials.rb', line 11

def auth_token
  n = Netrc.read
  n[netrc_domain]&.password
end

#delete!Object



16
17
18
19
20
# File 'lib/translate_client/credentials.rb', line 16

def delete!
  n = Netrc.read
  n.delete(netrc_domain)
  n.save
end

#save!(email, auth_token) ⇒ Object



5
6
7
8
9
# File 'lib/translate_client/credentials.rb', line 5

def save!(email, auth_token)
  n = Netrc.read
  n[netrc_domain] = email, auth_token
  n.save
end