Class: Bloc::Command::Authenticate

Inherits:
Object
  • Object
show all
Defined in:
lib/bloc/command/authenticate.rb

Constant Summary collapse

CREDENTIALS_PATH =
File.join(ENV["HOME"], ".bloc", "credentials.json")

Class Method Summary collapse

Class Method Details

.loginObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bloc/command/authenticate.rb', line 11

def self.
  print "Email: "
  email = $stdin.gets.chomp

  print "Password: "
  system "stty -echo"
  password = $stdin.gets.chomp
  system "stty echo"

  print "\n"

  client = Bloc::Client.new

  begin
    credentials = client.authenticate(:email => email, :password => password)
    write_credentials(credentials)
    puts "saved your credentials".green
  rescue
    puts "invalid email or password".red
  end
end

.run(*args) ⇒ Object



7
8
9
# File 'lib/bloc/command/authenticate.rb', line 7

def self.run(*args)
  
end