Class: VagrantPlugins::Skytap::API::Credentials
- Defined in:
- lib/vagrant-skytap/api/credentials.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#vm ⇒ Object
readonly
Returns the value of attribute vm.
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(attrs, vm, env) ⇒ Credentials
constructor
A new instance of Credentials.
-
#recognized? ⇒ Boolean
Are the credentials in a form that we recognize?.
- #to_s ⇒ Object
Methods inherited from Resource
#delete, #refresh, #reload, rest_name, short_name, #update, #url
Methods included from SpecifiedAttributes
Constructor Details
#initialize(attrs, vm, env) ⇒ Credentials
Returns a new instance of Credentials.
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 35 def initialize(attrs, vm, env) super @vm = vm # Set username and password if we recognize them in the form # "uname / pw." uname, pw = text.split('/', 2).collect(&:strip) if uname && pw @username = uname @password = pw end end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
31 32 33 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 31 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
31 32 33 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 31 def username @username end |
#vm ⇒ Object (readonly)
Returns the value of attribute vm.
30 31 32 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 30 def vm @vm end |
Instance Method Details
#recognized? ⇒ Boolean
Are the credentials in a form that we recognize?
49 50 51 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 49 def recognized? !!(@username && @password) end |
#to_s ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/vagrant-skytap/api/credentials.rb', line 53 def to_s if recognized? "#{username} / #{password}" else text end end |