Module: OpenTox::Model

Includes:
OpenTox
Included in:
Generic, Lazar
Defined in:
lib/model.rb

Defined Under Namespace

Classes: Generic, Lazar

Instance Attribute Summary

Attributes included from OpenTox

#metadata, #uri

Instance Method Summary collapse

Methods included from OpenTox

#add_metadata, all, #delete, #initialize, #load_metadata, sign_in, text_to_html, #to_rdfxml

Instance Method Details

#run(params, accept_header = nil, waiting_task = nil) ⇒ text/uri-list

Run a model with parameters

Parameters:

  • params (Hash)

    Parameters for OpenTox model

  • waiting_task (optional, OpenTox::Task) (defaults to: nil)

    (can be a OpenTox::Subtask as well), progress is updated accordingly

Returns:

  • (text/uri-list)

    Task or resource URI



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/model.rb', line 11

def run( params, accept_header=nil, waiting_task=nil )
  unless accept_header
    if CONFIG[:json_hosts].include?(URI.parse(@uri).host)
      accept_header = 'application/json' 
    else
      accept_header = 'application/rdf+xml'
    end
  end
  LOGGER.info "running model "+@uri.to_s+", params: "+params.inspect+", accept: "+accept_header.to_s
  RestClientWrapper.post(@uri,params,{:accept => accept_header},waiting_task).to_s
end