Class: Keyrod::FedcloudClient
- Inherits:
-
Object
- Object
- Keyrod::FedcloudClient
- Defined in:
- lib/keyrod/fedcloud_client.rb
Constant Summary collapse
- PROJECTS_PATH =
'/v3/auth/projects'.freeze
- SCOPED_PATH =
'/v3/auth/tokens'.freeze
- REDIRECT_HEADER =
'WWW-Authenticate'.freeze
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#auth_path ⇒ Object
readonly
Returns the value of attribute auth_path.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
-
#ssl ⇒ Object
readonly
Returns the value of attribute ssl.
Instance Method Summary collapse
-
#initialize ⇒ FedcloudClient
constructor
A new instance of FedcloudClient.
- #projects(unscoped_token) ⇒ Object
- #scoped_token(unscoped_token, project) ⇒ Object
- #unscoped_token ⇒ Object
Constructor Details
#initialize ⇒ FedcloudClient
Returns a new instance of FedcloudClient.
13 14 15 16 17 18 |
# File 'lib/keyrod/fedcloud_client.rb', line 13 def initialize @site = Keyrod::Settings[:site] @access_token = Keyrod::Settings[:'access-token'] @auth_path = "/v3/OS-FEDERATION/identity_providers/#{Keyrod::Settings[:'identity-provider']}/protocols/oidc/auth" @ssl = Keyrod::Settings[:ssl] end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
7 8 9 |
# File 'lib/keyrod/fedcloud_client.rb', line 7 def access_token @access_token end |
#auth_path ⇒ Object (readonly)
Returns the value of attribute auth_path.
7 8 9 |
# File 'lib/keyrod/fedcloud_client.rb', line 7 def auth_path @auth_path end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
7 8 9 |
# File 'lib/keyrod/fedcloud_client.rb', line 7 def site @site end |
#ssl ⇒ Object (readonly)
Returns the value of attribute ssl.
7 8 9 |
# File 'lib/keyrod/fedcloud_client.rb', line 7 def ssl @ssl end |
Instance Method Details
#projects(unscoped_token) ⇒ Object
25 26 27 28 |
# File 'lib/keyrod/fedcloud_client.rb', line 25 def projects(unscoped_token) response = handle_response(projects_params(unscoped_token), error_message: 'Response for getting list of projects was') parse_projects(response.body) end |
#scoped_token(unscoped_token, project) ⇒ Object
30 31 32 33 34 |
# File 'lib/keyrod/fedcloud_client.rb', line 30 def scoped_token(unscoped_token, project) response = handle_response(scoped_token_params, body: scoped_token_body(unscoped_token, project), error_message: 'Response for getting scoped token was') response.headers[:'X-Subject-Token'] end |
#unscoped_token ⇒ Object
20 21 22 23 |
# File 'lib/keyrod/fedcloud_client.rb', line 20 def unscoped_token response = handle_response(unscoped_token_params, error_message: 'Response for getting unscoped token was') response.headers[:'X-Subject-Token'] end |