summaryrefslogtreecommitdiff
path: root/lib/rest-client-wrapper.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2013-07-16 17:45:08 +0200
committerChristoph Helma <helma@in-silico.ch>2013-07-16 17:45:08 +0200
commit80c1821e3a55b0d9c1ee51537e109dff3bc79423 (patch)
treeb77873e557b016d265c97cbc212b73f700453712 /lib/rest-client-wrapper.rb
parent10ffab4d032e3e5584c318a45521e774d49bd3d7 (diff)
subjectid handled by RestClientWrapper
Diffstat (limited to 'lib/rest-client-wrapper.rb')
-rw-r--r--lib/rest-client-wrapper.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/rest-client-wrapper.rb b/lib/rest-client-wrapper.rb
index 2de9377..134dd32 100644
--- a/lib/rest-client-wrapper.rb
+++ b/lib/rest-client-wrapper.rb
@@ -4,6 +4,16 @@ module OpenTox
attr_accessor :request, :response
+ @@subjectid = nil
+
+ def self.subjectid=(subjectid)
+ @@subjectid = subjectid
+ end
+
+ def self.subjectid
+ @@subjectid
+ end
+
# REST methods
# Raises OpenTox::Error if call fails (rescued in overwrite.rb -> halt 502)
# Does not wait for task to finish and returns task uri
@@ -17,7 +27,7 @@ module OpenTox
# check input
bad_request_error "Headers are not a hash: #{headers.inspect}", uri unless headers==nil or headers.is_a?(Hash)
- headers[:subjectid] ||= OpenTox::SUBJECTID
+ headers[:subjectid] ||= @@subjectid
bad_request_error "Invalid URI: '#{uri}'", uri unless URI.valid? uri
#resource_not_found_error "URI '#{uri}' not found.", uri unless URI.accessible?(uri, @subjectid) unless URI.ssl?(uri)
# make sure that no header parameters are set in the payload