sendgrid-ruby 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a23133f8c4095f9f190145c808636a48bfd7307c
4
- data.tar.gz: 0066b643ab7820a2444a8463e2817a9c76826522
3
+ metadata.gz: 17a0c45fe3cb5d548c9b968d913f1d043e9cd77c
4
+ data.tar.gz: e66e0b611e7d57a6ca17145ba4a03694386234b5
5
5
  SHA512:
6
- metadata.gz: 9a493f33a268e47cbbeacb127f8a85fca38dd63da8a4b65522595e8eb44767c93f62711d7d90a52d5289555394e37cf0d261de6bbfeab2dae6df49a4889c0a3d
7
- data.tar.gz: c23996c075c861b7aaac71e324c381f05fe5921dc1b07f41f03ac3538a48e0ce34d671ff38e8036a152afe90c0c8e9cbb2332c5856b24267b722b712123e8c6c
6
+ metadata.gz: d4373e034801eccbe7bbfe12f39221ca1b9439a6c298757b42424db1d3695581cd403ab7bde1f524260989357d4b0d049dc80dc8577e87200a903b94c32221c7
7
+ data.tar.gz: 4588228cef48b5e709f1008a2600d8ec50f41aa4dd66bb5e011b4d69da3267f51a2ea0d60b57a443b0d982b3887a2beb20b9f58c36008238a644e3eaa6409138
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [5.1.0] - 2017-9-1 ##
5
+ ### Added
6
+ - #173: Update ruby-http-client dependency
7
+ - [#12](https://github.com/sendgrid/ruby-http-client/pull/12) Add a helper that returns the response body as a hash via the `parsed_body` method in the `Response` object.
8
+ - Thanks to [Diego Camargo](https://github.com/belfazt) for the pull request!
9
+
4
10
  ## [5.0.0] - 2017-05-27
5
11
  ### BREAKING CHANGE
6
12
  - #108 Fix unexpected `Mail` `#categories`, `#categories=` behavior
@@ -13,7 +19,7 @@ All notable changes to this project will be documented in this file.
13
19
  - `personalization.custom_args` becomes `personalization.add_custom_arg()`
14
20
  - `mail.personalizations` becomes `mail.add_personalization()`
15
21
  - `mail.contents` becomes `mail.add_content()`
16
- - `mail.attachments` becomes `mail.attachment()`
22
+ - `mail.attachments` becomes `mail.add_attachment()`
17
23
  - `mail.sections` becomes `mail.add_section()`
18
24
  - `mail.headers` becomes `mail.add_header()`
19
25
  - `mail.categories` becomes `mail.add_category()`
@@ -172,4 +178,4 @@ Inline content support
172
178
 
173
179
  ## [1.0.3] - 2015-10-01 ##
174
180
  ### Fixed
175
- Payload 'to' attribute fix for smtpapi
181
+ Payload 'to' attribute fix for smtpapi
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-ruby) [![Gem Version](https://badge.fury.io/rb/sendgrid-ruby.svg)](https://badge.fury.io/rb/sendgrid-ruby)
2
+ [![Email Notifications Badge](https://dx.sendgrid.com/badge/ruby)](https://dx.sendgrid.com/newsletter/ruby)
2
3
 
3
- Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-ruby/issues/94). Your support is appreciated!
4
+ **NEW:** Subscribe to email [notifications](https://dx.sendgrid.com/newsletter/ruby) for releases and breaking changes.
4
5
 
5
6
  **This library allows you to quickly and easily use the SendGrid Web API v3 via Ruby.**
6
7
 
@@ -178,7 +179,7 @@ Please see [our helper](https://github.com/sendgrid/sendgrid-ruby/tree/master/li
178
179
 
179
180
  Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-ruby/issues/94). Your support is appreciated!
180
181
 
181
- All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-ruby/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-ruby/releases).
182
+ All updates to this library are documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-ruby/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-ruby/releases). You may also subscribe to email [release notifications](https://dx.sendgrid.com/newsletter/ruby) for releases and breaking changes.
182
183
 
183
184
  <a name="roadmap"></a>
184
185
  # Roadmap
@@ -54,7 +54,7 @@ def kitchen_sink
54
54
  personalization2.add_custom_arg(CustomArg.new(key: 'user_id', value: '343'))
55
55
  personalization2.add_custom_arg(CustomArg.new(key: 'type', value: 'marketing'))
56
56
  personalization2.send_at = 1443636843
57
- mail.personalizations = personalization2
57
+ mail.add_personalization(personalization2)
58
58
 
59
59
  mail.add_content(Content.new(type: 'text/plain', value: 'some text here'))
60
60
  mail.add_content(Content.new(type: 'text/html', value: '<html><body>some text here</body></html>'))
@@ -65,7 +65,6 @@ def kitchen_sink
65
65
  attachment.filename = 'balance_001.pdf'
66
66
  attachment.disposition = 'attachment'
67
67
  attachment.content_id = 'Balance Sheet'
68
-
69
68
  mail.add_attachment(attachment)
70
69
 
71
70
  attachment2 = Attachment.new
@@ -1,3 +1,3 @@
1
1
  module SendGrid
2
- VERSION = '5.0.0'
2
+ VERSION = '5.1.0'
3
3
  end
data/mail_helper_v3.md ADDED
@@ -0,0 +1,382 @@
1
+ Hello!
2
+
3
+ It is now time to implement the final piece of our v2 to v3 migration. Before we dig into writing the code, we would love to get feedback on the following proposed interfaces.
4
+
5
+ We are starting with the use cases below for the first iteration. (we have completed this work on [our C# library](https://github.com/sendgrid/sendgrid-csharp/blob/master/USE_CASES.md), you can check that out for a sneak peek of where we are heading).
6
+
7
+ # Send a Single Email to a Single Recipient
8
+
9
+ The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
10
+
11
+ ```ruby
12
+ require 'sendgrid-ruby'
13
+
14
+ from = SendGrid::Email.new('test@example.com', 'Example User')
15
+ to = SendGrid::Email.new('test@example.com', 'Example User')
16
+ subject = 'Sending with SendGrid is Fun'
17
+ plain_text_content = 'and easy to do anywhere, even with Ruby'
18
+ html_content = '<strong>and easy to do anywhere, even with Ruby</strong>'
19
+ msg = SendGrid::Mail.create_single_email(from, to, subject, plain_text_content, html_content)
20
+
21
+ client = SendGrid::ClientFactory.new(api_key: ENV['SENDGRID_API_KEY'])
22
+
23
+ begin
24
+ response = client.send_email(msg)
25
+ rescue Exception => e
26
+ puts e.message
27
+ end
28
+ puts response.status_code
29
+ puts response.body
30
+ puts response.headers
31
+ ```
32
+
33
+ # Send a Single Email to Multiple Recipients
34
+
35
+ The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
36
+
37
+ ```ruby
38
+ require 'sendgrid-ruby'
39
+
40
+ from = SendGrid::Email.new('test@example.com', 'Example User')
41
+ tos = [
42
+ SendGrid::Email.new('test1@example.com', 'Example User1'),
43
+ SendGrid::Email.new('test2@example.com', 'Example User2'),
44
+ SendGrid::Email.new('test3@example.com', 'Example User3')
45
+ ];
46
+ subject = 'Sending with SendGrid is Fun'
47
+ plain_text_content = 'and easy to do anywhere, even with Ruby'
48
+ html_content = '<strong>and easy to do anywhere, even with Ruby</strong>'
49
+ msg = SendGrid::Mail.create_single_email_to_multiple_recipients(from,
50
+ tos,
51
+ subject,
52
+ plain_text_content,
53
+ html_content)
54
+
55
+ client = SendGrid::ClientFactory.new(api_key: ENV['SENDGRID_API_KEY'])
56
+
57
+ begin
58
+ response = client.send_email(msg)
59
+ rescue Exception => e
60
+ puts e.message
61
+ end
62
+ puts response.status_code
63
+ puts response.body
64
+ puts response.headers
65
+ ```
66
+
67
+ # Send Multiple Emails to Multiple Recipients
68
+
69
+ The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
70
+
71
+ ```ruby
72
+ require 'sendgrid-ruby'
73
+
74
+ from = SendGrid::Email.new('test@example.com', 'Example User')
75
+ tos = [
76
+ SendGrid::Email.new('test1@example.com', 'Example User1'),
77
+ SendGrid::Email.new('test2@example.com', 'Example User2'),
78
+ SendGrid::Email.new('test3@example.com', 'Example User3')
79
+ ];
80
+ subjects = [
81
+ 'Sending with SendGrid is Fun',
82
+ 'Sending with SendGrid is Super Fun',
83
+ 'Sending with SendGrid is Super Duper Fun'
84
+ ];
85
+ plain_text_content = 'and easy to do anywhere, even with Ruby'
86
+ html_content = '<strong>and easy to do anywhere, even with Ruby</strong>'
87
+ values = [
88
+ 'Name 1',
89
+ 'Name 2',
90
+ 'Name 3'
91
+ ]
92
+ substitutions = {
93
+ '-name1-' => values
94
+ }
95
+ msg = SendGrid::Mail.create_multiple_emails_to_multiple_recipients(from,
96
+ tos,
97
+ subjects,
98
+ plain_text_content,
99
+ html_content,
100
+ substitutions)
101
+
102
+ client = SendGrid::ClientFactory.new(api_key: ENV['SENDGRID_API_KEY'])
103
+
104
+ begin
105
+ response = client.send_email(msg)
106
+ rescue Exception => e
107
+ puts e.message
108
+ end
109
+ puts response.status_code
110
+ puts response.body
111
+ puts response.headers
112
+ ```
113
+
114
+ # Kitchen Sink - an example with all settings used
115
+
116
+ The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
117
+
118
+ ```ruby
119
+ client = SendGrid::ClientFactory.new(api_key: ENV['SENDGRID_API_KEY'])
120
+
121
+ from = SendGrid::Email.new('test@example.com', 'Example User')
122
+ to = SendGrid::Email.new('test@example.com', 'Example User')
123
+ subject = 'Sending with SendGrid is Fun'
124
+ plain_text_content = 'and easy to do anywhere, even with Ruby'
125
+ html_content = '<strong>and easy to do anywhere, even with Ruby</strong>'
126
+ msg = SendGrid::SendGridMessage.new(from, to, subject, plain_text_content, html_content)
127
+
128
+ # For a detailed description of each of these settings, please see the [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
129
+
130
+ msg.add_to(SendGrid::Email.new('test1@example.com', 'Example User1'))
131
+ to_emails = [
132
+ SendGrid::Email.new('test2@example.com', 'Example User2'),
133
+ SendGrid::Email.new('test3@example.com', 'Example User3')
134
+ ];
135
+ msg.add_tos(to_emails)
136
+
137
+ msg.add_cc(SendGrid::Email.new('test4@example.com', 'Example User4'))
138
+ cc_emails = [
139
+ SendGrid::Email.new('test5@example.com', 'Example User5'),
140
+ SendGrid::Email.new('test6@example.com', 'Example User6')
141
+ ];
142
+ msg.add_ccs(cc_emails)
143
+
144
+ msg.add_bcc(SendGrid::Email.new('test7@example.com', 'Example User7'))
145
+ bcc_emails = [
146
+ SendGrid::Email.new('test8@example.com', 'Example User8'),
147
+ SendGrid::Email.new('test9@example.com', 'Example User9')
148
+ ];
149
+ msg.add_bccs(bcc_emails)
150
+
151
+ msg.add_header('X-Test1', 'Test1')
152
+ msg.add_header('X-Test2', 'Test2')
153
+ headers = [
154
+ 'X-Test3' => 'Test3',
155
+ 'X-Test4' => 'Test4'
156
+ ]
157
+ msg.add_headers(headers)
158
+
159
+ msg.add_substitution('%name1%', 'Example Name 1');
160
+ msg.add_substitution('%city1%', 'Denver');
161
+ substitutions = [
162
+ '%name2%' => 'Example Name 2',
163
+ '%city2%' => 'Orange'
164
+ ]
165
+ msg.add_substitutions(substitutions)
166
+
167
+ msg.add_custom_arg('marketing1', 'false')
168
+ msg.add_custom_arg('transactional1', 'true')
169
+ custom_args = [
170
+ 'marketing2' => 'true',
171
+ 'transactional2' => 'false'
172
+ ]
173
+ msg.add_custom_args(custom_args)
174
+
175
+ msg.set_send_at(1461775051)
176
+
177
+ msg.set_subject('this subject overrides the Global Subject on the default Personalization')
178
+
179
+ # If you need to add more [Personalizations](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html), here is an example of adding another Personalization by passing in a personalization index.
180
+
181
+ msg.add_to(SendGrid::Email.new('test10@example.com', 'Example User10'), 1)
182
+ to_emails = [
183
+ SendGrid::Email.new('test11@example.com', 'Example User11'),
184
+ SendGrid::Email.new('test12@example.com', 'Example User12')
185
+ ];
186
+ msg.add_tos(to_emails, 1)
187
+
188
+ msg.add_cc(SendGrid::Email.new('test13@example.com', 'Example User13'), 1)
189
+ cc_emails = [
190
+ SendGrid::Email.new('test14@example.com', 'Example User14'),
191
+ SendGrid::Email.new('test15@example.com', 'Example User15')
192
+ ];
193
+ msg.add_ccs(cc_emails, 1)
194
+
195
+ msg.add_bcc(SendGrid::Email.new('test16@example.com', 'Example User16'), 1)
196
+ bcc_emails = [
197
+ SendGrid::Email.new('test17@example.com', 'Example User17'),
198
+ SendGrid::Email.new('test18@example.com', 'Example User18')
199
+ ];
200
+ msg.add_bccs(bcc_emails, 1)
201
+
202
+ msg.add_header('X-Test5', 'Test5', 1)
203
+ msg.add_header('X-Test6', 'Test6', 1)
204
+ headers = [
205
+ 'X-Test7' => 'Test7',
206
+ 'X-Test8' => 'Test8'
207
+ ]
208
+ msg.add_headers(headers, 1)
209
+
210
+ msg.add_substitution('%name3%', 'Example Name 3', 1);
211
+ msg.add_substitution('%city3%', 'Redwood City', 1);
212
+ substitutions = [
213
+ '%name4%' => 'Example Name 4',
214
+ '%city4%' => 'London'
215
+ ]
216
+ msg.add_substitutions(substitutions, 1)
217
+
218
+ msg.add_custom_arg('marketing3', 'true', 1)
219
+ msg.add_custom_arg('transactional3', 'false', 1)
220
+ custom_args = [
221
+ 'marketing4' => 'false',
222
+ 'transactional4' => 'true'
223
+ ]
224
+ msg.add_custom_args(custom_args, 1)
225
+
226
+ msg.set_send_at(1461775052, 1)
227
+
228
+ msg.set_subject('this subject overrides the Global Subject on the second Personalization', 1)
229
+
230
+ # The values below this comment are global to entire message
231
+
232
+ msg.set_from(SendGrid::Email.new('test0@example.com', 'Example User0'))
233
+
234
+ msg.set_global_subject('Sending with SendGrid is Fun');
235
+
236
+ msg.add_content(MimeType::Text, 'and easy to do anywhere, even with Ruby')
237
+ msg.add_content(MimeType::Html, '<strong>and easy to do anywhere, even with Ruby</strong>')
238
+ contents = [
239
+ SendGrid::Content.new('text/calendar', 'Party Time!!'),
240
+ SendGrid::Content.new('text/calendar2', 'Party Time 2!!')
241
+ ]
242
+ msg.add_contents(contents)
243
+
244
+ msg.add_attachment('balance_001.pdf',
245
+ 'base64 encoded content',
246
+ 'application/pdf',
247
+ 'attachment',
248
+ 'Balance Sheet')
249
+
250
+ attachments = [
251
+ SendGrid::Attachment.new('banner.png',
252
+ 'base64 encoded content',
253
+ 'image/png',
254
+ 'inline',
255
+ 'Banner'),
256
+ SendGrid::Attachment.new('banner2.png',
257
+ 'base64 encoded content',
258
+ 'image/png',
259
+ 'inline',
260
+ 'Banner 2'),
261
+ ]
262
+ msg.add_attachments(attachments)
263
+
264
+ msg.set_template_id('13b8f94f-bcae-4ec6-b752-70d6cb59f932')
265
+
266
+ msg.add_global_header('X-Day', 'Monday')
267
+ global_headers = [
268
+ 'X-Month' => 'January',
269
+ 'X-Year' => '2017'
270
+ ]
271
+ msg.set_global_headers(global_headers)
272
+
273
+ msg.add_section('%section1%', 'Substitution for Section 1 Tag')
274
+ sections = [
275
+ '%section2%' => 'Substitution for Section 2 Tag',
276
+ '%section3%' => 'Substitution for Section 3 Tag'
277
+ ]
278
+ msg.add_sections(sections)
279
+
280
+ begin
281
+ response = client.send_email(msg)
282
+ rescue Exception => e
283
+ puts e.message
284
+ end
285
+ puts response.status_code
286
+ puts response.body
287
+ puts response.headers
288
+ ```
289
+
290
+ # Attachments
291
+
292
+ The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
293
+
294
+ ```ruby
295
+ client = SendGrid::ClientFactory.new(api_key: ENV['SENDGRID_API_KEY'])
296
+
297
+ from = SendGrid::Email.new('test@example.com', 'Example User')
298
+ to = SendGrid::Email.new('test@example.com', 'Example User')
299
+ subject = 'Sending with SendGrid is Fun'
300
+ plain_text_content = 'and easy to do anywhere, even with Ruby'
301
+ html_content = '<strong>and easy to do anywhere, even with Ruby</strong>'
302
+ msg = SendGrid::SendGridMessage.new(from, to, subject, plain_text_content, html_content)
303
+ msg.add_attachment('balance_001.pdf',
304
+ 'base64 encoded content',
305
+ 'application/pdf',
306
+ 'attachment',
307
+ 'Balance Sheet')
308
+
309
+ begin
310
+ response = client.send_email(msg)
311
+ rescue Exception => e
312
+ puts e.message
313
+ end
314
+ puts response.status_code
315
+ puts response.body
316
+ puts response.headers
317
+ ```
318
+
319
+ # Transactional Templates
320
+
321
+ The following code assumes you are storing the API key in an [environment variable (recommended)](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key). If you don't have your key stored in an environment variable, you can assign it directly to `api_key` for testing purposes.
322
+
323
+ For this example, we assume you have created a [transactional template](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). Following is the template content we used for testing.
324
+
325
+ Template ID (replace with your own):
326
+
327
+ ```text
328
+ 13b8f94f-bcae-4ec6-b752-70d6cb59f932
329
+ ```
330
+
331
+ Email Subject:
332
+
333
+ ```text
334
+ <%subject%>
335
+ ```
336
+
337
+ Template Body:
338
+
339
+ ```html
340
+ <html>
341
+ <head>
342
+ <title></title>
343
+ </head>
344
+ <body>
345
+ Hello -name-,
346
+ <br /><br/>
347
+ I'm glad you are trying out the template feature!
348
+ <br /><br/>
349
+ <%body%>
350
+ <br /><br/>
351
+ I hope you are having a great day in -city- :)
352
+ <br /><br/>
353
+ </body>
354
+ </html>
355
+ ```
356
+
357
+ ```ruby
358
+ client = SendGrid::ClientFactory.new(api_key: ENV['SENDGRID_API_KEY'])
359
+
360
+ from = SendGrid::Email.new('test@example.com', 'Example User')
361
+ to = SendGrid::Email.new('test@example.com', 'Example User')
362
+ subject = 'Sending with SendGrid is Fun'
363
+ plain_text_content = 'and easy to do anywhere, even with Ruby'
364
+ html_content = '<strong>and easy to do anywhere, even with Ruby</strong>'
365
+ msg = SendGrid::SendGridMessage.new(from, to, subject, plain_text_content, html_content)
366
+
367
+ substitutions = [
368
+ '-name-' => 'Example User',
369
+ '-city-' => 'Denver'
370
+ ]
371
+ msg.add_substitutions(substitutions)
372
+ msg.set_template_id('13b8f94f-bcae-4ec6-b752-70d6cb59f932')
373
+
374
+ begin
375
+ response = client.send_email(msg)
376
+ rescue Exception => e
377
+ puts e.message
378
+ end
379
+ puts response.status_code
380
+ puts response.body
381
+ puts response.headers
382
+ ```
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
20
20
  spec.test_files = spec.files.grep(/^(test|spec|features)/)
21
21
  spec.require_paths = ['lib']
22
- spec.add_dependency 'ruby_http_client', '~> 3.0'
22
+ spec.add_dependency 'ruby_http_client', '~> 3.2'
23
23
  spec.add_dependency 'sinatra', '>= 1.4.7', '< 3'
24
24
  spec.add_development_dependency 'rake', '~> 0'
25
25
  spec.add_development_dependency 'rspec'
@@ -9,15 +9,13 @@ class TestMail < Minitest::Test
9
9
  end
10
10
 
11
11
  def test_hello_world
12
- mail = Mail.new
13
- mail.from = Email.new(email: "test@example.com")
14
- mail.subject = "Hello World from the SendGrid Ruby Library"
15
- personalization = Personalization.new
16
- personalization.add_to(Email.new(email: "test@example.com"))
17
- mail.add_personalization(personalization)
18
- mail.add_content(Content.new(type: "text/plain", value: "some text here"))
19
- mail.add_content(Content.new(type: "text/html", value: "<html><body>some text here</body></html>"))
20
- assert_equal(mail.to_json, JSON.parse('{"content":[{"type":"text/plain","value":"some text here"},{"type":"text/html","value":"<html><body>some text here</body></html>"}],"from":{"email":"test@example.com"},"personalizations":[{"to":[{"email":"test@example.com"}]}],"subject":"Hello World from the SendGrid Ruby Library"}'))
12
+ from = Email.new(email: 'test@example.com')
13
+ to = Email.new(email: 'test@example.com')
14
+ subject = 'Sending with SendGrid is Fun'
15
+ content = Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
16
+ mail = Mail.new(from, subject, to, content)
17
+
18
+ assert_equal(mail.to_json, JSON.parse('{"from":{"email":"test@example.com"}, "subject":"Sending with SendGrid is Fun", "personalizations":[{"to":[{"email":"test@example.com"}]}], "content":[{"type":"text/plain", "value":"and easy to do anywhere, even with Ruby"}]}'))
21
19
  end
22
20
 
23
21
  def test_kitchen_sink
@@ -55,7 +55,7 @@ class TestAPI < MiniTest::Test
55
55
  ')
56
56
  assert_equal(test_headers, sg.request_headers)
57
57
  assert_equal("v3", sg.version)
58
- assert_equal("5.0.0", SendGrid::VERSION)
58
+ assert_equal("5.1.0", SendGrid::VERSION)
59
59
  assert_instance_of(SendGrid::Client, sg.client)
60
60
  end
61
61
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elmer Thomas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-05-27 00:00:00.000000000 Z
13
+ date: 2017-09-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ruby_http_client
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '3.0'
21
+ version: '3.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '3.0'
28
+ version: '3.2'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: sinatra
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -203,6 +203,7 @@ files:
203
203
  - lib/sendgrid/helpers/settings/tracking_settings_dto.rb
204
204
  - lib/sendgrid/helpers/settings/user_settings_dto.rb
205
205
  - lib/sendgrid/version.rb
206
+ - mail_helper_v3.md
206
207
  - sendgrid-ruby.gemspec
207
208
  - spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb
208
209
  - spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb
@@ -235,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
236
  version: '0'
236
237
  requirements: []
237
238
  rubyforge_project:
238
- rubygems_version: 2.6.8
239
+ rubygems_version: 2.6.10
239
240
  signing_key:
240
241
  specification_version: 4
241
242
  summary: Official SendGrid Gem