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.
646 647 648 649 |
# File 'lib/ghostcrawl/client.rb', line 646 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.
665 666 667 668 |
# File 'lib/ghostcrawl/client.rb', line 665 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.
680 681 682 |
# File 'lib/ghostcrawl/client.rb', line 680 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.
659 660 661 |
# File 'lib/ghostcrawl/client.rb', line 659 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.
653 654 655 |
# File 'lib/ghostcrawl/client.rb', line 653 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.
672 673 674 |
# File 'lib/ghostcrawl/client.rb', line 672 def update(name, **config) ResponseHelper.to_hash(@v1.profiles.by_name(name).put(AdditionalDataBody.new(config.transform_keys(&:to_s)))) end |