Sha256: 7cde9349066de25640f7c4149f3f6fa41bead35a8a36efd8a7a98bff41638a91

Contents?: true

Size: 911 Bytes

Versions: 1

Compression:

Stored size: 911 Bytes

Contents

require 'faraday'

require_relative 'mailstro/version'
require_relative 'mailstro/configuration'
require_relative 'mailstro/error'
require_relative 'mailstro/resource'
require_relative 'mailstro/delivery'
require_relative 'mailstro/test_strategy'


module Mailstro
  # We want this disabled by default to avoid accidental emails.
  class ProductionStrategy
    class << self
      def deliver(email_name, options)
        Delivery.new(email_name, options).deliver
      end
    end
  end

  class << self
    attr_accessor :configuration, :strategy
  end

  @strategy      = TestStrategy
  @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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mailstro-0.1.0 lib/mailstro.rb