Module: Fog::Nirvanix
- Extended by:
- Provider
- Defined in:
- lib/fog/nirvanix.rb
Defined Under Namespace
Modules: Errors
Class Method Summary collapse
Methods included from Provider
[], extended, service, services
Class Method Details
.authenticate(options, connection_options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fog/nirvanix.rb', line 18 def self.authenticate(, = {}) nirvanix_auth_url = [:nirvanix_url] url = nirvanix_auth_url.match(/^https?:/) ? \ nirvanix_auth_url : 'https://' + nirvanix_auth_url uri = URI.parse(url) connection = Fog::Connection.new(url, false, ) authentication_params = { 'appKey' => [:nirvanix_app_key], 'userName' => [:nirvanix_username], 'password' => [:nirvanix_password] } response = connection.request({ :expects => [200], :host => uri.host, :path => "/ws/Authentication/Login.ashx", :query => authentication_params, :parser => Fog::ToHashDocument.new, :method => 'GET' }) response.body[:SessionToken] end |