Class: Proxmox::Application::Configuration
- Inherits:
-
Object
- Object
- Proxmox::Application::Configuration
- Defined in:
- lib/proxmox/configuration.rb
Instance Attribute Summary collapse
-
#base_path ⇒ Object
Returns the value of attribute base_path.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#password ⇒ Object
Returns the value of attribute password.
-
#realm ⇒ Object
Returns the value of attribute realm.
-
#username ⇒ Object
Returns the value of attribute username.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #credentials_params ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_from_hash(hash) ⇒ Object
- #load_from_path(path) ⇒ Object
- #ssl_options ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 13 14 15 |
# File 'lib/proxmox/configuration.rb', line 8 def initialize @endpoint = nil @base_path = nil @username = nil @password = nil @realm = nil @verbose = false end |
Instance Attribute Details
#base_path ⇒ Object
Returns the value of attribute base_path.
6 7 8 |
# File 'lib/proxmox/configuration.rb', line 6 def base_path @base_path end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/proxmox/configuration.rb', line 6 def endpoint @endpoint end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/proxmox/configuration.rb', line 6 def password @password end |
#realm ⇒ Object
Returns the value of attribute realm.
6 7 8 |
# File 'lib/proxmox/configuration.rb', line 6 def realm @realm end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/proxmox/configuration.rb', line 6 def username @username end |
#verbose ⇒ Object
Returns the value of attribute verbose.
6 7 8 |
# File 'lib/proxmox/configuration.rb', line 6 def verbose @verbose end |
Instance Method Details
#credentials_params ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/proxmox/configuration.rb', line 17 def credentials_params { username: @username, password: @password, realm: @realm } end |
#load_from_hash(hash) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/proxmox/configuration.rb', line 33 def load_from_hash(hash) raise InvalidConfiguration, 'Invalid configuration hash' if hash.empty? @endpoint = hash[:endpoint] @base_path = hash[:base_path] @username = hash[:username] @password = hash[:password] @realm = hash[:realm] end |
#load_from_path(path) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/proxmox/configuration.rb', line 43 def load_from_path(path) raise InvalidConfiguration, "no such file #{path}" unless File.exist?(path) hash = JSON.parse(File.read(path), symbolize_names: true) load_from_hash(hash) end |
#ssl_options ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/proxmox/configuration.rb', line 25 def { verify: false, verify_hostname: false, verify_mode: OpenSSL::SSL::VERIFY_NONE } end |