myexperiment-rest 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,9 +1,12 @@
1
1
  = Changes log for the MyExperiment via REST Gem
2
2
 
3
+ == Version 0.3.3
4
+ * Fixed bug when acquiring information from versions other than the newest
5
+
6
+
3
7
  == Version 0.3.2
4
8
  * Updated to libxml-ruby 2.2.2
5
9
 
6
-
7
10
  == Version 0.3.1
8
11
  * Renamed xml_uri to content_uri
9
12
  * added simple session cookie authentication
data/README CHANGED
@@ -1,7 +1,7 @@
1
1
  = MyExperiment Interaction via REST
2
2
 
3
3
  Authors:: Konstantinos Karasavvas
4
- Gem Version:: 0.3.2
4
+ Gem Version:: 0.3.3
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
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rdoc/task'
7
7
 
8
8
  spec = Gem::Specification.new do |s|
9
9
  s.name = 'myexperiment-rest'
10
- s.version = '0.3.2'
10
+ s.version = '0.3.3'
11
11
  s.extra_rdoc_files = ['README', 'LICENSE', 'CHANGES']
12
12
  s.summary = 'This is a simple library to access data on myExperiment via its REST API.'
13
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.'
@@ -92,6 +92,11 @@
92
92
 
93
93
  <h1>Changes log for the MyExperiment via REST Gem</h1>
94
94
 
95
+ <h2>Version 0.3.3</h2>
96
+ <ul><li>
97
+ <p>Fixed bug when acquiring information from versions other than the newest</p>
98
+ </li></ul>
99
+
95
100
  <h2>Version 0.3.2</h2>
96
101
  <ul><li>
97
102
  <p>Updated to libxml-ruby 2.2.2</p>
@@ -206,22 +206,24 @@ currently are <tt>WORKFLOW_URL</tt>“+ and <tt>USER_URL</tt>.</p>
206
206
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">resource_url</span>
207
207
 
208
208
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Urls</span><span class="ruby-operator">::</span><span class="ruby-constant">WORKFLOW_URL</span>
209
+ <span class="ruby-identifier">rest_params</span> = { <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>,
210
+ <span class="ruby-string">'elements'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'title,description,content-uri,components,uploader'</span>}
211
+ }
212
+
213
+ <span class="ruby-comment"># if version is not empty use that one -- otherwise it returns the current version</span>
214
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:version</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">params</span>[<span class="ruby-value">:version</span>].<span class="ruby-identifier">empty?</span>
215
+ <span class="ruby-identifier">rest_params</span>[<span class="ruby-value">:params</span>][<span class="ruby-string">'version'</span>] = <span class="ruby-node">&quot;#{params[:version]}&quot;</span>
216
+ <span class="ruby-keyword">end</span>
217
+
218
+ <span class="ruby-comment"># if session cookie is not empty it uses simple cookie auth (not secure -- used for demos)</span>
219
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:session_cookie</span>]
220
+ <span class="ruby-identifier">rest_params</span>[<span class="ruby-value">:cookies</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-value">:session_cookie</span>]
221
+ <span class="ruby-keyword">end</span>
222
+
223
+
224
+ <span class="ruby-comment"># Get workflow resource information</span>
209
225
  <span class="ruby-keyword">begin</span>
210
- <span class="ruby-comment"># Get workflow resource information -- if version is empty it returns the current version</span>
211
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:session_cookie</span>].<span class="ruby-identifier">empty?</span>
212
- <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>,
213
- {<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>,
214
- <span class="ruby-string">'version'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{params[:version]}&quot;</span>,
215
- <span class="ruby-string">'elements'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'title,description,content-uri,components,uploader'</span>} } )
216
- <span class="ruby-identifier">response</span>
217
- <span class="ruby-keyword">else</span> <span class="ruby-comment"># TODO: reduce repetition.. if else only for the cookie key-value pair!!</span>
218
- <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>,
219
- {<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>,
220
- <span class="ruby-string">'version'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{params[:version]}&quot;</span>,
221
- <span class="ruby-string">'elements'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'title,description,content-uri,components,uploader'</span>},
222
- <span class="ruby-value">:cookies</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:session_cookie</span>] } )
223
- <span class="ruby-identifier">response</span>
224
- <span class="ruby-keyword">end</span>
226
+ <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>, <span class="ruby-identifier">rest_params</span>)
225
227
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
226
228
  <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>
227
229
  <span class="ruby-keyword">end</span>
data/doc/rdoc/README.html CHANGED
@@ -96,7 +96,7 @@
96
96
  <p>Konstantinos Karasavvas</p>
97
97
  </td></tr><tr><td class="rdoc-term"><p>Gem Version</p></td>
98
98
  <td>
99
- <p>0.3.2</p>
99
+ <p>0.3.3</p>
100
100
  </td></tr><tr><td class="rdoc-term"><p>Contact</p></td>
101
101
  <td>
102
102
  <p><a href="mailto:kostas.karasavvas@nbic.nl">kostas.karasavvas@nbic.nl</a></p>
data/doc/rdoc/created.rid CHANGED
@@ -1,9 +1,9 @@
1
- Mon, 16 Jan 2012 11:48:00 +0100
1
+ Mon, 13 Feb 2012 16:25:51 +0100
2
2
  LICENSE Tue, 26 Jul 2011 16:45:34 +0200
3
3
  lib/myexperiment-rest/constants.rb Thu, 29 Sep 2011 16:33:55 +0200
4
- README Mon, 16 Jan 2012 11:47:36 +0100
4
+ README Tue, 07 Feb 2012 15:53:26 +0100
5
5
  lib/myexperiment-rest/user.rb Wed, 28 Sep 2011 12:11:32 +0200
6
- lib/myexperiment-rest.rb Tue, 04 Oct 2011 15:07:41 +0200
7
- CHANGES Mon, 16 Jan 2012 11:47:22 +0100
6
+ lib/myexperiment-rest.rb Mon, 13 Feb 2012 16:25:36 +0100
7
+ CHANGES Mon, 13 Feb 2012 16:14:27 +0100
8
8
  lib/myexperiment-rest/authentication.rb Mon, 03 Oct 2011 12:20:41 +0200
9
- lib/myexperiment-rest/workflow.rb Mon, 03 Oct 2011 12:44:03 +0200
9
+ lib/myexperiment-rest/workflow.rb Tue, 07 Feb 2012 16:23:39 +0100
data/doc/rdoc/index.html CHANGED
@@ -29,7 +29,7 @@
29
29
  <p>Konstantinos Karasavvas</p>
30
30
  </td></tr><tr><td class="rdoc-term"><p>Gem Version</p></td>
31
31
  <td>
32
- <p>0.3.2</p>
32
+ <p>0.3.3</p>
33
33
  </td></tr><tr><td class="rdoc-term"><p>Contact</p></td>
34
34
  <td>
35
35
  <p><a href="mailto:kostas.karasavvas@nbic.nl">kostas.karasavvas@nbic.nl</a></p>
@@ -24,7 +24,7 @@
24
24
  <div id="metadata">
25
25
  <dl>
26
26
  <dt class="modified-date">Last Modified</dt>
27
- <dd class="modified-date">Mon Oct 03 12:44:03 +0200 2011</dd>
27
+ <dd class="modified-date">Tue Feb 07 16:23:39 +0100 2012</dd>
28
28
 
29
29
 
30
30
  <dt class="requires">Requires</dt>
@@ -24,7 +24,7 @@
24
24
  <div id="metadata">
25
25
  <dl>
26
26
  <dt class="modified-date">Last Modified</dt>
27
- <dd class="modified-date">Tue Oct 04 15:07:41 +0200 2011</dd>
27
+ <dd class="modified-date">Mon Feb 13 16:25:36 +0100 2012</dd>
28
28
 
29
29
 
30
30
  <dt class="requires">Requires</dt>
@@ -16,22 +16,24 @@ module MyExperimentREST
16
16
  case resource_url
17
17
 
18
18
  when Urls::WORKFLOW_URL
19
+ rest_params = { :params => {'id' => "#{params[:id]}",
20
+ 'elements' => 'title,description,content-uri,components,uploader'}
21
+ }
22
+
23
+ # if version is not empty use that one -- otherwise it returns the current version
24
+ if params[:version] && !params[:version].empty?
25
+ rest_params[:params]['version'] = "#{params[:version]}"
26
+ end
27
+
28
+ # if session cookie is not empty it uses simple cookie auth (not secure -- used for demos)
29
+ if params[:session_cookie]
30
+ rest_params[:cookies] = params[:session_cookie]
31
+ end
32
+
33
+
34
+ # Get workflow resource information
19
35
  begin
20
- # Get workflow resource information -- if version is empty it returns the current version
21
- if params[:session_cookie].empty?
22
- response = RestClient.get("#{Urls::MYEXPERIMENT_URL}/#{Urls::WORKFLOW_URL}",
23
- {:params => {'id' => "#{params[:id]}",
24
- 'version' => "#{params[:version]}",
25
- 'elements' => 'title,description,content-uri,components,uploader'} } )
26
- response
27
- else # TODO: reduce repetition.. if else only for the cookie key-value pair!!
28
- response = RestClient.get("#{Urls::MYEXPERIMENT_URL}/#{Urls::WORKFLOW_URL}",
29
- {:params => {'id' => "#{params[:id]}",
30
- 'version' => "#{params[:version]}",
31
- 'elements' => 'title,description,content-uri,components,uploader'},
32
- :cookies => params[:session_cookie] } )
33
- response
34
- end
36
+ response = RestClient.get("#{Urls::MYEXPERIMENT_URL}/#{Urls::WORKFLOW_URL}", rest_params)
35
37
  rescue Exception => e
36
38
  raise "REST call to acquire workflow resource failed!\n" + e
37
39
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myexperiment-rest
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Konstantinos Karasavvas
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-16 00:00:00 Z
18
+ date: 2012-02-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rest-client