Class: MyExperimentREST::MyExperimentWorkflow
- Inherits:
-
Object
- Object
- MyExperimentREST::MyExperimentWorkflow
- Defined in:
- lib/myexperiment-rest/workflow.rb
Overview
Contains all available information about a workflow: content_uri, title, description,inputs, outputs and uploader_uri.
Instance Attribute Summary collapse
-
#content_uri ⇒ Object
readonly
Returns the value of attribute content_uri.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#outputs ⇒ Object
readonly
Returns the value of attribute outputs.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#uploader_uri ⇒ Object
readonly
Returns the value of attribute uploader_uri.
Class Method Summary collapse
-
.parse(xml) ⇒ Object
Parse workflow information XML and instantiate a MyExperimentWorkflow object.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ MyExperimentWorkflow
constructor
A new instance of MyExperimentWorkflow.
Constructor Details
#initialize(attributes) ⇒ MyExperimentWorkflow
Returns a new instance of MyExperimentWorkflow.
59 60 61 62 63 64 65 66 |
# File 'lib/myexperiment-rest/workflow.rb', line 59 def initialize(attributes) @content_uri = attributes[:content_uri] @title = attributes[:title] @description = attributes[:description] @inputs = attributes[:inputs] @outputs = attributes[:outputs] @uploader_uri = attributes[:uploader_uri] end |
Instance Attribute Details
#content_uri ⇒ Object (readonly)
Returns the value of attribute content_uri.
57 58 59 |
# File 'lib/myexperiment-rest/workflow.rb', line 57 def content_uri @content_uri end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
57 58 59 |
# File 'lib/myexperiment-rest/workflow.rb', line 57 def description @description end |
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
57 58 59 |
# File 'lib/myexperiment-rest/workflow.rb', line 57 def inputs @inputs end |
#outputs ⇒ Object (readonly)
Returns the value of attribute outputs.
57 58 59 |
# File 'lib/myexperiment-rest/workflow.rb', line 57 def outputs @outputs end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
57 58 59 |
# File 'lib/myexperiment-rest/workflow.rb', line 57 def title @title end |
#uploader_uri ⇒ Object (readonly)
Returns the value of attribute uploader_uri.
57 58 59 |
# File 'lib/myexperiment-rest/workflow.rb', line 57 def uploader_uri @uploader_uri end |
Class Method Details
.parse(xml) ⇒ Object
Parse workflow information XML and instantiate a MyExperimentWorkflow object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/myexperiment-rest/workflow.rb', line 69 def self.parse(xml) wkf_inputs = [] wkf_outputs = [] doc = LibXML::XML::Document.string(xml) doc.find("//workflow/components/dataflows/dataflow[@role='top']/sources/source").each do |element| wkf_inputs << MyExperimentIOData.from_xml(element) end doc.find("//workflow/components/dataflows/dataflow[@role='top']/sinks/sink").each do |element| wkf_outputs << MyExperimentIOData.from_xml(element) end new(:content_uri => doc.find_first("/workflow/content-uri").content, :title => doc.find_first("/workflow/title").content, :description => doc.find_first("/workflow/description").content, :inputs => wkf_inputs, :outputs => wkf_outputs, :uploader_uri => doc.find_first("/workflow/uploader").attributes['uri']) end |