Class: AuthenticationController
- Inherits:
-
Object
- Object
- AuthenticationController
- Defined in:
- app/controllers/authentication_controller.rb
Instance Method Summary collapse
Instance Method Details
#login ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/authentication_controller.rb', line 8 def login # 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 |
#logout ⇒ Object
22 23 24 |
# File 'app/controllers/authentication_controller.rb', line 22 def logout Object.new end |