Class: Conoha::Config
- Inherits:
-
Object
- Object
- Conoha::Config
- Defined in:
- lib/conoha/config.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#authtoken ⇒ Object
Returns the value of attribute authtoken.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
-
#tenant_id ⇒ Object
readonly
Returns the value of attribute tenant_id.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
Instance Attribute Details
#authtoken ⇒ Object
Returns the value of attribute authtoken.
5 6 7 |
# File 'lib/conoha/config.rb', line 5 def authtoken @authtoken end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/conoha/config.rb', line 5 def password @password end |
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
5 6 7 |
# File 'lib/conoha/config.rb', line 5 def public_key @public_key end |
#tenant_id ⇒ Object (readonly)
Returns the value of attribute tenant_id.
5 6 7 |
# File 'lib/conoha/config.rb', line 5 def tenant_id @tenant_id end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/conoha/config.rb', line 5 def username @username end |
Instance Method Details
#load_from_json!(json_str) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/conoha/config.rb', line 15 def load_from_json!(json_str) parsed = JSON.parse json_str raise Error.new unless parsed.is_a? Hash @username = parsed["username"] @password = parsed["password"] @tenant_id = parsed["tenant_id"] @public_key = parsed["public_key"] @authtoken = parsed["authtoken"] end |
#load_from_yaml!(yaml_str) ⇒ Object
10 11 12 13 |
# File 'lib/conoha/config.rb', line 10 def load_from_yaml!(yaml_str) loaded = YAML.load yaml_str raise Error.new unless loaded.is_a? Hash end |