Class: Kybus::Client::RESTClient
- Inherits:
-
Object
- Object
- Kybus::Client::RESTClient
- Includes:
- Logger
- Defined in:
- lib/kybus/client/rest_client.rb
Overview
HTTP client using HTTParty as support. This implementation makes it easier to integrate with other backends.
Instance Method Summary collapse
- #delete(path, data = {}) ⇒ Object
- #get(path, data = {}) ⇒ Object
-
#initialize(configs) ⇒ RESTClient
constructor
A new instance of RESTClient.
- #patch(path, data = {}) ⇒ Object
- #post(path, data = {}) ⇒ Object
- #put(path, data = {}) ⇒ Object
- #raw_get(path, data = {}) ⇒ Object
- #raw_post(path, data = {}) ⇒ Object
Constructor Details
#initialize(configs) ⇒ RESTClient
Returns a new instance of RESTClient.
18 19 20 21 22 23 24 |
# File 'lib/kybus/client/rest_client.rb', line 18 def initialize(configs) @session = Session.build(configs) @config = configs @format = Format.build(configs) @endpoint = configs[:endpoint] @validator = Validator.build(configs) end |
Instance Method Details
#delete(path, data = {}) ⇒ Object
38 39 40 |
# File 'lib/kybus/client/rest_client.rb', line 38 def delete(path, data = {}) perform_request(:delete, path, data) end |
#get(path, data = {}) ⇒ Object
26 27 28 |
# File 'lib/kybus/client/rest_client.rb', line 26 def get(path, data = {}) perform_request(:get, path, data) end |
#patch(path, data = {}) ⇒ Object
42 43 44 |
# File 'lib/kybus/client/rest_client.rb', line 42 def patch(path, data = {}) perform_request(:patch, path, data) end |
#post(path, data = {}) ⇒ Object
30 31 32 |
# File 'lib/kybus/client/rest_client.rb', line 30 def post(path, data = {}) perform_request(:post, path, data) end |
#put(path, data = {}) ⇒ Object
34 35 36 |
# File 'lib/kybus/client/rest_client.rb', line 34 def put(path, data = {}) perform_request(:put, path, data) end |
#raw_get(path, data = {}) ⇒ Object
46 47 48 |
# File 'lib/kybus/client/rest_client.rb', line 46 def raw_get(path, data = {}) perform_raw_request(:get, path, data) end |
#raw_post(path, data = {}) ⇒ Object
50 51 52 |
# File 'lib/kybus/client/rest_client.rb', line 50 def raw_post(path, data = {}) perform_raw_request(:post, path, data) end |