Class: Trycourier::Resources::Users::Preferences
- Inherits:
-
Object
- Object
- Trycourier::Resources::Users::Preferences
- Defined in:
- lib/trycourier/resources/users/preferences.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Preferences
constructor
private
A new instance of Preferences.
-
#retrieve(user_id, tenant_id: nil, request_options: {}) ⇒ Trycourier::Models::Users::PreferenceRetrieveResponse
Some parameter documentations has been truncated, see Models::Users::PreferenceRetrieveParams for more details.
-
#retrieve_topic(topic_id, user_id: , tenant_id: nil, request_options: {}) ⇒ Trycourier::Models::Users::PreferenceRetrieveTopicResponse
Some parameter documentations has been truncated, see Models::Users::PreferenceRetrieveTopicParams for more details.
-
#update_or_create_topic(topic_id, user_id: , topic: , tenant_id: nil, request_options: {}) ⇒ Trycourier::Models::Users::PreferenceUpdateOrCreateTopicResponse
Some parameter documentations has been truncated, see Models::Users::PreferenceUpdateOrCreateTopicParams for more details.
Constructor Details
#initialize(client:) ⇒ Preferences
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 Preferences.
108 109 110 |
# File 'lib/trycourier/resources/users/preferences.rb', line 108 def initialize(client:) @client = client end |
Instance Method Details
#retrieve(user_id, tenant_id: nil, request_options: {}) ⇒ Trycourier::Models::Users::PreferenceRetrieveResponse
Some parameter documentations has been truncated, see Models::Users::PreferenceRetrieveParams for more details.
Fetch all user preferences.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/trycourier/resources/users/preferences.rb', line 23 def retrieve(user_id, params = {}) parsed, = Trycourier::Users::PreferenceRetrieveParams.dump_request(params) @client.request( method: :get, path: ["users/%1$s/preferences", user_id], query: parsed, model: Trycourier::Models::Users::PreferenceRetrieveResponse, options: ) end |
#retrieve_topic(topic_id, user_id: , tenant_id: nil, request_options: {}) ⇒ Trycourier::Models::Users::PreferenceRetrieveTopicResponse
Some parameter documentations has been truncated, see Models::Users::PreferenceRetrieveTopicParams for more details.
Fetch user preferences for a specific subscription topic.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/trycourier/resources/users/preferences.rb', line 52 def retrieve_topic(topic_id, params) parsed, = Trycourier::Users::PreferenceRetrieveTopicParams.dump_request(params) user_id = parsed.delete(:user_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["users/%1$s/preferences/%2$s", user_id, topic_id], query: parsed, model: Trycourier::Models::Users::PreferenceRetrieveTopicResponse, options: ) end |
#update_or_create_topic(topic_id, user_id: , topic: , tenant_id: nil, request_options: {}) ⇒ Trycourier::Models::Users::PreferenceUpdateOrCreateTopicResponse
Some parameter documentations has been truncated, see Models::Users::PreferenceUpdateOrCreateTopicParams for more details.
Update or Create user preferences for a specific subscription topic.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/trycourier/resources/users/preferences.rb', line 88 def update_or_create_topic(topic_id, params) parsed, = Trycourier::Users::PreferenceUpdateOrCreateTopicParams.dump_request(params) user_id = parsed.delete(:user_id) do raise ArgumentError.new("missing required path argument #{_1}") end query_params = [:tenant_id] @client.request( method: :put, path: ["users/%1$s/preferences/%2$s", user_id, topic_id], query: parsed.slice(*query_params), body: parsed.except(*query_params), model: Trycourier::Models::Users::PreferenceUpdateOrCreateTopicResponse, options: ) end |