Class: Roart::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/roart/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conf) ⇒ Connection

Returns a new instance of Connection.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/roart/connection.rb', line 15

def initialize(conf)

  if conf.is_a?(String)
    raise "Loading Config File not yet implemented"
  elsif conf.is_a?(Hash)
    Roart::check_keys!(conf, Roart::Connections::RequiredConfig)
    @conf = conf
  end

  @agent = 
  add_methods!
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



13
14
15
# File 'lib/roart/connection.rb', line 13

def agent
  @agent
end

Instance Method Details

#get(uri) ⇒ Object



32
33
34
# File 'lib/roart/connection.rb', line 32

def get(uri)
  @agent.get(uri).body
end

#post(uri, payload) ⇒ Object



36
37
38
# File 'lib/roart/connection.rb', line 36

def post(uri, payload)
  @agent.post(uri, payload).body
end

#rest_pathObject



28
29
30
# File 'lib/roart/connection.rb', line 28

def rest_path
  self.server + '/REST/1.0/'
end