Class: IbmPowerHmc::JobResponse

Inherits:
AbstractRest show all
Defined in:
lib/ibm_power_hmc/schema/job.rb

Overview

Job Response

Constant Summary collapse

ATTRS =
{
  :id => "JobID",
  :status => "Status",
  :message => "ResponseException/Message",
  :target_uuid => "TargetUuid",
  :linear_progress => "Progress/LinearProgress"
}.freeze

Instance Attribute Summary

Attributes inherited from AbstractRest

#content_type, #etag, #href, #published, #uuid

Attributes inherited from AbstractNonRest

#xml

Instance Method Summary collapse

Methods inherited from AbstractRest

#initialize, #to_s

Methods inherited from AbstractNonRest

#collection_of, #create_element, #initialize, marshal, #marshal, #singleton, #timestamp, #to_s, #uuid_from_href, #uuids_from_links

Constructor Details

This class inherits a constructor from IbmPowerHmc::AbstractRest

Instance Method Details

#completed_atObject



69
70
71
# File 'lib/ibm_power_hmc/schema/job.rb', line 69

def completed_at
  timestamp("TimeCompleted")
end

#requestObject



60
61
62
63
# File 'lib/ibm_power_hmc/schema/job.rb', line 60

def request
  elem = xml.elements["JobRequestInstance"]
  JobRequest.new(elem) unless elem.nil?
end

#resultsObject



73
74
75
76
77
78
79
80
81
# File 'lib/ibm_power_hmc/schema/job.rb', line 73

def results
  results = {}
  xml.each_element("Results/JobParameter") do |jobparam|
    name = jobparam.elements["ParameterName"]&.text&.strip
    value = jobparam.elements["ParameterValue"]&.text&.strip
    results[name] = value unless name.nil?
  end
  results
end

#started_atObject



65
66
67
# File 'lib/ibm_power_hmc/schema/job.rb', line 65

def started_at
  timestamp("TimeStarted")
end

#urlObject



56
57
58
# File 'lib/ibm_power_hmc/schema/job.rb', line 56

def url
  singleton("RequestURL", "href")
end