Class: ElasticDot::Command::Auth

Inherits:
Base
  • Object
show all
Defined in:
lib/elasticdot/command/auth.rb

Class Method Summary collapse

Class Method Details

.authenticate!Object



34
35
36
37
# File 'lib/elasticdot/command/auth.rb', line 34

def self.authenticate!
  return true if authenticated?
  
end

.credentialsObject



39
40
41
# File 'lib/elasticdot/command/auth.rb', line 39

def self.credentials
  netrc['j.elasticops.com']
end

.loginObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/elasticdot/command/auth.rb', line 4

def self.
  puts "Enter your ElasticDot credentials."

  print "email: "
  email = ask

  print "password: "

  echo_off
  pass = ask_for_password
  echo_on

  api = ElasticDot::API.new(email: email, password: pass)
  key = api.

  netrc.delete 'j.elasticops.com'

  netrc['j.elasticops.com'] = email, key
  netrc.save

  true
end

.logoutObject



27
28
29
30
31
32
# File 'lib/elasticdot/command/auth.rb', line 27

def self.logout
  netrc.delete 'j.elasticops.com'
  netrc.save

  true
end