Sha256: 6a2350f0e205498332ded9d1c0593e1320acc83b983705abc64f0020ef381bd6
Contents?: true
Size: 719 Bytes
Versions: 2
Compression:
Stored size: 719 Bytes
Contents
# frozen_string_literal: true require 'http' API_URL = 'https://api.mailersend.com/v1' API_BASE_HOST = 'api.mailersend.com' # mailersend-ruby is a gem that integrates all endpoints from MailerSend API module Mailersend attr_reader :api_token # Inits the client. class Client 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 def http HTTP .timeout(connect: 15, read: 30) .auth("Bearer #{@api_token}") .headers('User-Agent' => "MailerSend-client-ruby/#{Mailersend::VERSION}", 'Accept' => 'application/json') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mailersend-ruby-2.0.1 | lib/mailersend/client.rb |
mailersend-ruby-2.0.0 | lib/mailersend/client.rb |