require 'faraday' require_relative "mailstro/version" require_relative "mailstro/configuration" require_relative "mailstro/error" require_relative "mailstro/resource" require_relative "mailstro/delivery" module Mailstro # Allows us to remove default behaviour during testing. class RealStrategy class << self def deliver(email_name, options) Delivery.new(email_name, options).deliver end end end class << self attr_accessor :configuration, :strategy end @strategy = RealStrategy @configuration = Configuration.new def self.configure yield(@configuration) && @configuration.validate! end def self.deliver(email_name, options) @strategy.deliver(email_name, options) end def self.has_delivered?(email_name, options={}) TestStrategy.has_delivered?(email_name, options) end end