Class: Fog::Brightbox::Storage::AuthenticationRequest
- Inherits:
-
Object
- Object
- Fog::Brightbox::Storage::AuthenticationRequest
- Defined in:
- lib/fog/brightbox/storage/authentication_request.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#management_url ⇒ Object
Returns the value of attribute management_url.
-
#tenant ⇒ Object
Returns the value of attribute tenant.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #authenticate ⇒ Object
-
#initialize(config) ⇒ AuthenticationRequest
constructor
A new instance of AuthenticationRequest.
Constructor Details
#initialize(config) ⇒ AuthenticationRequest
Returns a new instance of AuthenticationRequest.
8 9 10 |
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 8 def initialize(config) @config = config end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 5 def access_token @access_token end |
#management_url ⇒ Object
Returns the value of attribute management_url.
5 6 7 |
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 5 def management_url @management_url end |
#tenant ⇒ Object
Returns the value of attribute tenant.
6 7 8 |
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 6 def tenant @tenant end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 6 def user @user end |
Instance Method Details
#authenticate ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 12 def authenticate response = authentication_request self.access_token = response.headers["X-Auth-Token"] self.management_url = response.headers["X-Server-Management-Url"] || response.headers["X-Storage-Url"] self rescue Excon::Errors::Unauthorized => error raise Fog::Brightbox::Storage::AuthenticationRequired.slurp(error) end |