Class: AuthenticationController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/authentication_controller.rb

Instance Method Summary collapse

Instance Method Details

#loginObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/authentication_controller.rb', line 8

def 
#    username = console.ask "username: "
 #   password = console.ask_passord "password:"
  uri = URI('https://identity.api.rackspacecloud.com/v2.0/tokens')
  req = Net::HTTP::Post.new(uri)
  req['Content-Type'] = 'application/json'
  req.body = {auth: {passwordCredentials: {username: username, password: password}}}.to_json
  res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |https|
    https.request req
  end
  Map(JSON.parse res.body)

end

#logoutObject



22
23
24
# File 'app/controllers/authentication_controller.rb', line 22

def logout
  Object.new
end