Class: Mailersend::Client
- Inherits:
-
Object
- Object
- Mailersend::Client
- Defined in:
- lib/mailersend/client.rb
Overview
Inits the client.
Instance Method Summary collapse
- #http ⇒ Object
-
#initialize(api_token = ENV.fetch('MAILERSEND_API_TOKEN', nil)) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_token = ENV.fetch('MAILERSEND_API_TOKEN', nil)) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 |
# File 'lib/mailersend/client.rb', line 14 def initialize(api_token = ENV.fetch('MAILERSEND_API_TOKEN', nil)) raise ArgumentError, 'API token is not provided' if api_token.nil? @api_token = api_token end |
Instance Method Details
#http ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/mailersend/client.rb', line 20 def http HTTP .timeout(connect: 15, read: 30) .auth("Bearer #{@api_token}") .headers('User-Agent' => "MailerSend-client-ruby/#{Mailersend::VERSION}", 'Accept' => 'application/json') end |