Class: Ohme::Client
- Inherits:
-
Object
- Object
- Ohme::Client
- Defined in:
- lib/ohme/client.rb
Overview
Client for interacting with the Ohme API
Instance Method Summary collapse
-
#delete(endpoint, params = {}) ⇒ nil
Performs a DELETE request.
-
#get(endpoint, params = {}) ⇒ Hash
Performs a GET request.
-
#initialize(configuration = Ohme::Configuration.new) ⇒ Ohme::Client
constructor
Initializes the client with the configuration.
-
#post(endpoint, body = {}) ⇒ Hash
Performs a POST request.
-
#put(endpoint, body = {}) ⇒ Hash
Performs a PUT request.
Constructor Details
#initialize(configuration = Ohme::Configuration.new) ⇒ Ohme::Client
Initializes the client with the configuration
13 14 15 16 |
# File 'lib/ohme/client.rb', line 13 def initialize(configuration = Ohme::Configuration.new) @configuration = configuration @configuration.validate! end |
Instance Method Details
#delete(endpoint, params = {}) ⇒ nil
Performs a DELETE request
50 51 52 |
# File 'lib/ohme/client.rb', line 50 def delete(endpoint, params = {}) request(:delete, endpoint, params: params) end |
#get(endpoint, params = {}) ⇒ Hash
Performs a GET request
23 24 25 |
# File 'lib/ohme/client.rb', line 23 def get(endpoint, params = {}) request(:get, endpoint, params: params) end |
#post(endpoint, body = {}) ⇒ Hash
Performs a POST request
32 33 34 |
# File 'lib/ohme/client.rb', line 32 def post(endpoint, body = {}) request(:post, endpoint, body: body) end |
#put(endpoint, body = {}) ⇒ Hash
Performs a PUT request
41 42 43 |
# File 'lib/ohme/client.rb', line 41 def put(endpoint, body = {}) request(:put, endpoint, body: body) end |