Method: InterMine::Service#initialize
- Defined in:
- lib/intermine/service.rb
#initialize(root, token = nil, mock_model = nil) ⇒ Service
Construct a new service.
service = Service.new("www.flymine.org/query", "TOKEN")
Arguments:
root-
The URL to the root of the webservice. For example, for FlyMine this is: “www.flymine.org/query/service” For simplicity’s sake, it is possible to omit the scheme and the “/service” section, and just pass the bare minimum: “www.flymine.org/query”
token-
An optional API access token to authenticate your webservice access with. If you supply a token, you will have access to your private lists and templates.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/intermine/service.rb', line 145 def initialize(root, token=nil, mock_model=nil) u = URI.parse(root) unless u.scheme root = "http://" + root end unless root.end_with?("/service") # All webservices must root << "/service" end @root = root @token = token begin @version = fetch(@root + VERSION_PATH).to_i rescue => e raise ServiceError, "Error fetching version at #{@root + VERSION_PATH}: #{e.message}" end @model = mock_model @_templates = nil @broken_templates = [] @list_manager = InterMine::Lists::ListManager.new(self) end |