Class: ZktClient::Base
- Inherits:
-
Object
- Object
- ZktClient::Base
- Extended by:
- Helperable, Validatable
- Defined in:
- lib/zkt_client/models/base.rb
Overview
Base class for ZktClient module
Direct Known Subclasses
Class Method Summary collapse
-
.create(params) ⇒ Hash
Creates a new resource with the given parameters.
-
.delete(id) ⇒ Boolean
Deletes a resource by ID.
-
.list(**params) ⇒ Array<Hash>
Lists all resources with optional parameters.
-
.show(id) ⇒ Hash
Shows the details of a specific resource by ID.
-
.update(id, params) ⇒ Hash
Updates an existing resource by ID with the given parameters.
Class Method Details
.create(params) ⇒ Hash
Creates a new resource with the given parameters
37 38 39 40 41 42 |
# File 'lib/zkt_client/models/base.rb', line 37 def create(params) validate_create_params!(params) response = HttpClient.post(url: self::URLS[:base], headers:, params:) build_response(response) end |
.delete(id) ⇒ Boolean
Deletes a resource by ID
60 61 62 63 64 |
# File 'lib/zkt_client/models/base.rb', line 60 def delete(id) HttpClient.delete(url: url_with_id(id), headers:) true end |
.list(**params) ⇒ Array<Hash>
Lists all resources with optional parameters
27 28 29 30 31 |
# File 'lib/zkt_client/models/base.rb', line 27 def list(**params) response = HttpClient.get(url: self::URLS[:base], headers:, params:) build_response(response) end |
.show(id) ⇒ Hash
Shows the details of a specific resource by ID
17 18 19 20 21 |
# File 'lib/zkt_client/models/base.rb', line 17 def show(id) response = HttpClient.get(url: url_with_id(id), headers:) build_response(response) end |
.update(id, params) ⇒ Hash
Updates an existing resource by ID with the given parameters
49 50 51 52 53 54 |
# File 'lib/zkt_client/models/base.rb', line 49 def update(id, params) validate_update_params!(params) response = HttpClient.put(url: url_with_id(id), headers:, params:) build_response(response) end |