Class: Courier::Resources::WorkspacePreferences::Topics
- Inherits:
-
Object
- Object
- Courier::Resources::WorkspacePreferences::Topics
- Defined in:
- lib/courier/resources/workspace_preferences/topics.rb
Instance Method Summary collapse
-
#archive(topic_id, section_id:, request_options: {}) ⇒ nil
Archive a topic and remove it from its workspace preference.
-
#create(section_id, default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicCreateParams for more details.
-
#initialize(client:) ⇒ Topics
constructor
private
A new instance of Topics.
-
#list(section_id, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicListResponse
List the topics in a workspace preference.
-
#replace(topic_id, section_id:, default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicReplaceParams for more details.
-
#retrieve(topic_id, section_id:, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Retrieve a topic within a workspace preference.
Constructor Details
#initialize(client:) ⇒ Topics
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 Topics.
170 171 172 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 170 def initialize(client:) @client = client end |
Instance Method Details
#archive(topic_id, section_id:, request_options: {}) ⇒ nil
Archive a topic and remove it from its workspace preference. Same 404 rules as GET.
109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 109 def archive(topic_id, params) parsed, = Courier::WorkspacePreferences::TopicArchiveParams.dump_request(params) section_id = parsed.delete(:section_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id], model: NilClass, options: ) end |
#create(section_id, default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicCreateParams for more details.
Create a subscription preference topic inside a workspace preference. Fails with 404 if the workspace preference does not exist. The topic id is generated and returned.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 35 def create(section_id, params) parsed, = Courier::WorkspacePreferences::TopicCreateParams.dump_request(params) @client.request( method: :post, path: ["preferences/sections/%1$s/topics", section_id], body: parsed, model: Courier::WorkspacePreferenceTopicGetResponse, options: ) end |
#list(section_id, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicListResponse
List the topics in a workspace preference.
86 87 88 89 90 91 92 93 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 86 def list(section_id, params = {}) @client.request( method: :get, path: ["preferences/sections/%1$s/topics", section_id], model: Courier::WorkspacePreferenceTopicListResponse, options: params[:request_options] ) end |
#replace(topic_id, section_id:, default_status:, name:, allowed_preferences: nil, include_unsubscribe_header: nil, routing_options: nil, topic_data: nil, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Some parameter documentations has been truncated, see Models::WorkspacePreferences::TopicReplaceParams for more details.
Replace a topic within a workspace preference. Full document replacement; missing optional fields are cleared. Same 404 rules as GET.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 152 def replace(topic_id, params) parsed, = Courier::WorkspacePreferences::TopicReplaceParams.dump_request(params) section_id = parsed.delete(:section_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id], body: parsed, model: Courier::WorkspacePreferenceTopicGetResponse, options: ) end |
#retrieve(topic_id, section_id:, request_options: {}) ⇒ Courier::Models::WorkspacePreferenceTopicGetResponse
Retrieve a topic within a workspace preference. Returns 404 if the workspace preference does not exist, the topic does not exist, or the topic belongs to a different workspace preference.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/courier/resources/workspace_preferences/topics.rb', line 61 def retrieve(topic_id, params) parsed, = Courier::WorkspacePreferences::TopicRetrieveParams.dump_request(params) section_id = parsed.delete(:section_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["preferences/sections/%1$s/topics/%2$s", section_id, topic_id], model: Courier::WorkspacePreferenceTopicGetResponse, options: ) end |