lib/redfish_client/root.rb in redfish_client-0.2.0 vs lib/redfish_client/root.rb in redfish_client-0.2.1

- old
+ new

@@ -1,8 +1,9 @@ # frozen_string_literal: true require "base64" +require "json" require "redfish_client/resource" module RedfishClient # Root resource represents toplevel entry point into Redfish service data. # Its main purpose is to provide authentication support for the API. @@ -55,11 +56,12 @@ def session_login_available? !@content.dig("Links", "Sessions").nil? end def session_login(username, password) - r = self.Links.Sessions.post( - payload: { "UserName" => username, "Password" => password } + r = @connector.post( + @content["Links"]["Sessions"]["@odata.id"], + { "UserName" => username, "Password" => password }.to_json ) raise AuthError, "Invalid credentials" unless r.status == 201 session_logout