Class: Courier::Resources::Providers
- Inherits:
-
Object
- Object
- Courier::Resources::Providers
- Defined in:
- lib/courier/resources/providers.rb,
lib/courier/resources/providers/catalog.rb
Defined Under Namespace
Classes: Catalog
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(provider:, alias_: nil, settings: nil, title: nil, request_options: {}) ⇒ Courier::Models::Provider
Some parameter documentations has been truncated, see Models::ProviderCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ nil
Delete a provider configuration.
-
#initialize(client:) ⇒ Providers
constructor
private
A new instance of Providers.
-
#list(cursor: nil, request_options: {}) ⇒ Courier::Models::ProviderListResponse
List configured provider integrations for the current workspace.
-
#retrieve(id, request_options: {}) ⇒ Courier::Models::Provider
Fetch a single provider configuration by ID.
-
#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.
146 147 148 149 |
# File 'lib/courier/resources/providers.rb', line 146 def initialize(client:) @client = client @catalog = Courier::Resources::Providers::Catalog.new(client: client) end |
Instance Attribute Details
#catalog ⇒ Courier::Resources::Providers::Catalog (readonly)
7 8 9 |
# File 'lib/courier/resources/providers.rb', line 7 def catalog @catalog end |
Instance Method Details
#create(provider:, alias_: nil, settings: nil, title: nil, request_options: {}) ⇒ Courier::Models::Provider
Some parameter documentations has been truncated, see Models::ProviderCreateParams for more details.
Create a new provider configuration. The ‘provider` field must be a known Courier provider key (see catalog).
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/courier/resources/providers.rb', line 30 def create(params) parsed, = Courier::ProviderCreateParams.dump_request(params) @client.request( method: :post, path: "providers", body: parsed, model: Courier::Provider, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Delete a provider configuration. Returns 409 if the provider is still referenced by routing or notifications.
134 135 136 137 138 139 140 141 |
# File 'lib/courier/resources/providers.rb', line 134 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
List configured provider integrations for the current workspace. Supports cursor-based pagination.
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/courier/resources/providers.rb', line 110 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
Fetch a single provider configuration by ID.
52 53 54 55 56 57 58 59 |
# File 'lib/courier/resources/providers.rb', line 52 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.
Replace an existing provider configuration. The ‘provider` key is required and determines which provider-specific settings schema is applied. All other fields are optional — omitted fields are cleared from the stored configuration (this is a full replacement, not a partial merge). Changing the provider type for an existing configuration is not supported.
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/courier/resources/providers.rb', line 87 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 |