sendgrid_ruby 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +22 -3
- data/lib/sendgrid_ruby/email.rb +8 -0
- data/lib/sendgrid_ruby/version.rb +1 -1
- data/test/sendgrid_ruby/email.rb +20 -0
- data/test/sendgrid_ruby.rb +2 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2822e1d9f8088444667948b69ce987f4a6a80843
|
4
|
+
data.tar.gz: 1aefbb9b4bcf043b5edaa2efefcf3d9fd5c8cb3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77e3c9cc65020b32798bd9aaa8df4b0e63888e12e62a0a8c0892e1f2865375bf05fdb770537a5cf7ec7b5c0801c38eb334055d30cc7c3848b0b528d25fca5dc1
|
7
|
+
data.tar.gz: 320fc0652276780bef07dd8a4dcc81678da3dd3de20eb3e66203c1afe13f8d1226fde7ebac17a58de27d618fc7120e3599cff381673ec81d59a572d89690cbe5
|
data/README.md
CHANGED
@@ -55,7 +55,7 @@ mail.add_to('foo@bar.com')
|
|
55
55
|
.setHtml('<strong>Hello World!</strong>')
|
56
56
|
```
|
57
57
|
|
58
|
-
Send it.
|
58
|
+
Send it.
|
59
59
|
|
60
60
|
```Ruby
|
61
61
|
response = sendgrid.send(mail)
|
@@ -93,7 +93,7 @@ mail.add_to('foo@bar.com')
|
|
93
93
|
mail.get_tos
|
94
94
|
```
|
95
95
|
|
96
|
-
### remove_to
|
96
|
+
### remove_to
|
97
97
|
|
98
98
|
You might also find yourself wanting to remove a single TO from your set list of TOs. You can do that with `remove_to`. You can pass a string or regex to the remove_to method.
|
99
99
|
|
@@ -268,6 +268,26 @@ mail.add_to('foo@bar.com')
|
|
268
268
|
.add_filter("footer", "text/html", "<p style='color:red;'>Here is an HTML footer</p>")
|
269
269
|
```
|
270
270
|
|
271
|
+
### Scheduled send ###
|
272
|
+
|
273
|
+
You can specify delay to send. There are 2 parameters for delay sending.
|
274
|
+
|
275
|
+
#### send_all ####
|
276
|
+
```Ruby
|
277
|
+
mail = SendgridRuby::Email.new
|
278
|
+
localtime = Time.local(2014, 8, 29, 17, 56, 35)
|
279
|
+
mail.set_send_all(localtime)
|
280
|
+
```
|
281
|
+
|
282
|
+
#### send_each_at ####
|
283
|
+
```Ruby
|
284
|
+
mail = SendgridRuby::Email.new
|
285
|
+
localtime1 = Time.local(2014, 8, 29, 17, 56, 35)
|
286
|
+
localtime2 = Time.local(2013, 12, 31, 0, 0, 0)
|
287
|
+
localtime3 = Time.local(2015, 9, 1, 4, 5, 6)
|
288
|
+
mail.set_send_each_at([localtime1, localtime2, localtime3])
|
289
|
+
```
|
290
|
+
|
271
291
|
### Headers ###
|
272
292
|
|
273
293
|
You can add standard email message headers as necessary.
|
@@ -345,4 +365,3 @@ The existing tests in the `test` directory can be run using unit test.
|
|
345
365
|
````bash
|
346
366
|
rake test
|
347
367
|
```
|
348
|
-
|
data/lib/sendgrid_ruby/email.rb
CHANGED
@@ -257,6 +257,14 @@ module SendgridRuby
|
|
257
257
|
@smtpapi.add_filter(filter_name, parameter_name, parameter_value)
|
258
258
|
end
|
259
259
|
|
260
|
+
def set_send_all(send_all)
|
261
|
+
@smtpapi.set_send_all(send_all)
|
262
|
+
end
|
263
|
+
|
264
|
+
def set_send_each_at(send_each_at)
|
265
|
+
@smtpapi.set_send_each_at(send_each_at)
|
266
|
+
end
|
267
|
+
|
260
268
|
def get_headers()
|
261
269
|
@headers
|
262
270
|
end
|
data/test/sendgrid_ruby/email.rb
CHANGED
@@ -357,6 +357,26 @@ class EmailTest < Test::Unit::TestCase
|
|
357
357
|
assert_equal('{"unique_args":{"sub_1":["val_1.1","val_1.2","val_1.3"],"sub_2":["val_2.1","val_2.2"],"sub_3":["val_3.1","val_3.2","val_3.3","val_3.4"],"sub_4":["val_4.1","val_4.2","val_4.3"],"uncle":"bob"}}', email.smtpapi.json_string)
|
358
358
|
end
|
359
359
|
|
360
|
+
def test_send_all
|
361
|
+
email = SendgridRuby::Email.new
|
362
|
+
|
363
|
+
localtime = Time.local(2014, 8, 29, 17, 56, 35)
|
364
|
+
email.set_send_all(localtime)
|
365
|
+
|
366
|
+
assert_equal("{\"send_all\":\"#{localtime.to_i}\"}", email.smtpapi.json_string)
|
367
|
+
end
|
368
|
+
|
369
|
+
def test_send_each_at
|
370
|
+
email = SendgridRuby::Email.new
|
371
|
+
|
372
|
+
localtime1 = Time.local(2014, 8, 29, 17, 56, 35)
|
373
|
+
localtime2 = Time.local(2013, 12, 31, 0, 0, 0)
|
374
|
+
localtime3 = Time.local(2015, 9, 1, 4, 5, 6)
|
375
|
+
email.set_send_each_at([localtime1, localtime2, localtime3])
|
376
|
+
|
377
|
+
assert_equal("{\"send_each_at\":[\"#{localtime1.to_i}\",\"#{localtime2.to_i}\",\"#{localtime3.to_i}\"]}", email.smtpapi.json_string)
|
378
|
+
end
|
379
|
+
|
360
380
|
def test_header_accessors
|
361
381
|
# A new message shouldn't have any RFC-822 headers set
|
362
382
|
message = SendgridRuby::Email.new
|
data/test/sendgrid_ruby.rb
CHANGED
@@ -16,7 +16,7 @@ class SendgridRubyTest < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_version
|
19
|
-
assert_equal("0.0.
|
19
|
+
assert_equal("0.0.4", SendgridRuby::VERSION)
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_initialize
|
@@ -151,6 +151,7 @@ class SendgridRubyTest < Test::Unit::TestCase
|
|
151
151
|
sendgrid = SendgridRuby::Sendgrid.new(@username, @password)
|
152
152
|
sendgrid.debug_output = true
|
153
153
|
sendgrid.send(email)
|
154
|
+
|
154
155
|
end
|
155
156
|
|
156
157
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendgrid_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wataru Sato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smtpapi
|
@@ -137,4 +137,3 @@ test_files:
|
|
137
137
|
- test/gif.gif
|
138
138
|
- test/sendgrid_ruby.rb
|
139
139
|
- test/sendgrid_ruby/email.rb
|
140
|
-
has_rdoc:
|