Class: Courrier::Email::Providers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/courrier/email/providers/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, options: {}, provider_options: {}, context_options: {}) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
# File 'lib/courrier/email/providers/base.rb', line 9

def initialize(api_key: nil, options: {}, provider_options: {}, context_options: {})
  @api_key = api_key
  @options = options
  @provider_options = provider_options
  @context_options = context_options
end

Instance Method Details

#bodyObject



26
# File 'lib/courrier/email/providers/base.rb', line 26

def body = raise Courrier::NotImplementedError, "Provider class must implement `body`"

#deliverObject



16
17
18
19
20
21
22
23
24
# File 'lib/courrier/email/providers/base.rb', line 16

def deliver
  Request.new(
    endpoint_url: endpoint_url,
    body: body,
    provider: provider,
    headers: headers,
    content_type: content_type
  ).post
end