Class: ManageIQ::API::Client::Authentication
- Inherits:
-
Object
- Object
- ManageIQ::API::Client::Authentication
- Includes:
- CustomInspectMixin
- Defined in:
- lib/manageiq/api/client/authentication.rb
Constant Summary collapse
- DEFAULTS =
{ :user => "admin", :password => "smartvm" }.freeze
- CUSTOM_INSPECT_EXCLUSIONS =
%i[@password @token @miqtoken @bearer_token].freeze
Instance Attribute Summary collapse
-
#bearer_token ⇒ Object
readonly
Returns the value of attribute bearer_token.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#miqtoken ⇒ Object
readonly
Returns the value of attribute miqtoken.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Authentication
constructor
A new instance of Authentication.
Methods included from CustomInspectMixin
#inspect, #pretty_print, #pretty_print_instance_variables
Constructor Details
#initialize(options = {}) ⇒ Authentication
Returns a new instance of Authentication.
20 21 22 23 24 25 26 27 |
# File 'lib/manageiq/api/client/authentication.rb', line 20 def initialize( = {}) @user, @password = fetch_credentials() @token, @miqtoken, @bearer_token, @group = .values_at(:token, :miqtoken, :bearer_token, :group) unless token || miqtoken || bearer_token raise "Must specify both a user and a password" if user.blank? || password.blank? end end |
Instance Attribute Details
#bearer_token ⇒ Object (readonly)
Returns the value of attribute bearer_token.
9 10 11 |
# File 'lib/manageiq/api/client/authentication.rb', line 9 def bearer_token @bearer_token end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
10 11 12 |
# File 'lib/manageiq/api/client/authentication.rb', line 10 def group @group end |
#miqtoken ⇒ Object (readonly)
Returns the value of attribute miqtoken.
8 9 10 |
# File 'lib/manageiq/api/client/authentication.rb', line 8 def miqtoken @miqtoken end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/manageiq/api/client/authentication.rb', line 6 def password @password end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/manageiq/api/client/authentication.rb', line 7 def token @token end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/manageiq/api/client/authentication.rb', line 5 def user @user end |
Class Method Details
.auth_options_specified?(options) ⇒ Boolean
29 30 31 |
# File 'lib/manageiq/api/client/authentication.rb', line 29 def self.() .slice(:user, :password, :token, :miqtoken, :bearer_token, :group).present? end |