myexperiment-rest 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,8 +1,21 @@
1
1
  = Changes log for the MyExperiment via REST Gem
2
2
 
3
+ == Version 0.3.0
4
+ * Added User class to acquire myExperiment's user resource
5
+ * Added a constants.rb file
6
+ * XML parsing of sub-objects is done on the specific elements now and not from the main doc
7
+ * REST call is outside the XML parsing objects
8
+ * Renamed populate_workflow with parse
9
+ * Added from_uri and other from_ methods to retrieve data
10
+ * Renamed TavernaWorkflow to MyExperimentWorkflow
11
+ * Added MyExperimentUser class
12
+ * Removed input_type -- it was unrelated to the library!
13
+
14
+
3
15
  == Version 0.2.8
4
16
  * Added user information for workflow
5
17
 
18
+
6
19
  == Version 0.2.7
7
20
  * Minor clean up of get_workflow_data.rb and documentation.
8
21
  * Added libxml-ruby dependency in gem specification.
data/README CHANGED
@@ -1,7 +1,7 @@
1
1
  = MyExperiment Interaction via REST
2
2
 
3
3
  Authors:: Konstantinos Karasavvas
4
- Gem Version:: 0.2.8
4
+ Gem Version:: 0.3.0
5
5
  Contact:: mailto:kostas.karasavvas@nbic.nl
6
6
  Licence:: MIT (See LICENCE or http://www.opensource.org/licenses/mit-license)
7
7
  Copyright:: (c) 2010 Netherlands Bioinformatics Centre, The Netherlands
@@ -14,13 +14,13 @@ This is a simple library to access data on myExperiment via its REST API.
14
14
 
15
15
  == Features/Problems
16
16
 
17
- Only a subset of myExperiment workflow data can be currently accessed.
17
+ Only a subset of myExperiment workflow and user data can be currently accessed.
18
18
 
19
19
 
20
20
  == Usage
21
21
 
22
22
  There is an example script inside the <tt>bin</tt> directory that demonstrates
23
- how you can use the library.
23
+ how you can use the library: $ get_workflow_data.rb.
24
24
 
25
25
 
26
26
  == Installation
data/Rakefile CHANGED
@@ -1,8 +1,3 @@
1
- #
2
- # To change this template, choose Tools | Templates
3
- # and open the template in the editor.
4
-
5
-
6
1
  require 'rubygems'
7
2
  require 'rake'
8
3
  require 'rake/clean'
@@ -12,10 +7,10 @@ require 'rdoc/task'
12
7
 
13
8
  spec = Gem::Specification.new do |s|
14
9
  s.name = 'myexperiment-rest'
15
- s.version = '0.2.8'
10
+ s.version = '0.3.0'
16
11
  s.extra_rdoc_files = ['README', 'LICENSE', 'CHANGES']
17
- s.summary = 'This is a simple library to access data on myExperiment via its REST API. Currently supports a subset of the workflow information available.'
18
- s.description = s.summary
12
+ s.summary = 'This is a simple library to access data on myExperiment via its REST API.'
13
+ s.description = 'This is a simple library to access data on myExperiment via its REST API. Currently supports a subset of the workflow information available.'
19
14
  s.author = 'Konstantinos Karasavvas'
20
15
  s.email = 'kostas.karasavvas@nbic.nl'
21
16
  s.executables = ['get_workflow_data.rb']
@@ -23,7 +18,7 @@ spec = Gem::Specification.new do |s|
23
18
  s.require_path = "lib"
24
19
  s.bindir = "bin"
25
20
  s.add_dependency 'rest-client', '~> 1.6.3'
26
- s.add_dependency 'libxml-ruby', '~> 2.0.5'
21
+ s.add_dependency 'libxml-ruby', '~> 2.0.9'
27
22
  end
28
23
 
29
24
  Gem::PackageTask.new(spec) do |p|
@@ -6,16 +6,17 @@ require "myexperiment-rest"
6
6
  include MyExperimentREST
7
7
 
8
8
  my_exp_workflow = ARGV[0] || "http://www.myexperiment.org/workflows/74/download/bioaid_proteindiscovery_221429.xml?version=3"
9
- wkf = Workflows.new.read(my_exp_workflow)
9
+ wkf = Workflow.from_uri(my_exp_workflow)
10
10
 
11
11
 
12
-
13
- puts wkf.input_type
12
+ # general
14
13
  puts wkf.xml_uri
15
14
  puts wkf.title
16
15
  puts wkf.description
16
+ puts wkf.uploader_uri
17
17
  puts "--------------------------"
18
18
 
19
+ # inputs
19
20
  wkf.inputs.each do |i|
20
21
  puts i.name
21
22
  i.descriptions.each do |d|
@@ -27,10 +28,27 @@ wkf.inputs.each do |i|
27
28
  puts "--------------------------"
28
29
  end
29
30
 
30
- puts wkf.user.name
31
- puts wkf.user.description
32
- puts wkf.user.email
33
- puts wkf.user.avatar
34
- puts wkf.user.website
35
- puts wkf.user.created_at
31
+ # outputs
32
+ wkf.outputs.each do |i|
33
+ puts i.name
34
+ i.descriptions.each do |d|
35
+ puts d
36
+ end
37
+ i.examples.each do |e|
38
+ puts e
39
+ end
40
+ puts "--------------------------"
41
+ end
42
+
43
+
44
+ user = User.from_uri(wkf.uploader_uri)
45
+ puts user.id
46
+ puts user.created_at
47
+ puts user.name
48
+ puts user.description
49
+ puts user.email
50
+ puts user.avatar_uri
51
+ puts user.city
52
+ puts user.country
53
+ puts user.website
36
54
 
@@ -66,13 +66,17 @@
66
66
 
67
67
  <li><a href="./MyExperimentREST.html">MyExperimentREST</a></li>
68
68
 
69
- <li><a href="./MyExperimentREST/TavernaIOData.html">MyExperimentREST::TavernaIOData</a></li>
69
+ <li><a href="./MyExperimentREST/MyExperimentIOData.html">MyExperimentREST::MyExperimentIOData</a></li>
70
70
 
71
- <li><a href="./MyExperimentREST/TavernaUser.html">MyExperimentREST::TavernaUser</a></li>
71
+ <li><a href="./MyExperimentREST/MyExperimentUser.html">MyExperimentREST::MyExperimentUser</a></li>
72
72
 
73
- <li><a href="./MyExperimentREST/TavernaWorkflow.html">MyExperimentREST::TavernaWorkflow</a></li>
73
+ <li><a href="./MyExperimentREST/MyExperimentWorkflow.html">MyExperimentREST::MyExperimentWorkflow</a></li>
74
74
 
75
- <li><a href="./MyExperimentREST/Workflows.html">MyExperimentREST::Workflows</a></li>
75
+ <li><a href="./MyExperimentREST/Urls.html">MyExperimentREST::Urls</a></li>
76
+
77
+ <li><a href="./MyExperimentREST/User.html">MyExperimentREST::User</a></li>
78
+
79
+ <li><a href="./MyExperimentREST/Workflow.html">MyExperimentREST::Workflow</a></li>
76
80
 
77
81
  </ul>
78
82
  <div id="no-class-search-results" style="display: none;">No matching classes.</div>
@@ -86,6 +90,28 @@
86
90
 
87
91
  <h1>Changes log for the MyExperiment via REST Gem</h1>
88
92
 
93
+ <h2>Version 0.3.0</h2>
94
+ <ul><li>
95
+ <p>Added User class to acquire myExperiment’s user resource</p>
96
+ </li><li>
97
+ <p>Added a constants.rb file</p>
98
+ </li><li>
99
+ <p>XML parsing of sub-objects is done on the specific elements now and not
100
+ from the main doc</p>
101
+ </li><li>
102
+ <p>REST call is outside the XML parsing objects</p>
103
+ </li><li>
104
+ <p>Renamed populate_workflow with parse</p>
105
+ </li><li>
106
+ <p>Added from_uri and other from_ methods to retrieve data</p>
107
+ </li><li>
108
+ <p>Renamed TavernaWorkflow to MyExperimentWorkflow</p>
109
+ </li><li>
110
+ <p>Added MyExperimentUser class</p>
111
+ </li><li>
112
+ <p>Removed input_type – it was unrelated to the library!</p>
113
+ </li></ul>
114
+
89
115
  <h2>Version 0.2.8</h2>
90
116
  <ul><li>
91
117
  <p>Added user information for workflow</p>
@@ -66,13 +66,17 @@
66
66
 
67
67
  <li><a href="./MyExperimentREST.html">MyExperimentREST</a></li>
68
68
 
69
- <li><a href="./MyExperimentREST/TavernaIOData.html">MyExperimentREST::TavernaIOData</a></li>
69
+ <li><a href="./MyExperimentREST/MyExperimentIOData.html">MyExperimentREST::MyExperimentIOData</a></li>
70
70
 
71
- <li><a href="./MyExperimentREST/TavernaUser.html">MyExperimentREST::TavernaUser</a></li>
71
+ <li><a href="./MyExperimentREST/MyExperimentUser.html">MyExperimentREST::MyExperimentUser</a></li>
72
72
 
73
- <li><a href="./MyExperimentREST/TavernaWorkflow.html">MyExperimentREST::TavernaWorkflow</a></li>
73
+ <li><a href="./MyExperimentREST/MyExperimentWorkflow.html">MyExperimentREST::MyExperimentWorkflow</a></li>
74
74
 
75
- <li><a href="./MyExperimentREST/Workflows.html">MyExperimentREST::Workflows</a></li>
75
+ <li><a href="./MyExperimentREST/Urls.html">MyExperimentREST::Urls</a></li>
76
+
77
+ <li><a href="./MyExperimentREST/User.html">MyExperimentREST::User</a></li>
78
+
79
+ <li><a href="./MyExperimentREST/Workflow.html">MyExperimentREST::Workflow</a></li>
76
80
 
77
81
  </ul>
78
82
  <div id="no-class-search-results" style="display: none;">No matching classes.</div>
@@ -37,8 +37,14 @@
37
37
  <li><a href="./lib/myexperiment-rest_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
38
  class="thickbox" title="lib/myexperiment-rest.rb">lib/myexperiment-rest.rb</a></li>
39
39
 
40
- <li><a href="./lib/myexperiment-rest/myexperiment_rest_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
41
- class="thickbox" title="lib/myexperiment-rest/myexperiment_rest.rb">lib/myexperiment-rest/myexperiment_rest.rb</a></li>
40
+ <li><a href="./lib/myexperiment-rest/workflow_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
41
+ class="thickbox" title="lib/myexperiment-rest/workflow.rb">lib/myexperiment-rest/workflow.rb</a></li>
42
+
43
+ <li><a href="./lib/myexperiment-rest/user_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
44
+ class="thickbox" title="lib/myexperiment-rest/user.rb">lib/myexperiment-rest/user.rb</a></li>
45
+
46
+ <li><a href="./lib/myexperiment-rest/constants_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
47
+ class="thickbox" title="lib/myexperiment-rest/constants.rb">lib/myexperiment-rest/constants.rb</a></li>
42
48
 
43
49
  </ul>
44
50
  </div>
@@ -58,19 +64,33 @@
58
64
  <h3 class="section-header">Namespace</h3>
59
65
  <ul class="link-list">
60
66
 
61
- <li><span class="type">CLASS</span> <a href="MyExperimentREST/TavernaIOData.html">MyExperimentREST::TavernaIOData</a></li>
67
+ <li><span class="type">MODULE</span> <a href="MyExperimentREST/Urls.html">MyExperimentREST::Urls</a></li>
68
+
69
+ <li><span class="type">CLASS</span> <a href="MyExperimentREST/MyExperimentIOData.html">MyExperimentREST::MyExperimentIOData</a></li>
70
+
71
+ <li><span class="type">CLASS</span> <a href="MyExperimentREST/MyExperimentUser.html">MyExperimentREST::MyExperimentUser</a></li>
62
72
 
63
- <li><span class="type">CLASS</span> <a href="MyExperimentREST/TavernaUser.html">MyExperimentREST::TavernaUser</a></li>
73
+ <li><span class="type">CLASS</span> <a href="MyExperimentREST/MyExperimentWorkflow.html">MyExperimentREST::MyExperimentWorkflow</a></li>
64
74
 
65
- <li><span class="type">CLASS</span> <a href="MyExperimentREST/TavernaWorkflow.html">MyExperimentREST::TavernaWorkflow</a></li>
75
+ <li><span class="type">CLASS</span> <a href="MyExperimentREST/User.html">MyExperimentREST::User</a></li>
66
76
 
67
- <li><span class="type">CLASS</span> <a href="MyExperimentREST/Workflows.html">MyExperimentREST::Workflows</a></li>
77
+ <li><span class="type">CLASS</span> <a href="MyExperimentREST/Workflow.html">MyExperimentREST::Workflow</a></li>
68
78
 
69
79
  </ul>
70
80
  </div>
71
81
 
72
82
 
73
83
 
84
+ <!-- Method Quickref -->
85
+ <div id="method-list-section" class="section">
86
+ <h3 class="section-header">Methods</h3>
87
+ <ul class="link-list">
88
+
89
+ <li><a href="#method-c-get_myexperiment_data">::get_myexperiment_data</a></li>
90
+
91
+ </ul>
92
+ </div>
93
+
74
94
 
75
95
 
76
96
  </div>
@@ -109,13 +129,17 @@
109
129
 
110
130
  <li><a href="./MyExperimentREST.html">MyExperimentREST</a></li>
111
131
 
112
- <li><a href="./MyExperimentREST/TavernaIOData.html">MyExperimentREST::TavernaIOData</a></li>
132
+ <li><a href="./MyExperimentREST/MyExperimentIOData.html">MyExperimentREST::MyExperimentIOData</a></li>
113
133
 
114
- <li><a href="./MyExperimentREST/TavernaUser.html">MyExperimentREST::TavernaUser</a></li>
134
+ <li><a href="./MyExperimentREST/MyExperimentUser.html">MyExperimentREST::MyExperimentUser</a></li>
115
135
 
116
- <li><a href="./MyExperimentREST/TavernaWorkflow.html">MyExperimentREST::TavernaWorkflow</a></li>
136
+ <li><a href="./MyExperimentREST/MyExperimentWorkflow.html">MyExperimentREST::MyExperimentWorkflow</a></li>
117
137
 
118
- <li><a href="./MyExperimentREST/Workflows.html">MyExperimentREST::Workflows</a></li>
138
+ <li><a href="./MyExperimentREST/Urls.html">MyExperimentREST::Urls</a></li>
139
+
140
+ <li><a href="./MyExperimentREST/User.html">MyExperimentREST::User</a></li>
141
+
142
+ <li><a href="./MyExperimentREST/Workflow.html">MyExperimentREST::Workflow</a></li>
119
143
 
120
144
  </ul>
121
145
  <div id="no-class-search-results" style="display: none;">No matching classes.</div>
@@ -144,6 +168,73 @@
144
168
 
145
169
  <!-- Methods -->
146
170
 
171
+ <div id="public-class-method-details" class="method-section section">
172
+ <h3 class="section-header">Public Class Methods</h3>
173
+
174
+
175
+ <div id="get_myexperiment_data-method" class="method-detail ">
176
+ <a name="method-c-get_myexperiment_data"></a>
177
+
178
+
179
+ <div class="method-heading">
180
+ <span class="method-name">get_myexperiment_data</span><span
181
+ class="method-args">(resource_url, params)</span>
182
+ <span class="method-click-advice">click to toggle source</span>
183
+ </div>
184
+
185
+
186
+ <div class="method-description">
187
+
188
+ <p>Get information from myExperiment using the REST API. Resources supported
189
+ currently are <tt>WORKFLOW_URL</tt>“+ and <tt>USER_URL</tt>.</p>
190
+
191
+
192
+
193
+ <div class="method-source-code" id="get_myexperiment_data-source">
194
+ <pre>
195
+ <span class="ruby-comment"># File lib/myexperiment-rest.rb, line 14</span>
196
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_myexperiment_data</span>(<span class="ruby-identifier">resource_url</span>, <span class="ruby-identifier">params</span>)
197
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">resource_url</span>
198
+
199
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">Urls</span><span class="ruby-operator">::</span><span class="ruby-constant">WORKFLOW_URL</span>
200
+ <span class="ruby-keyword">begin</span>
201
+ <span class="ruby-comment"># Get workflow resource information -- if version is empty it returns the current version</span>
202
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{Urls::MYEXPERIMENT_URL}/#{Urls::WORKFLOW_URL}&quot;</span>,
203
+ {<span class="ruby-value">:params</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-string">'id'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{params[:id]}&quot;</span>,
204
+ <span class="ruby-string">'version'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{params[:version]}&quot;</span>,
205
+ <span class="ruby-string">'elements'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'title,description,content-uri,components,uploader'</span>} } )
206
+ <span class="ruby-identifier">response</span>
207
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
208
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;REST call to acquire workflow resource failed!\n&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">e</span>
209
+ <span class="ruby-keyword">end</span>
210
+
211
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">Urls</span><span class="ruby-operator">::</span><span class="ruby-constant">USER_URL</span>
212
+ <span class="ruby-keyword">begin</span>
213
+ <span class="ruby-comment"># Get user resource information</span>
214
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{Urls::MYEXPERIMENT_URL}/#{Urls::USER_URL}&quot;</span>,
215
+ {<span class="ruby-value">:params</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-string">'id'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{params[:id]}&quot;</span> } } )
216
+ <span class="ruby-identifier">response</span>
217
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
218
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;REST call to acquire user resource failed!\n&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">e</span>
219
+ <span class="ruby-keyword">end</span>
220
+
221
+ <span class="ruby-keyword">else</span>
222
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;This is not a supported resource type!\n&quot;</span>
223
+ <span class="ruby-keyword">end</span>
224
+
225
+ <span class="ruby-keyword">end</span></pre>
226
+ </div><!-- get_myexperiment_data-source -->
227
+
228
+ </div>
229
+
230
+
231
+
232
+
233
+ </div><!-- get_myexperiment_data-method -->
234
+
235
+
236
+ </div><!-- public-class-method-details -->
237
+
147
238
  </div><!-- 5Buntitled-5D -->
148
239
 
149
240
 
@@ -5,7 +5,7 @@
5
5
  <head>
6
6
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
7
 
8
- <title>Class: MyExperimentREST::TavernaIOData</title>
8
+ <title>Class: MyExperimentREST::MyExperimentIOData</title>
9
9
 
10
10
  <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
11
 
@@ -34,8 +34,8 @@
34
34
  <div class="section-body">
35
35
  <ul>
36
36
 
37
- <li><a href="../lib/myexperiment-rest/myexperiment_rest_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
- class="thickbox" title="lib/myexperiment-rest/myexperiment_rest.rb">lib/myexperiment-rest/myexperiment_rest.rb</a></li>
37
+ <li><a href="../lib/myexperiment-rest/workflow_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/myexperiment-rest/workflow.rb">lib/myexperiment-rest/workflow.rb</a></li>
39
39
 
40
40
  </ul>
41
41
  </div>
@@ -65,6 +65,8 @@
65
65
  <h3 class="section-header">Methods</h3>
66
66
  <ul class="link-list">
67
67
 
68
+ <li><a href="#method-c-from_xml">::from_xml</a></li>
69
+
68
70
  <li><a href="#method-c-new">::new</a></li>
69
71
 
70
72
  </ul>
@@ -108,13 +110,17 @@
108
110
 
109
111
  <li><a href="../MyExperimentREST.html">MyExperimentREST</a></li>
110
112
 
111
- <li><a href="../MyExperimentREST/TavernaIOData.html">MyExperimentREST::TavernaIOData</a></li>
113
+ <li><a href="../MyExperimentREST/MyExperimentIOData.html">MyExperimentREST::MyExperimentIOData</a></li>
114
+
115
+ <li><a href="../MyExperimentREST/MyExperimentUser.html">MyExperimentREST::MyExperimentUser</a></li>
112
116
 
113
- <li><a href="../MyExperimentREST/TavernaUser.html">MyExperimentREST::TavernaUser</a></li>
117
+ <li><a href="../MyExperimentREST/MyExperimentWorkflow.html">MyExperimentREST::MyExperimentWorkflow</a></li>
114
118
 
115
- <li><a href="../MyExperimentREST/TavernaWorkflow.html">MyExperimentREST::TavernaWorkflow</a></li>
119
+ <li><a href="../MyExperimentREST/Urls.html">MyExperimentREST::Urls</a></li>
116
120
 
117
- <li><a href="../MyExperimentREST/Workflows.html">MyExperimentREST::Workflows</a></li>
121
+ <li><a href="../MyExperimentREST/User.html">MyExperimentREST::User</a></li>
122
+
123
+ <li><a href="../MyExperimentREST/Workflow.html">MyExperimentREST::Workflow</a></li>
118
124
 
119
125
  </ul>
120
126
  <div id="no-class-search-results" style="display: none;">No matching classes.</div>
@@ -125,7 +131,7 @@
125
131
  </div>
126
132
 
127
133
  <div id="documentation">
128
- <h1 class="class">MyExperimentREST::TavernaIOData</h1>
134
+ <h1 class="class">MyExperimentREST::MyExperimentIOData</h1>
129
135
 
130
136
  <div id="description" class="description">
131
137
 
@@ -202,13 +208,69 @@ descriptions and examples. The last two are lists.</p>
202
208
  <h3 class="section-header">Public Class Methods</h3>
203
209
 
204
210
 
211
+ <div id="from_xml-method" class="method-detail ">
212
+ <a name="method-c-from_xml"></a>
213
+
214
+
215
+ <div class="method-heading">
216
+ <span class="method-name">from_xml</span><span
217
+ class="method-args">(xml_node)</span>
218
+ <span class="method-click-advice">click to toggle source</span>
219
+ </div>
220
+
221
+
222
+ <div class="method-description">
223
+
224
+
225
+
226
+
227
+
228
+ <div class="method-source-code" id="from_xml-source">
229
+ <pre>
230
+ <span class="ruby-comment"># File lib/myexperiment-rest/workflow.rb, line 115</span>
231
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">xml_node</span>)
232
+ <span class="ruby-identifier">name</span> = <span class="ruby-string">''</span>
233
+ <span class="ruby-identifier">descriptions</span> = []
234
+ <span class="ruby-identifier">examples</span> = []
235
+
236
+ <span class="ruby-identifier">xml_node</span>.<span class="ruby-identifier">each_element</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
237
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">eql?</span> <span class="ruby-string">&quot;name&quot;</span>
238
+ <span class="ruby-identifier">name</span> = <span class="ruby-identifier">n</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>
239
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">eql?</span> <span class="ruby-string">&quot;descriptions&quot;</span>
240
+ <span class="ruby-identifier">n</span>.<span class="ruby-identifier">each_element</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span>
241
+ <span class="ruby-identifier">descriptions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>
242
+ <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">children?</span>
243
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">eql?</span> <span class="ruby-string">&quot;examples&quot;</span>
244
+ <span class="ruby-identifier">n</span>.<span class="ruby-identifier">each_element</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
245
+ <span class="ruby-identifier">examples</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>
246
+ <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">children?</span>
247
+ <span class="ruby-keyword">end</span>
248
+ <span class="ruby-keyword">end</span>
249
+
250
+
251
+ <span class="ruby-identifier">new</span>(
252
+ <span class="ruby-value">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">name</span>,
253
+ <span class="ruby-value">:descriptions</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">descriptions</span>,
254
+ <span class="ruby-value">:examples</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">examples</span>)
255
+
256
+ <span class="ruby-keyword">end</span></pre>
257
+ </div><!-- from_xml-source -->
258
+
259
+ </div>
260
+
261
+
262
+
263
+
264
+ </div><!-- from_xml-method -->
265
+
266
+
205
267
  <div id="new-method" class="method-detail ">
206
268
  <a name="method-c-new"></a>
207
269
 
208
270
 
209
271
  <div class="method-heading">
210
272
  <span class="method-name">new</span><span
211
- class="method-args">(name, descriptions, examples)</span>
273
+ class="method-args">(attributes)</span>
212
274
  <span class="method-click-advice">click to toggle source</span>
213
275
  </div>
214
276
 
@@ -221,11 +283,11 @@ descriptions and examples. The last two are lists.</p>
221
283
 
222
284
  <div class="method-source-code" id="new-source">
223
285
  <pre>
224
- <span class="ruby-comment"># File lib/myexperiment-rest/myexperiment_rest.rb, line 160</span>
225
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">descriptions</span>, <span class="ruby-identifier">examples</span>)
226
- <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
227
- <span class="ruby-ivar">@descriptions</span> = <span class="ruby-identifier">descriptions</span>
228
- <span class="ruby-ivar">@examples</span> = <span class="ruby-identifier">examples</span>
286
+ <span class="ruby-comment"># File lib/myexperiment-rest/workflow.rb, line 109</span>
287
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span>)
288
+ <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-value">:name</span>]
289
+ <span class="ruby-ivar">@descriptions</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-value">:descriptions</span>]
290
+ <span class="ruby-ivar">@examples</span> = <span class="ruby-identifier">attributes</span>[<span class="ruby-value">:examples</span>]
229
291
  <span class="ruby-keyword">end</span></pre>
230
292
  </div><!-- new-source -->
231
293