Sha256: f9920421dc4585346a3de1bcfcdb510d1ba3c4448f2758b9214533240d5da1de
Contents?: true
Size: 892 Bytes
Versions: 6
Compression:
Stored size: 892 Bytes
Contents
require 'singleton' require 'howitzer/mailgun_api/client' require 'howitzer/exceptions' module Howitzer module MailgunApi # This class represent connector to Mailgun service class Connector include Singleton attr_reader :api_key attr_accessor :domain # Assigns default value for a domain def initialize self.domain = Howitzer.mailgun_domain end # @return [Client] a mailgun client # @raise [InvalidApiKeyError] if api_key is blank def client(api_key = Howitzer.mailgun_key) check_api_key(api_key) return @client if @api_key == api_key && @api_key @api_key = api_key @client = Client.new(api_key: @api_key) end private def check_api_key(api_key) raise Howitzer::InvalidApiKeyError, 'Api key can not be blank' if api_key.blank? end end end end
Version data entries
6 entries across 6 versions & 1 rubygems