Class: WfsRails::WorkflowParser

Inherits:
Object
  • Object
show all
Defined in:
lib/wfs_rails/workflow_parser.rb

Overview

Parsing Workflow creation request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_body, druid, repository) ⇒ WorkflowParser

Returns a new instance of WorkflowParser.

Parameters:

  • request_body (String)
  • druid (String)
  • repository (String)


11
12
13
14
15
# File 'lib/wfs_rails/workflow_parser.rb', line 11

def initialize(request_body, druid, repository)
  @xml_request = Nokogiri::XML(request_body)
  @druid = druid
  @repository = repository
end

Instance Attribute Details

#druidObject (readonly)

Returns the value of attribute druid.



5
6
7
# File 'lib/wfs_rails/workflow_parser.rb', line 5

def druid
  @druid
end

#repositoryObject (readonly)

Returns the value of attribute repository.



5
6
7
# File 'lib/wfs_rails/workflow_parser.rb', line 5

def repository
  @repository
end

#xml_requestObject (readonly)

Returns the value of attribute xml_request.



5
6
7
# File 'lib/wfs_rails/workflow_parser.rb', line 5

def xml_request
  @xml_request
end

Instance Method Details

#create_workflowsArray

Returns:

  • (Array)


19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/wfs_rails/workflow_parser.rb', line 19

def create_workflows
  processes.map do |process|
    Workflow.create(datastream: workflow_id,
                    druid: druid,
                    process: process.name,
                    status: process.status,
                    lane_id: process.lane_id,
                    repository: repository,
                    lifecycle: process.lifecycle
                   )
  end
end