Sha256: 5585abe3eb85f4f2581037d4e3fa42612590440b2e5a33aa7045691796155d92

Contents?: true

Size: 636 Bytes

Versions: 15

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true

module Dor
  module Workflow
    module Response
      # The response from asking the server about all workflows for an item
      class Workflows
        def initialize(xml:)
          @xml = xml
        end

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

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

        attr_reader :xml

        private

        def ng_xml
          @ng_xml ||= Nokogiri::XML(@xml)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dor-workflow-client-3.15.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.14.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.13.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.12.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.11.1 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.11.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.10.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.9.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.8.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.7.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.6.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.5.0 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.4.2 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.4.1 lib/dor/workflow/response/workflows.rb
dor-workflow-client-3.4.0 lib/dor/workflow/response/workflows.rb