Class: Courier::Resources::RoutingStrategies
- Inherits:
-
Object
- Object
- Courier::Resources::RoutingStrategies
- Defined in:
- lib/courier/resources/routing_strategies.rb
Instance Method Summary collapse
-
#archive(id, request_options: {}) ⇒ nil
Archive a routing strategy.
-
#create(name:, routing:, channels: nil, description: nil, providers: nil, tags: nil, request_options: {}) ⇒ Courier::Models::RoutingStrategyGetResponse
Create a routing strategy.
-
#initialize(client:) ⇒ RoutingStrategies
constructor
private
A new instance of RoutingStrategies.
-
#list(cursor: nil, limit: nil, request_options: {}) ⇒ Courier::Models::RoutingStrategyListResponse
List routing strategies in your workspace.
-
#list_notifications(id, cursor: nil, limit: nil, request_options: {}) ⇒ Courier::Models::AssociatedNotificationListResponse
List notification templates associated with a routing strategy.
-
#replace(id, name:, routing:, channels: nil, description: nil, providers: nil, tags: nil, request_options: {}) ⇒ Courier::Models::RoutingStrategyGetResponse
Replace a routing strategy.
-
#retrieve(id, request_options: {}) ⇒ Courier::Models::RoutingStrategyGetResponse
Retrieve a routing strategy by ID.
Constructor Details
#initialize(client:) ⇒ RoutingStrategies
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 RoutingStrategies.
174 175 176 |
# File 'lib/courier/resources/routing_strategies.rb', line 174 def initialize(client:) @client = client end |
Instance Method Details
#archive(id, request_options: {}) ⇒ nil
Archive a routing strategy. The strategy must not have associated notification templates. Unlink all templates before archiving.
99 100 101 102 103 104 105 106 |
# File 'lib/courier/resources/routing_strategies.rb', line 99 def archive(id, params = {}) @client.request( method: :delete, path: ["routing-strategies/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#create(name:, routing:, channels: nil, description: nil, providers: nil, tags: nil, request_options: {}) ⇒ Courier::Models::RoutingStrategyGetResponse
Create a routing strategy. Requires a name and routing configuration at minimum. Channels and providers default to empty if omitted.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/courier/resources/routing_strategies.rb', line 28 def create(params) parsed, = Courier::RoutingStrategyCreateParams.dump_request(params) @client.request( method: :post, path: "routing-strategies", body: parsed, model: Courier::RoutingStrategyGetResponse, options: ) end |
#list(cursor: nil, limit: nil, request_options: {}) ⇒ Courier::Models::RoutingStrategyListResponse
List routing strategies in your workspace. Returns metadata only (no routing/channels/providers content). Use GET /routing-strategies/id for full details.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/courier/resources/routing_strategies.rb', line 75 def list(params = {}) parsed, = Courier::RoutingStrategyListParams.dump_request(params) query = Courier::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "routing-strategies", query: query, model: Courier::RoutingStrategyListResponse, options: ) end |
#list_notifications(id, cursor: nil, limit: nil, request_options: {}) ⇒ Courier::Models::AssociatedNotificationListResponse
List notification templates associated with a routing strategy. Includes template metadata only, not full content.
124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/courier/resources/routing_strategies.rb', line 124 def list_notifications(id, params = {}) parsed, = Courier::RoutingStrategyListNotificationsParams.dump_request(params) query = Courier::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["routing-strategies/%1$s/notifications", id], query: query, model: Courier::AssociatedNotificationListResponse, options: ) end |
#replace(id, name:, routing:, channels: nil, description: nil, providers: nil, tags: nil, request_options: {}) ⇒ Courier::Models::RoutingStrategyGetResponse
Replace a routing strategy. Full document replacement; the caller must send the complete desired state. Missing optional fields are cleared.
160 161 162 163 164 165 166 167 168 169 |
# File 'lib/courier/resources/routing_strategies.rb', line 160 def replace(id, params) parsed, = Courier::RoutingStrategyReplaceParams.dump_request(params) @client.request( method: :put, path: ["routing-strategies/%1$s", id], body: parsed, model: Courier::RoutingStrategyGetResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ Courier::Models::RoutingStrategyGetResponse
Retrieve a routing strategy by ID. Returns the full entity including routing content and metadata.
51 52 53 54 55 56 57 58 |
# File 'lib/courier/resources/routing_strategies.rb', line 51 def retrieve(id, params = {}) @client.request( method: :get, path: ["routing-strategies/%1$s", id], model: Courier::RoutingStrategyGetResponse, options: params[:request_options] ) end |