Class: Roart::Connection
- Inherits:
-
Object
- Object
- Roart::Connection
- Defined in:
- lib/roart/connection.rb
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
Instance Method Summary collapse
- #get(uri) ⇒ Object
-
#initialize(conf) ⇒ Connection
constructor
A new instance of Connection.
- #post(uri, payload) ⇒ Object
- #rest_path ⇒ Object
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 = login add_methods! end |
Instance Attribute Details
#agent ⇒ Object (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_path ⇒ Object
28 29 30 |
# File 'lib/roart/connection.rb', line 28 def rest_path self.server + '/REST/1.0/' end |