Class: Courrier::Email::Provider
- Inherits:
-
Object
- Object
- Courrier::Email::Provider
- Defined in:
- lib/courrier/email/provider.rb
Instance Method Summary collapse
- #deliver ⇒ Object
-
#initialize(provider: nil, api_key: nil, options: {}, provider_options: {}, context_options: {}) ⇒ Provider
constructor
A new instance of Provider.
Constructor Details
#initialize(provider: nil, api_key: nil, options: {}, provider_options: {}, context_options: {}) ⇒ Provider
Returns a new instance of Provider.
19 20 21 22 23 24 25 |
# File 'lib/courrier/email/provider.rb', line 19 def initialize(provider: nil, api_key: nil, options: {}, provider_options: {}, context_options: {}) @provider = provider @api_key = api_key = = = end |
Instance Method Details
#deliver ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/courrier/email/provider.rb', line 27 def deliver raise Courrier::ConfigurationError, "`provider` and `api_key` must be configured for production environment" if configuration_missing_in_production? raise Courrier::ConfigurationError, "Unknown provider. Choose one of `#{comma_separated_providers}` or provide your own." if @provider.empty? || @provider.nil? provider_class.new( api_key: @api_key, options: , provider_options: , context_options: ).deliver end |