Class: Courier::Resources::Providers
- Inherits:
-
Object
- Object
- Courier::Resources::Providers
- Defined in:
- lib/courier/resources/providers.rb,
lib/courier/resources/providers/catalog.rb,
sig/courier/resources/providers.rbs,
sig/courier/resources/providers/catalog.rbs
Overview
Configure the channel providers Courier delivers through, and browse the provider types it supports.
Defined Under Namespace
Classes: Catalog
Instance Attribute Summary collapse
-
#catalog ⇒ Courier::Resources::Providers::Catalog
readonly
Configure the channel providers Courier delivers through, and browse the provider types it supports.
Instance Method Summary collapse
-
#create(provider:, alias_: nil, settings: nil, title: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::Provider
Some parameter documentations has been truncated, see Models::ProviderCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ nil
Deletes a provider configuration, which fails while routing strategies or templates still reference it.
-
#initialize(client:) ⇒ Providers
constructor
private
A new instance of Providers.
-
#list(cursor: nil, request_options: {}) ⇒ Courier::Models::ProviderListResponse
Lists the provider integrations configured in the workspace, one entry per channel and provider key with its alias and settings.
-
#retrieve(id, request_options: {}) ⇒ Courier::Models::Provider
Returns one configured provider by id, including its channel, provider key, alias, title, and current settings.
-
#update(id, provider:, alias_: nil, settings: nil, title: nil, request_options: {}) ⇒ Courier::Models::Provider
Some parameter documentations has been truncated, see Models::ProviderUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Providers
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 Providers.
155 156 157 158 |
# File 'lib/courier/resources/providers.rb', line 155 def initialize(client:) @client = client @catalog = Courier::Resources::Providers::Catalog.new(client: client) end |
Instance Attribute Details
#catalog ⇒ Courier::Resources::Providers::Catalog (readonly)
Configure the channel providers Courier delivers through, and browse the provider types it supports.
11 12 13 |
# File 'lib/courier/resources/providers.rb', line 11 def catalog @catalog end |
Instance Method Details
#create(provider:, alias_: nil, settings: nil, title: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::Provider
Some parameter documentations has been truncated, see Models::ProviderCreateParams for more details.
Configures a provider integration from a Courier provider key and its settings. Check the catalog endpoint for the schema each provider expects.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/courier/resources/providers.rb', line 38 def create(params) parsed, = Courier::ProviderCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"} @client.request( method: :post, path: "providers", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Courier::Provider, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Deletes a provider configuration, which fails while routing strategies or templates still reference it. Update those references first.
143 144 145 146 147 148 149 150 |
# File 'lib/courier/resources/providers.rb', line 143 def delete(id, params = {}) @client.request( method: :delete, path: ["providers/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#list(cursor: nil, request_options: {}) ⇒ Courier::Models::ProviderListResponse
Lists the provider integrations configured in the workspace, one entry per channel and provider key with its alias and settings.
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/courier/resources/providers.rb', line 119 def list(params = {}) parsed, = Courier::ProviderListParams.dump_request(params) query = Courier::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "providers", query: query, model: Courier::Models::ProviderListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ Courier::Models::Provider
Returns one configured provider by id, including its channel, provider key, alias, title, and current settings.
64 65 66 67 68 69 70 71 |
# File 'lib/courier/resources/providers.rb', line 64 def retrieve(id, params = {}) @client.request( method: :get, path: ["providers/%1$s", id], model: Courier::Provider, options: params[:request_options] ) end |
#update(id, provider:, alias_: nil, settings: nil, title: nil, request_options: {}) ⇒ Courier::Models::Provider
Some parameter documentations has been truncated, see Models::ProviderUpdateParams for more details.
Replaces a provider's configuration in full, clearing any field you omit rather than merging it. Send the complete settings object.
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/courier/resources/providers.rb', line 96 def update(id, params) parsed, = Courier::ProviderUpdateParams.dump_request(params) @client.request( method: :put, path: ["providers/%1$s", id], body: parsed, model: Courier::Provider, options: ) end |