Sha256: e6553afc7cea976651c482e8c0b87e1f371882ee961d6fcfed053c13349408d1
Contents?: true
Size: 965 Bytes
Versions: 1
Compression:
Stored size: 965 Bytes
Contents
require 'rest_client' require 'monkey_mail/clients/base_client' module MonkeyMail module Clients class MailgunClient < BaseClient attr_reader :api_key, :domain def initialize(api_key, domain) @api_key = api_key @domain = domain end def send_template(template_name:, subject:, from_email:, from_name:, to:, vars:) payload = { :from => "#{from_name} <#{from_email}>", :to => to.join(', '), :subject => subject, :template => template_name, 't:variables' => vars.to_json } RestClient::Request.execute(method: :post, url: messages_url, payload: payload) end private def messages_url "#{api_url}/messages" end def api_url "https://api:#{api_key}@api.mailgun.net/v3/#{domain}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
monkey-mail-0.1.0 | lib/monkey_mail/clients/mailgun_client.rb |