lib/sailthru.rb in sailthru-client-1.11 vs lib/sailthru.rb in sailthru-client-1.12

- old
+ new

@@ -7,11 +7,11 @@ require 'digest/md5' require 'net/http/post/multipart' module Sailthru - Version = VERSION = '1.11' + Version = VERSION = '1.12' class SailthruClientException < Exception end module Helpers @@ -128,37 +128,27 @@ # replyto: override Reply-To header # test: send as test email (subject line will be marked, will not count towards stats) # returns: # Hash, response data from server def send(template_name, email, vars={}, options = {}, schedule_time = nil) - post = options ? options : {} + post = {} post[:template] = template_name post[:email] = email - - if vars.length > 0 - post[:vars] = vars - end - - if schedule_time != nil - post[:schedule_time] = schedule_time - end + post[:vars] = vars if vars.length >= 1 + post[:options] = options if options.length >= 1 + post[:schedule_time] = schedule_time if !schedule_time.nil? return self.api_post(:send, post) end - def multi_send(template_name, emails, vars={}, options = {}, schedule_time = nil) - post = options ? options : {} + def multi_send(template_name, emails, vars={}, options = {}, schedule_time = nil, evars = {}) + post = {} post[:template] = template_name post[:email] = emails - - if schedule_time != nil - post[:schedule_time] = schedule_time - end - - if vars.length > 0 - post[:vars] = vars - end - + post[:vars] = vars if vars.length >= 1 + post[:options] = options if options.length >= 1 + post[:schedule_time] = schedule_time if !schedule_time.nil? + post[:evars] = evars if evars.length >= 1 return self.api_post(:send, post) end # params: