Class: Dor::Workflow::Response::Workflows

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/models/response/workflows.rb

Overview

The response from asking the server about all workflows for an item

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml:) ⇒ Workflows

Returns a new instance of Workflows.



10
11
12
# File 'lib/dor/models/response/workflows.rb', line 10

def initialize(xml:)
  @xml = xml
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml.



24
25
26
# File 'lib/dor/models/response/workflows.rb', line 24

def xml
  @xml
end

Instance Method Details

#pidObject



14
15
16
# File 'lib/dor/models/response/workflows.rb', line 14

def pid
  ng_xml.at_xpath('/workflows/@objectId').text
end

#workflowsObject



18
19
20
21
22
# File 'lib/dor/models/response/workflows.rb', line 18

def workflows
  @workflows ||= ng_xml.xpath('/workflows/workflow').map do |node|
    Workflow.new(xml: node.to_xml)
  end
end