Class: Ghostcrawl::ProfilesClient
- Inherits:
-
Object
- Object
- Ghostcrawl::ProfilesClient
- Defined in:
- lib/ghostcrawl/client.rb
Overview
Manage identity profiles — /v1/profiles.
Instance Method Summary collapse
-
#create(name:, **config) ⇒ Object
Create a new profile.
-
#delete(name) ⇒ Object
Delete a profile.
-
#get(name) ⇒ Object
Get a profile by name.
-
#initialize(v1, adapter = nil) ⇒ ProfilesClient
constructor
A new instance of ProfilesClient.
-
#list ⇒ Object
List all profiles.
-
#update(name, **config) ⇒ Object
Update a profile.
Constructor Details
#initialize(v1, adapter = nil) ⇒ ProfilesClient
Returns a new instance of ProfilesClient.
687 688 689 690 |
# File 'lib/ghostcrawl/client.rb', line 687 def initialize(v1, adapter = nil) @v1 = v1 @adapter = adapter end |
Instance Method Details
#create(name:, **config) ⇒ Object
Create a new profile. Delegates to POST /v1/profiles via the generated ProfilesRequestBuilder.
706 707 708 709 |
# File 'lib/ghostcrawl/client.rb', line 706 def create(name:, **config) body = AdditionalDataBody.new({ "name" => name }.merge(config.transform_keys(&:to_s))) ResponseHelper.to_hash(@v1.profiles.post(body)) end |
#delete(name) ⇒ Object
Delete a profile. Delegates to DELETE /v1/profiles/name via the generated builder. The endpoint answers 204 No Content; routing through ResponseHelper.void_request! avoids the Kiota JSON parser choking on the empty body.
721 722 723 |
# File 'lib/ghostcrawl/client.rb', line 721 def delete(name) ResponseHelper.void_request!(@adapter, @v1.profiles.by_name(name).to_delete_request_information(nil)) end |
#get(name) ⇒ Object
Get a profile by name. Delegates to GET /v1/profiles/name via the generated builder.
700 701 702 |
# File 'lib/ghostcrawl/client.rb', line 700 def get(name) ResponseHelper.to_hash(@v1.profiles.by_name(name).get) end |
#list ⇒ Object
List all profiles. Delegates to GET /v1/profiles via the generated ProfilesRequestBuilder.
694 695 696 |
# File 'lib/ghostcrawl/client.rb', line 694 def list ResponseHelper.to_hash(@v1.profiles.get) end |
#update(name, **config) ⇒ Object
Update a profile. Delegates to PUT /v1/profiles/name via the generated builder.
713 714 715 |
# File 'lib/ghostcrawl/client.rb', line 713 def update(name, **config) ResponseHelper.to_hash(@v1.profiles.by_name(name).put(AdditionalDataBody.new(config.transform_keys(&:to_s)))) end |