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

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/workflow/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.



8
9
10
# File 'lib/dor/workflow/response/workflows.rb', line 8

def initialize(xml:)
  @xml = xml
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml.



22
23
24
# File 'lib/dor/workflow/response/workflows.rb', line 22

def xml
  @xml
end

Instance Method Details

#pidObject



12
13
14
# File 'lib/dor/workflow/response/workflows.rb', line 12

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

#workflowsObject



16
17
18
19
20
# File 'lib/dor/workflow/response/workflows.rb', line 16

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