sailthru-client 1.11 → 1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/sailthru.rb +11 -21
  2. metadata +4 -4
data/lib/sailthru.rb CHANGED
@@ -9,7 +9,7 @@ require 'net/http/post/multipart'
9
9
 
10
10
  module Sailthru
11
11
 
12
- Version = VERSION = '1.11'
12
+ Version = VERSION = '1.12'
13
13
 
14
14
  class SailthruClientException < Exception
15
15
  end
@@ -130,34 +130,24 @@ module Sailthru
130
130
  # returns:
131
131
  # Hash, response data from server
132
132
  def send(template_name, email, vars={}, options = {}, schedule_time = nil)
133
- post = options ? options : {}
133
+ post = {}
134
134
  post[:template] = template_name
135
135
  post[:email] = email
136
-
137
- if vars.length > 0
138
- post[:vars] = vars
139
- end
140
-
141
- if schedule_time != nil
142
- post[:schedule_time] = schedule_time
143
- end
136
+ post[:vars] = vars if vars.length >= 1
137
+ post[:options] = options if options.length >= 1
138
+ post[:schedule_time] = schedule_time if !schedule_time.nil?
144
139
  return self.api_post(:send, post)
145
140
  end
146
141
 
147
142
 
148
- def multi_send(template_name, emails, vars={}, options = {}, schedule_time = nil)
149
- post = options ? options : {}
143
+ def multi_send(template_name, emails, vars={}, options = {}, schedule_time = nil, evars = {})
144
+ post = {}
150
145
  post[:template] = template_name
151
146
  post[:email] = emails
152
-
153
- if schedule_time != nil
154
- post[:schedule_time] = schedule_time
155
- end
156
-
157
- if vars.length > 0
158
- post[:vars] = vars
159
- end
160
-
147
+ post[:vars] = vars if vars.length >= 1
148
+ post[:options] = options if options.length >= 1
149
+ post[:schedule_time] = schedule_time if !schedule_time.nil?
150
+ post[:evars] = evars if evars.length >= 1
161
151
  return self.api_post(:send, post)
162
152
  end
163
153
 
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sailthru-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 11
9
- version: "1.11"
8
+ - 12
9
+ version: "1.12"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Prajwal Tuladhar
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-06-15 00:00:00 Z
17
+ date: 2011-07-22 00:00:00 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: json