Class: Courier::Models::Provider

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/courier/models/provider.rb,
sig/courier/models/provider.rbs

Overview

See Also:

  • Courier::Resources::Providers#create

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, created:, provider:, settings:, title:, alias_: nil, updated: nil) ⇒ Provider

Some parameter documentations has been truncated, see Courier::Models::Provider for more details.

A configured provider in the workspace.

Parameters:

  • id (String) —

    A unique identifier for the provider configuration.

  • created (Integer) —

    Unix timestamp (ms) of when the provider was created.

  • provider (String) —

    The provider key (e.g. "sendgrid", "twilio", "slack").

  • settings (Hash{Symbol=>Object}) —

    Provider-specific settings (snake_case keys on the wire). rate_limit is this c

  • title (String) —

    Display title. Defaults to "Default Configuration" when not explicitly set.

  • alias_ (String) (defaults to: nil) —

    Optional alias for this configuration.

  • updated (Integer, nil) (defaults to: nil) —

    Unix timestamp (ms) of when the provider was last updated.

  • id: (String)
  • created: (Integer)
  • provider: (String)
  • settings: (::Hash[Symbol, top])
  • title: (String)
  • alias_: (String) (defaults to: nil)
  • updated: (Integer, nil) (defaults to: nil)


# File 'lib/courier/models/provider.rb', line 52

Instance Attribute Details

#alias_ ⇒ String?

Optional alias for this configuration.

Parameters:

  • (String)

Returns:

  • (String, nil)


44
# File 'lib/courier/models/provider.rb', line 44

optional :alias_, String, api_name: :alias

#created ⇒ Integer

Unix timestamp (ms) of when the provider was created.

Parameters:

  • value (Integer)

Returns:

  • (Integer)


17
# File 'lib/courier/models/provider.rb', line 17

required :created, Integer

#id ⇒ String

A unique identifier for the provider configuration.

Parameters:

  • value (String)

Returns:

  • (String)


11
# File 'lib/courier/models/provider.rb', line 11

required :id, String

#provider ⇒ String

The provider key (e.g. "sendgrid", "twilio", "slack").

Parameters:

  • value (String)

Returns:

  • (String)


23
# File 'lib/courier/models/provider.rb', line 23

required :provider, String

#settings ⇒ Hash{Symbol=>Object}

Provider-specific settings (snake_case keys on the wire). rate_limit is this configuration's send rate limit, { "rate": number, "period": "second" | "minute" | "hour" }, or null for no limit.

Parameters:

  • value (::Hash[Symbol, top])

Returns:

  • (Hash{Symbol=>Object})


32
# File 'lib/courier/models/provider.rb', line 32

required :settings, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown]

#title ⇒ String

Display title. Defaults to "Default Configuration" when not explicitly set.

Parameters:

  • value (String)

Returns:

  • (String)


38
# File 'lib/courier/models/provider.rb', line 38

required :title, String

#updated ⇒ Integer?

Unix timestamp (ms) of when the provider was last updated.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


50
# File 'lib/courier/models/provider.rb', line 50

optional :updated, Integer, nil?: true

Instance Method Details

#to_hash ⇒ { id: String, created: Integer, provider: String, settings: ::Hash[Symbol, top], title: String, alias_: String, updated: Integer? }

Returns:

  • ({ id: String, created: Integer, provider: String, settings: ::Hash[Symbol, top], title: String, alias_: String, updated: Integer? })


41
42
43
44
45
46
47
48
49
# File 'sig/courier/models/provider.rbs', line 41

def to_hash: -> {
  id: String,
  created: Integer,
  provider: String,
  settings: ::Hash[Symbol, top],
  title: String,
  alias_: String,
  updated: Integer?
}