lib/mailstro/delivery.rb in mailstro-0.0.6 vs lib/mailstro/delivery.rb in mailstro-0.0.7

- old
+ new

@@ -1,21 +1,27 @@ module Mailstro class Delivery < Resource - def self.deliver(template_name, contact_email, data) - new(template_name, contact_email, data).deliver + def initialize(options) + @options = options end - attr_reader :contact_email, :template_name + def contact_email + @options.fetch(:to) + end - def initialize(template_name, contact_email, data) - @template_name = template_name - @contact_email = contact_email - @data = data + def template_name + @options.fetch(:template_name) end + def template_data + @options.fetch(:template_data, nil) + end + def deliver - post("deliveries", :template_name => @template_name, - :contact_email => @contact_email, - :data => @data) + post("deliveries", + :contact_email => contact_email, + :template_name => template_name, + :template_data => template_data + ) end end end