Class: Hastie::IdServer

Inherits:
Object
  • Object
show all
Defined in:
lib/hastie/id_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url = "", domain = "cbio") ⇒ IdServer

Returns a new instance of IdServer.



6
7
8
9
# File 'lib/hastie/id_server.rb', line 6

def initialize url = "", domain = "cbio"
  self.root_url = url
  self.domain = domain
end

Instance Attribute Details

#domainObject

Returns the value of attribute domain.



5
6
7
# File 'lib/hastie/id_server.rb', line 5

def domain
  @domain
end

#root_urlObject

Returns the value of attribute root_url.



5
6
7
# File 'lib/hastie/id_server.rb', line 5

def root_url
  @root_url
end

Instance Method Details

#request_id(pi, researcher) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/hastie/id_server.rb', line 11

def request_id pi, researcher
  request = {"issuer" => domain, "lab" => pi, "sponsor" => researcher, "project" =>
    {"description" => "new project"}}.to_json
  command = "curl -H \"Accept: application/json\" -H \"Content-type: application/json\" -X POST -d"
  "#{self.domain}.tst.100 -d '#{request.to_s}' #{url}/projects"
  puts command
  "cbio.tst.1000"
end