Permalink
Browse files

Sailthru::Client#send -> #send_email

Naming the method send causes problems with Delayed and Resque. Also,
you should probably never name a method "send".
  • Loading branch information...
1 parent 3b3bf60 commit b31dd4717f3ccade754557ca7bc663946489c3be @levicole committed Mar 5, 2013
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/sailthru.rb
  2. +2 −2 test/sailthru/send_test.rb
View
@@ -120,7 +120,7 @@ def initialize(api_key, secret, api_uri=nil, proxy_host=nil, proxy_port=nil)
# 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)
+ def send_email(template_name, email, vars={}, options = {}, schedule_time = nil)
post = {}
post[:template] = template_name
post[:email] = email
@@ -35,15 +35,15 @@ class SendTest < Test::Unit::TestCase
template_name = 'default'
email = 'example@example.com'
stub_post(@api_call_url, 'send_get_valid.json')
- response = @sailthru_client.send template_name, email, {"name" => "Unix", "myvar" => [1111,2,3], "mycomplexvar" => {"tags" => ["obama", "aaa", "c"]}}
+ response = @sailthru_client.send_email template_name, email, {"name" => "Unix", "myvar" => [1111,2,3], "mycomplexvar" => {"tags" => ["obama", "aaa", "c"]}}
assert_equal template_name, response['template']
end
should "not be able to post send with invalid template name and/or email" do
template_name = 'invalid-template'
email = 'example@example.com'
stub_post(@api_call_url, 'send_post_invalid.json')
- response = @sailthru_client.send template_name, email, {"name" => "Unix", "myvar" => [1111,2,3], "mycomplexvar" => {"tags" => ["obama", "aaa", "c"]}}
+ response = @sailthru_client.send_email template_name, email, {"name" => "Unix", "myvar" => [1111,2,3], "mycomplexvar" => {"tags" => ["obama", "aaa", "c"]}}
assert_equal 14, response['error']
end

0 comments on commit b31dd47

Please sign in to comment.