Class: TwilioEmail::API

Inherits:
BaseInterface show all
Defined in:
lib/sendgrid/twilio_email.rb

Instance Attribute Summary

Attributes inherited from BaseInterface

#client, #host, #http_options, #impersonate_subuser, #request_headers, #version

Instance Method Summary collapse

Methods inherited from BaseInterface

#sendgrid_data_residency

Constructor Details

#initialize(username:, password:, host: nil, request_headers: nil, version: nil, impersonate_subuser: nil) ⇒ API

  • Args :

    • username -> your Twilio Email API key SID or Account SID

    • password -> your Twilio Email API key secret or Account Auth Token

    • host -> the base URL for the API

    • request_headers -> any headers that you want to be globally applied

    • version -> the version of the API you wish to access,

      currently only "v3" is supported
      
    • impersonate_subuser -> the subuser to impersonate, will be passed

      in the "On-Behalf-Of" header
      


14
15
16
17
18
19
# File 'lib/sendgrid/twilio_email.rb', line 14

def initialize(username:, password:, host: nil, request_headers: nil, version: nil, impersonate_subuser: nil)
  auth = "Basic #{Base64.strict_encode64("#{username}:#{password}")}"
  host ||= 'https://email.twilio.com'

  super(auth: auth, host: host, request_headers: request_headers, version: version, impersonate_subuser: impersonate_subuser)
end