Class: ElasticDot::Command::Auth
- 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? login end |
.credentials ⇒ Object
39 40 41 |
# File 'lib/elasticdot/command/auth.rb', line 39 def self.credentials netrc['j.elasticops.com'] end |
.login ⇒ Object
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.login 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.login netrc.delete 'j.elasticops.com' netrc['j.elasticops.com'] = email, key netrc.save true end |
.logout ⇒ Object
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 |