helma-opentox-ruby-api-wrapper 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -0,0 +1,26 @@
1
+ helpers do
2
+
3
+ # Authentification
4
+ def protected!
5
+ response['WWW-Authenticate'] = %(Basic realm="Testing HTTP Auth") and \
6
+ throw(:halt, [401, "Not authorized\n"]) and \
7
+ return unless authorized?
8
+ end
9
+
10
+ def authorized?
11
+ @auth ||= Rack::Auth::Basic::Request.new(request.env)
12
+ @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == ['api', API_KEY]
13
+ end
14
+
15
+
16
+ =begin
17
+ def xml(object)
18
+ builder do |xml|
19
+ xml.instruct!
20
+ object.to_xml
21
+ end
22
+ end
23
+ =end
24
+
25
+ end
26
+
@@ -1,11 +1,12 @@
1
- require 'rest_client'
2
- require 'crack/xml'
3
- require 'spork'
1
+ [ 'rest_client', 'crack/xml', 'spork', 'helper' ].each do |lib|
2
+ require lib
3
+ end
4
4
 
5
5
  ENV['OPENTOX_COMPOUND'] = 'http://webservices.in-silico.ch/compound/v0/' unless ENV['OPENTOX_COMPOUND']
6
6
  ENV['OPENTOX_FEATURE'] = 'http://webservices.in-silico.ch/feature/v0/' unless ENV['OPENTOX_FEATURE']
7
7
  ENV['OPENTOX_DATASET'] = 'http://webservices.in-silico.ch/dataset/v0/' unless ENV['OPENTOX_DATASET']
8
8
  ENV['OPENTOX_FMINER'] = 'http://webservices.in-silico.ch/fminer/v0/' unless ENV['OPENTOX_FMINER']
9
+ ENV['OPENTOX_LAZAR'] = 'http://webservices.in-silico.ch/lazar/v0/' unless ENV['OPENTOX_LAZAR']
9
10
 
10
11
  module OpenTox
11
12
 
@@ -86,7 +87,6 @@ module OpenTox
86
87
  @uri = params[:uri].to_s
87
88
  elsif params[:name]
88
89
  @uri = RestClient.post ENV['OPENTOX_DATASET'], :name => params[:name]
89
- RestClient.delete @uri + '/associations'
90
90
  end
91
91
  end
92
92
 
@@ -140,4 +140,18 @@ module OpenTox
140
140
 
141
141
  end
142
142
 
143
+ class Lazar < OpenTox
144
+
145
+ # Create a new prediction model from a dataset
146
+ def initialize(training_dataset)
147
+ @uri = RestClient.post ENV['OPENTOX_LAZAR'] + 'models/' , :dataset_uri => training_dataset.uri
148
+ end
149
+
150
+ # Predict a compound
151
+ def predict(compound)
152
+ RestClient.post @uri, :compound_uri => compound.uri
153
+ end
154
+
155
+ end
156
+
143
157
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{opentox-ruby-api-wrapper}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Christoph Helma"]
12
- s.date = %q{2009-08-14}
12
+ s.date = %q{2009-08-15}
13
13
  s.description = %q{Ruby wrapper for the OpenTox REST API (http://www.opentox.org)}
14
14
  s.email = %q{helma@in-silico.ch}
15
15
  s.extra_rdoc_files = [
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  "README.rdoc",
24
24
  "Rakefile",
25
25
  "VERSION",
26
+ "lib/helper.rb",
26
27
  "lib/opentox-ruby-api-wrapper.rb",
27
28
  "lib/spork.rb",
28
29
  "opentox-ruby-api-wrapper.gemspec",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helma-opentox-ruby-api-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Helma
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-14 00:00:00 -07:00
12
+ date: 2009-08-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -58,6 +58,7 @@ files:
58
58
  - README.rdoc
59
59
  - Rakefile
60
60
  - VERSION
61
+ - lib/helper.rb
61
62
  - lib/opentox-ruby-api-wrapper.rb
62
63
  - lib/spork.rb
63
64
  - opentox-ruby-api-wrapper.gemspec