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.nil?) ? ENV['SMTP_USERNAME'] : api_user
  @api_key = (api_key.nil?) ? ENV['SMTP_PASSWORD'] : api_key

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