lib/mailstro.rb in mailstro-0.0.8 vs lib/mailstro.rb in mailstro-0.0.9
- old
+ new
@@ -3,31 +3,19 @@
require_relative "mailstro/version"
require_relative "mailstro/configuration"
require_relative "mailstro/error"
require_relative "mailstro/resource"
require_relative "mailstro/delivery"
-require_relative "mailstro/list_delivery"
-require_relative "mailstro/list_subscribe"
-require_relative "mailstro/list_unsubscribe"
module Mailstro
# Allows us to remove default behaviour during testing.
class RealStrategy
class << self
def deliver(options)
Delivery.new(options).deliver
end
- def list_deliver(options)
- ListDelivery.new(options).deliver
- end
- def subscribe(contact_email, list_type, list_name)
- ListSubscribe.new(contact_email, list_type, list_name).deliver
- end
- def unsubscribe(contact_email, list_type, list_name)
- ListUnsubscribe.new(contact_email, list_type, list_name).deliver
- end
end
end
class << self
attr_accessor :configuration, :strategy
@@ -39,32 +27,12 @@
def self.configure
yield(@configuration) && @configuration.validate!
end
def self.deliver(options)
- if options[:to].is_a?(Array)
- @strategy.list_deliver(options)
- else
- @strategy.deliver(options)
- end
+ @strategy.deliver(options)
end
- def self.subscribe(contact_email, list_type, list_name)
- @strategy.subscribe(contact_email, list_type, list_name)
- end
-
- def self.unsubscribe(contact_email, list_type, list_name)
- @strategy.unsubscribe(contact_email, list_type, list_name)
- end
-
def self.has_delivered?(template_name)
TestStrategy.has_delivered?(template_name)
- end
-
- def self.has_subscribed?(contact_email, list_type, list_name)
- TestStrategy.has_subscribed?(contact_email, list_type, list_name)
- end
-
- def self.has_unsubscribed?(contact_email, list_type, list_name)
- TestStrategy.has_unsubscribed?(contact_email, list_type, list_name)
end
end