Class: SendgridToolkit::AbstractSendgridClient

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgrid_toolkit/abstract_sendgrid_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_user = nil, api_key = nil) ⇒ AbstractSendgridClient

Returns a new instance of AbstractSendgridClient.



4
5
6
7
8
9
10
# File 'lib/sendgrid_toolkit/abstract_sendgrid_client.rb', line 4

def initialize(api_user = nil, api_key = nil)
  @api_user = api_user || SendgridToolkit.api_user || ENV['SMTP_USERNAME']
  @api_key = api_key || SendgridToolkit.api_key || ENV['SMTP_PASSWORD']

  raise SendgridToolkit::NoAPIUserSpecified if @api_user.nil? || @api_user.length == 0
  raise SendgridToolkit::NoAPIKeySpecified if @api_key.nil? || @api_key.length == 0
end