Class: Attio::Client
- Inherits:
-
Object
- Object
- Attio::Client
- Defined in:
- lib/attio/client.rb
Overview
HTTP client for making API requests to Attio Handles authentication, retries, and error responses
Instance Method Summary collapse
-
#delete(path) ⇒ Hash
Perform a DELETE request.
-
#get(path, params = {}) ⇒ Hash
Perform a GET request.
-
#initialize(api_key: nil) ⇒ Client
constructor
A new instance of Client.
-
#patch(path, body = {}) ⇒ Hash
Perform a PATCH request.
-
#post(path, body = {}) ⇒ Hash
Perform a POST request.
-
#put(path, body = {}) ⇒ Hash
Perform a PUT request.
Constructor Details
#initialize(api_key: nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/attio/client.rb', line 10 def initialize(api_key: nil) @api_key = api_key || Attio.configuration.api_key raise AuthenticationError, "No API key provided" unless @api_key end |
Instance Method Details
#delete(path) ⇒ Hash
Perform a DELETE request
55 56 57 |
# File 'lib/attio/client.rb', line 55 def delete(path) request(:delete, path) end |
#get(path, params = {}) ⇒ Hash
Perform a GET request
20 21 22 |
# File 'lib/attio/client.rb', line 20 def get(path, params = {}) request(:get, path, params) end |
#patch(path, body = {}) ⇒ Hash
Perform a PATCH request
47 48 49 |
# File 'lib/attio/client.rb', line 47 def patch(path, body = {}) request(:patch, path, body) end |
#post(path, body = {}) ⇒ Hash
Perform a POST request
29 30 31 |
# File 'lib/attio/client.rb', line 29 def post(path, body = {}) request(:post, path, body) end |
#put(path, body = {}) ⇒ Hash
Perform a PUT request
38 39 40 |
# File 'lib/attio/client.rb', line 38 def put(path, body = {}) request(:put, path, body) end |