Class: RedfishTools::Server
- Inherits:
-
WEBrick::HTTPServer
- Object
- WEBrick::HTTPServer
- RedfishTools::Server
- Defined in:
- lib/redfish_tools/server.rb
Instance Attribute Summary collapse
-
#datastore ⇒ Object
readonly
Returns the value of attribute datastore.
-
#login_path ⇒ Object
readonly
Returns the value of attribute login_path.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #basic_auth_header ⇒ Object
-
#initialize(datastore, username, password, config = {}) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(datastore, username, password, config = {}) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/redfish_tools/server.rb', line 12 def initialize(datastore, username, password, config = {}) super(config) @datastore = datastore root = datastore.get("/redfish/v1").body @login_path = root.dig("Links", "Sessions", "@odata.id")&.chomp("/") @username = username @password = password mount("/", Servlet) end |
Instance Attribute Details
#datastore ⇒ Object (readonly)
Returns the value of attribute datastore.
24 25 26 |
# File 'lib/redfish_tools/server.rb', line 24 def datastore @datastore end |
#login_path ⇒ Object (readonly)
Returns the value of attribute login_path.
24 25 26 |
# File 'lib/redfish_tools/server.rb', line 24 def login_path @login_path end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
24 25 26 |
# File 'lib/redfish_tools/server.rb', line 24 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
24 25 26 |
# File 'lib/redfish_tools/server.rb', line 24 def username @username end |
Instance Method Details
#basic_auth_header ⇒ Object
26 27 28 29 |
# File 'lib/redfish_tools/server.rb', line 26 def basic_auth_header @basic_auth_header ||= "Basic " + Base64.strict_encode64("#{username}:#{password}") end |