Class: Knockapi::Resources::Users::PreferenceCenter

Inherits:
Object
  • Object
show all
Defined in:
lib/knockapi/resources/users/preference_center.rb,
sig/knockapi/resources/users/preference_center.rbs

Overview

The preference center is a hosted page where users can manage their notification preferences.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PreferenceCenter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PreferenceCenter.

Parameters:



54
55
56
# File 'lib/knockapi/resources/users/preference_center.rb', line 54

def initialize(client:)
  @client = client
end

Instance Method Details

#generate_signed_url(user_id, request_options: {}) ⇒ Knockapi::Models::Users::PreferenceCenterGenerateSignedURLResponse

Generates a signed preference center URL and token for the given user in the current environment.

Parameters:

Returns:

See Also:



21
22
23
24
25
26
27
28
# File 'lib/knockapi/resources/users/preference_center.rb', line 21

def generate_signed_url(user_id, params = {})
  @client.request(
    method: :post,
    path: ["v1/users/%1$s/preference_center/signed_url", user_id],
    model: Knockapi::Models::Users::PreferenceCenterGenerateSignedURLResponse,
    options: params[:request_options]
  )
end

#get_config(user_id, request_options: {}) ⇒ Knockapi::Models::Users::PreferenceCenterGetConfigResponse

Returns the preference center config with environment metadata for the given user.

Parameters:

Returns:

See Also:



42
43
44
45
46
47
48
49
# File 'lib/knockapi/resources/users/preference_center.rb', line 42

def get_config(user_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/users/%1$s/preference_center/config", user_id],
    model: Knockapi::Models::Users::PreferenceCenterGetConfigResponse,
    options: params[:request_options]
  )
end