summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lazar.gemspec1
-rw-r--r--lib/lazar.rb1
-rw-r--r--lib/overwrite.rb2
-rw-r--r--lib/rest-client-wrapper.rb1
-rw-r--r--test/compound.rb4
5 files changed, 7 insertions, 2 deletions
diff --git a/lazar.gemspec b/lazar.gemspec
index 90f1cf2..3c704c8 100644
--- a/lazar.gemspec
+++ b/lazar.gemspec
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
# specify any dependencies here; for example:
s.add_runtime_dependency 'bundler'
s.add_runtime_dependency 'rest-client'
+ s.add_runtime_dependency 'addressable'
s.add_runtime_dependency 'nokogiri'
s.add_runtime_dependency 'rserve-client'
s.add_runtime_dependency 'mongoid'
diff --git a/lib/lazar.rb b/lib/lazar.rb
index a756742..fff5598 100644
--- a/lib/lazar.rb
+++ b/lib/lazar.rb
@@ -1,6 +1,7 @@
require 'rubygems'
require "bundler/setup"
require "rest-client"
+require 'addressable'
require 'yaml'
require 'json'
require 'logger'
diff --git a/lib/overwrite.rb b/lib/overwrite.rb
index 91bc9e1..89e57a0 100644
--- a/lib/overwrite.rb
+++ b/lib/overwrite.rb
@@ -197,7 +197,7 @@ module URI
# @param [String]
# @return [TrueClass,FalseClass]
def self.valid? uri
- u = URI.parse(uri)
+ u = Addressable::URI.parse(uri)
u.scheme!=nil and u.host!=nil
rescue URI::InvalidURIError
false
diff --git a/lib/rest-client-wrapper.rb b/lib/rest-client-wrapper.rb
index f76a296..c9fd40f 100644
--- a/lib/rest-client-wrapper.rb
+++ b/lib/rest-client-wrapper.rb
@@ -26,6 +26,7 @@ module OpenTox
define_singleton_method method do |uri,payload={},headers={},waiting_task=nil|
+ uri = Addressable::URI.encode(uri)
# check input
bad_request_error "Headers are not a hash: #{headers.inspect} for #{uri}." unless headers==nil or headers.is_a?(Hash)
headers[:subjectid] ||= @@subjectid
diff --git a/test/compound.rb b/test/compound.rb
index bdfb749..c4e6161 100644
--- a/test/compound.rb
+++ b/test/compound.rb
@@ -61,7 +61,9 @@ print c.sdf
def test_chemblid
c = OpenTox::Compound.from_inchi "InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H"
- assert_equal "CHEMBL277500", c.chemblid
+ assert_equal "CHEMBL1531487", c.chemblid
+ c = OpenTox::Compound.from_smiles "OC[C@](c1onc(n1)c1ncn2c1CN(C)C(=O)c1c2cccc1Cl)(O)C"
+ assert_equal "CHEMBL145418", c.chemblid
end
def test_sdf_storage