diff options
author | mguetlein <martin.guetlein@gmail.com> | 2010-05-06 11:32:05 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2010-05-06 11:32:05 +0200 |
commit | 9e356d0d94ea4fe210ea7cefce5d4c1179cb63cd (patch) | |
tree | 486bd97d9e968c56c755dfa69331a8cabc70895f /lib/rest_client_wrapper.rb | |
parent | 8439bb9b337bded4a54018c03500a15082bce6b0 (diff) |
major change: using literal datatypes in owl
Diffstat (limited to 'lib/rest_client_wrapper.rb')
-rw-r--r-- | lib/rest_client_wrapper.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/rest_client_wrapper.rb b/lib/rest_client_wrapper.rb index f917e35..187f3a9 100644 --- a/lib/rest_client_wrapper.rb +++ b/lib/rest_client_wrapper.rb @@ -67,7 +67,7 @@ module OpenTox begin #LOGGER.debug "RestCall: "+rest_call.to_s+" "+uri.to_s+" "+headers.inspect - resource = RestClient::Resource.new(uri,{:timeout => 60, :user => @@users[:users].keys[0], :password => @@users[:users].values[0]}) + resource = RestClient::Resource.new(uri,{:timeout => 60}) #, :user => @@users[:users].keys[0], :password => @@users[:users].values[0]}) if payload result = resource.send(rest_call, payload, headers) elsif headers @@ -76,9 +76,10 @@ module OpenTox result = resource.send(rest_call) end - # result is a string, with the additional filed content_type - res = WrapperResult.new(result.to_s) + # result is a string, with the additional fields content_type and code + res = WrapperResult.new(result.body) res.content_type = result.headers[:content_type] + raise "content-type not set" unless res.content_type res.code = result.code return res if res.code==200 || !wait @@ -118,7 +119,7 @@ module OpenTox res.split("\n").size > 1 #if uri list contains more then one uri, its not a task task = OpenTox::Task.find(res.to_s) if Utils.task_uri?(res) else - raise "unknown content-type for task: "+res.content_type+" content: "+res[0..200] + raise "unknown content-type for task: '"+res.content_type.to_s+"'" #+"' content: "+res[0..200].to_s end LOGGER.debug "result is a task '"+task.uri.to_s+"', wait for completion" |