Class: Melaya::AssistantAPI
- Inherits:
-
Object
- Object
- Melaya::AssistantAPI
- Defined in:
- lib/melaya/assistant.rb
Overview
Assistant API — get and save the caller's onboarding / persona profile.
The profile is stored envelope-encrypted (service=assistant_profile) and used to personalise the in-app assistant experience.
Maps to /api/v1/private/assistant/profile.
Instance Method Summary collapse
-
#get_profile ⇒ Object
GET /api/v1/private/assistant/profile Get the caller's assistant onboarding profile.
-
#initialize(http) ⇒ AssistantAPI
constructor
A new instance of AssistantAPI.
-
#set_profile(name: nil, goals: nil, context: nil, preferences: nil, **extra) ⇒ Object
PUT /api/v1/private/assistant/profile Save the caller's assistant onboarding profile.
Constructor Details
#initialize(http) ⇒ AssistantAPI
Returns a new instance of AssistantAPI.
15 16 17 |
# File 'lib/melaya/assistant.rb', line 15 def initialize(http) @http = http end |
Instance Method Details
#get_profile ⇒ Object
GET /api/v1/private/assistant/profile Get the caller's assistant onboarding profile.
21 22 23 |
# File 'lib/melaya/assistant.rb', line 21 def get_profile @http.get("/api/v1/private/assistant/profile") end |
#set_profile(name: nil, goals: nil, context: nil, preferences: nil, **extra) ⇒ Object
PUT /api/v1/private/assistant/profile Save the caller's assistant onboarding profile.
32 33 34 35 36 37 38 39 |
# File 'lib/melaya/assistant.rb', line 32 def set_profile(name: nil, goals: nil, context: nil, preferences: nil, **extra) profile = extra.transform_keys(&:to_s) profile["name"] = name unless name.nil? profile["goals"] = goals unless goals.nil? profile["context"] = context unless context.nil? profile["preferences"] = preferences unless preferences.nil? @http.put("/api/v1/private/assistant/profile", profile) end |