Class: Consul::Http
- Inherits:
-
Object
- Object
- Consul::Http
- Defined in:
- lib/consul/http.rb
Instance Attribute Summary collapse
-
#http_client ⇒ Object
Returns the value of attribute http_client.
Instance Method Summary collapse
- #get(path) ⇒ Object
-
#initialize ⇒ Http
constructor
A new instance of Http.
- #load_config ⇒ Object
- #put(path, data = nil) ⇒ Object
- #request(method, uri, data = nil) ⇒ Object
Constructor Details
#initialize ⇒ Http
Returns a new instance of Http.
7 8 9 |
# File 'lib/consul/http.rb', line 7 def initialize load_config end |
Instance Attribute Details
#http_client ⇒ Object
Returns the value of attribute http_client.
5 6 7 |
# File 'lib/consul/http.rb', line 5 def http_client @http_client end |
Instance Method Details
#get(path) ⇒ Object
20 21 22 |
# File 'lib/consul/http.rb', line 20 def get(path) request('GET', path) end |
#load_config ⇒ Object
24 25 26 |
# File 'lib/consul/http.rb', line 24 def load_config self.http_client = Net::HTTP.new(Consul::Client.config.host, Consul::Client.config.port, nil, nil) end |
#put(path, data = nil) ⇒ Object
16 17 18 |
# File 'lib/consul/http.rb', line 16 def put(path, data=nil) request('PUT', path, data) end |