sendgrid-ruby 5.3.0 → 6.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +120 -0
  4. data/.gitignore +2 -0
  5. data/.rubocop.yml +8 -0
  6. data/.rubocop_todo.yml +127 -0
  7. data/CHANGELOG.md +261 -8
  8. data/CODE_OF_CONDUCT.md +57 -25
  9. data/CONTRIBUTING.md +24 -71
  10. data/Dockerfile +14 -0
  11. data/FIRST_TIMERS.md +53 -0
  12. data/Gemfile +0 -1
  13. data/LICENSE +21 -0
  14. data/Makefile +14 -0
  15. data/PULL_REQUEST_TEMPLATE.md +31 -0
  16. data/README.md +39 -43
  17. data/Rakefile +3 -4
  18. data/TROUBLESHOOTING.md +41 -21
  19. data/UPGRADE.md +5 -0
  20. data/USAGE.md +1231 -1122
  21. data/examples/accesssettings/accesssettings.rb +9 -12
  22. data/examples/alerts/alerts.rb +8 -11
  23. data/examples/apikeys/apikeys.rb +12 -15
  24. data/examples/asm/asm.rb +27 -30
  25. data/examples/browsers/browsers.rb +0 -3
  26. data/examples/campaigns/campaigns.rb +29 -32
  27. data/examples/categories/categories.rb +0 -3
  28. data/examples/clients/clients.rb +1 -4
  29. data/examples/contactdb/contactdb.rb +63 -66
  30. data/examples/dataresidency/setregion.rb +48 -0
  31. data/examples/devices/devices.rb +0 -3
  32. data/examples/emailactivity/emailactivity.rb +52 -0
  33. data/examples/geo/geo.rb +0 -3
  34. data/examples/helpers/eventwebhook/example.rb +16 -0
  35. data/examples/helpers/mail/example.rb +30 -19
  36. data/examples/helpers/settings/example.rb +1 -1
  37. data/examples/helpers/stats/example.rb +4 -4
  38. data/examples/ips/ips.rb +31 -21
  39. data/examples/mail/mail.rb +73 -76
  40. data/examples/mailboxproviders/mailboxproviders.rb +0 -3
  41. data/examples/mailsettings/mailsettings.rb +21 -24
  42. data/examples/partnersettings/partnersettings.rb +3 -6
  43. data/examples/scopes/scopes.rb +49 -5
  44. data/examples/{whitelabel/whitelabel.rb → senderauthentication/senderauthentication.rb} +68 -71
  45. data/examples/senders/senders.rb +28 -31
  46. data/examples/stats/stats.rb +0 -3
  47. data/examples/subusers/subusers.rb +17 -20
  48. data/examples/suppression/suppression.rb +23 -26
  49. data/examples/templates/templates.rb +29 -31
  50. data/examples/trackingsettings/trackingsettings.rb +14 -17
  51. data/examples/user/user.rb +41 -44
  52. data/lib/rack/sendgrid_webhook_verification.rb +55 -0
  53. data/lib/sendgrid/base_interface.rb +57 -0
  54. data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +50 -0
  55. data/lib/sendgrid/helpers/inbound/README.md +26 -9
  56. data/lib/sendgrid/helpers/inbound/app.rb +15 -3
  57. data/lib/sendgrid/helpers/inbound/public/index.html +2 -2
  58. data/lib/sendgrid/helpers/inbound/sample_data/default_data.txt +2 -2
  59. data/lib/sendgrid/helpers/inbound/sample_data/raw_data.txt +2 -2
  60. data/lib/sendgrid/helpers/inbound/sample_data/raw_data_with_attachments.txt +2 -2
  61. data/lib/sendgrid/helpers/inbound/send.rb +5 -5
  62. data/lib/sendgrid/helpers/ip_management/ip_management.rb +17 -0
  63. data/lib/sendgrid/helpers/mail/README.md +4 -4
  64. data/lib/sendgrid/helpers/mail/asm.rb +4 -18
  65. data/lib/sendgrid/helpers/mail/attachment.rb +30 -38
  66. data/lib/sendgrid/helpers/mail/bcc_settings.rb +4 -18
  67. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +6 -18
  68. data/lib/sendgrid/helpers/mail/category.rb +2 -12
  69. data/lib/sendgrid/helpers/mail/click_tracking.rb +4 -18
  70. data/lib/sendgrid/helpers/mail/content.rb +4 -18
  71. data/lib/sendgrid/helpers/mail/custom_arg.rb +4 -10
  72. data/lib/sendgrid/helpers/mail/email.rb +10 -20
  73. data/lib/sendgrid/helpers/mail/footer.rb +5 -27
  74. data/lib/sendgrid/helpers/mail/ganalytics.rb +9 -55
  75. data/lib/sendgrid/helpers/mail/header.rb +4 -10
  76. data/lib/sendgrid/helpers/mail/mail.rb +37 -87
  77. data/lib/sendgrid/helpers/mail/mail_settings.rb +7 -25
  78. data/lib/sendgrid/helpers/mail/open_tracking.rb +4 -18
  79. data/lib/sendgrid/helpers/mail/personalization.rb +38 -27
  80. data/lib/sendgrid/helpers/mail/section.rb +4 -10
  81. data/lib/sendgrid/helpers/mail/spam_check.rb +5 -27
  82. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +6 -36
  83. data/lib/sendgrid/helpers/mail/substitution.rb +4 -10
  84. data/lib/sendgrid/helpers/mail/tracking_settings.rb +6 -20
  85. data/lib/sendgrid/helpers/permissions/scope.rb +28 -0
  86. data/lib/sendgrid/helpers/permissions/scopes.yml +309 -0
  87. data/lib/sendgrid/helpers/settings/README.md +3 -3
  88. data/lib/sendgrid/helpers/settings/settings.rb +1 -1
  89. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
  90. data/lib/sendgrid/helpers/stats/metrics.rb +5 -7
  91. data/lib/sendgrid/helpers/stats/stats_response.rb +1 -3
  92. data/lib/sendgrid/sendgrid.rb +21 -0
  93. data/lib/sendgrid/twilio_email.rb +21 -0
  94. data/lib/sendgrid/version.rb +1 -1
  95. data/lib/sendgrid-ruby.rb +7 -1
  96. data/mail_helper_v3.md +21 -21
  97. data/sendgrid-ruby.gemspec +12 -12
  98. data/spec/fixtures/event_webhook.rb +22 -0
  99. data/spec/rack/sendgrid_webhook_verification_spec.rb +142 -0
  100. data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +105 -0
  101. data/spec/sendgrid/helpers/ip_management/ip_management_spec.rb +12 -0
  102. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +3 -3
  103. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +3 -3
  104. data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
  105. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +3 -3
  106. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +3 -3
  107. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
  108. data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
  109. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
  110. data/spec/sendgrid/sendgrid_spec.rb +11 -0
  111. data/spec/sendgrid/twilio_email_spec.rb +11 -0
  112. data/spec/spec_helper.rb +3 -1
  113. data/static/img/github-fork.png +0 -0
  114. data/static/img/github-sign-up.png +0 -0
  115. data/test/sendgrid/helpers/mail/test_attachment.rb +33 -0
  116. data/test/sendgrid/helpers/mail/test_category.rb +0 -2
  117. data/test/sendgrid/helpers/mail/test_data_residency.rb +44 -0
  118. data/test/sendgrid/helpers/mail/test_email.rb +17 -10
  119. data/test/sendgrid/helpers/mail/test_mail.rb +126 -119
  120. data/test/sendgrid/helpers/mail/test_personalizations.rb +145 -92
  121. data/test/sendgrid/permissions/test_scopes.rb +36 -0
  122. data/test/sendgrid/test_sendgrid-ruby.rb +1961 -1979
  123. data/twilio_sendgrid_logo.png +0 -0
  124. data/use-cases/README.md +17 -0
  125. data/use-cases/domain-authentication.md +5 -0
  126. data/use-cases/email-statistics.md +52 -0
  127. data/use-cases/legacy-templates.md +98 -0
  128. data/use-cases/personalizations.md +34 -0
  129. data/use-cases/sms.md +39 -0
  130. data/use-cases/transactional-templates.md +111 -0
  131. data/use-cases/twilio-email.md +13 -0
  132. data/use-cases/twilio-setup.md +54 -0
  133. metadata +99 -45
  134. data/.codeclimate.yml +0 -21
  135. data/.github/ISSUE_TEMPLATE +0 -17
  136. data/.github/PULL_REQUEST_TEMPLATE +0 -24
  137. data/.travis.yml +0 -29
  138. data/LICENSE.txt +0 -22
  139. data/USE_CASES.md +0 -147
  140. data/docker/Dockerfile +0 -12
  141. data/docker/README.md +0 -30
  142. data/lib/sendgrid/client.rb +0 -35
  143. data/test/prism.sh +0 -42
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.3.0
4
+ version: 6.7.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: 2018-10-12 00:00:00.000000000 Z
13
+ date: 2023-12-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ruby_http_client
@@ -18,50 +18,44 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 3.3.0
21
+ version: '3.4'
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.3.0
28
+ version: '3.4'
29
29
  - !ruby/object:Gem::Dependency
30
- name: sinatra
30
+ name: faker
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 1.4.7
36
- - - "<"
37
- - !ruby/object:Gem::Version
38
- version: '3'
39
- type: :runtime
35
+ version: '0'
36
+ type: :development
40
37
  prerelease: false
41
38
  version_requirements: !ruby/object:Gem::Requirement
42
39
  requirements:
43
40
  - - ">="
44
41
  - !ruby/object:Gem::Version
45
- version: 1.4.7
46
- - - "<"
47
- - !ruby/object:Gem::Version
48
- version: '3'
42
+ version: '0'
49
43
  - !ruby/object:Gem::Dependency
50
- name: rake
44
+ name: minitest
51
45
  requirement: !ruby/object:Gem::Requirement
52
46
  requirements:
53
47
  - - "~>"
54
48
  - !ruby/object:Gem::Version
55
- version: '0'
49
+ version: '5.9'
56
50
  type: :development
57
51
  prerelease: false
58
52
  version_requirements: !ruby/object:Gem::Requirement
59
53
  requirements:
60
54
  - - "~>"
61
55
  - !ruby/object:Gem::Version
62
- version: '0'
56
+ version: '5.9'
63
57
  - !ruby/object:Gem::Dependency
64
- name: rspec
58
+ name: pry
65
59
  requirement: !ruby/object:Gem::Requirement
66
60
  requirements:
67
61
  - - ">="
@@ -75,7 +69,7 @@ dependencies:
75
69
  - !ruby/object:Gem::Version
76
70
  version: '0'
77
71
  - !ruby/object:Gem::Dependency
78
- name: pry
72
+ name: rack
79
73
  requirement: !ruby/object:Gem::Requirement
80
74
  requirements:
81
75
  - - ">="
@@ -89,21 +83,21 @@ dependencies:
89
83
  - !ruby/object:Gem::Version
90
84
  version: '0'
91
85
  - !ruby/object:Gem::Dependency
92
- name: faker
86
+ name: rake
93
87
  requirement: !ruby/object:Gem::Requirement
94
88
  requirements:
95
- - - ">="
89
+ - - "~>"
96
90
  - !ruby/object:Gem::Version
97
- version: '0'
91
+ version: '13.0'
98
92
  type: :development
99
93
  prerelease: false
100
94
  version_requirements: !ruby/object:Gem::Requirement
101
95
  requirements:
102
- - - ">="
96
+ - - "~>"
103
97
  - !ruby/object:Gem::Version
104
- version: '0'
98
+ version: '13.0'
105
99
  - !ruby/object:Gem::Dependency
106
- name: rubocop
100
+ name: rspec
107
101
  requirement: !ruby/object:Gem::Requirement
108
102
  requirements:
109
103
  - - ">="
@@ -117,44 +111,67 @@ dependencies:
117
111
  - !ruby/object:Gem::Version
118
112
  version: '0'
119
113
  - !ruby/object:Gem::Dependency
120
- name: minitest
114
+ name: simplecov
121
115
  requirement: !ruby/object:Gem::Requirement
122
116
  requirements:
123
117
  - - "~>"
124
118
  - !ruby/object:Gem::Version
125
- version: '5.9'
119
+ version: 0.18.5
126
120
  type: :development
127
121
  prerelease: false
128
122
  version_requirements: !ruby/object:Gem::Requirement
129
123
  requirements:
130
124
  - - "~>"
131
125
  - !ruby/object:Gem::Version
132
- version: '5.9'
133
- description: Official SendGrid Gem to Interact with SendGrids API in native Ruby
134
- email: dx@sendgrid.com
126
+ version: 0.18.5
127
+ - !ruby/object:Gem::Dependency
128
+ name: sinatra
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 1.4.7
134
+ - - "<"
135
+ - !ruby/object:Gem::Version
136
+ version: '3'
137
+ type: :development
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: 1.4.7
144
+ - - "<"
145
+ - !ruby/object:Gem::Version
146
+ version: '3'
147
+ description: Official Twilio SendGrid Gem to Interact with Twilio SendGrids API in
148
+ native Ruby
149
+ email: help@twilio.com
135
150
  executables: []
136
151
  extensions: []
137
152
  extra_rdoc_files: []
138
153
  files:
139
- - ".codeclimate.yml"
140
154
  - ".env_sample"
141
- - ".github/ISSUE_TEMPLATE"
142
- - ".github/PULL_REQUEST_TEMPLATE"
155
+ - ".github/workflows/pr-lint.yml"
156
+ - ".github/workflows/test-and-deploy.yml"
143
157
  - ".gitignore"
144
- - ".travis.yml"
158
+ - ".rubocop.yml"
159
+ - ".rubocop_todo.yml"
145
160
  - CHANGELOG.md
146
161
  - CODE_OF_CONDUCT.md
147
162
  - CONTRIBUTING.md
163
+ - Dockerfile
164
+ - FIRST_TIMERS.md
148
165
  - Gemfile
149
- - LICENSE.txt
166
+ - LICENSE
167
+ - Makefile
168
+ - PULL_REQUEST_TEMPLATE.md
150
169
  - README.md
151
170
  - Rakefile
152
171
  - TROUBLESHOOTING.md
172
+ - UPGRADE.md
153
173
  - USAGE.md
154
- - USE_CASES.md
155
174
  - config.ru
156
- - docker/Dockerfile
157
- - docker/README.md
158
175
  - examples/accesssettings/accesssettings.rb
159
176
  - examples/alerts/alerts.rb
160
177
  - examples/apikeys/apikeys.rb
@@ -164,8 +181,11 @@ files:
164
181
  - examples/categories/categories.rb
165
182
  - examples/clients/clients.rb
166
183
  - examples/contactdb/contactdb.rb
184
+ - examples/dataresidency/setregion.rb
167
185
  - examples/devices/devices.rb
186
+ - examples/emailactivity/emailactivity.rb
168
187
  - examples/geo/geo.rb
188
+ - examples/helpers/eventwebhook/example.rb
169
189
  - examples/helpers/mail/example.rb
170
190
  - examples/helpers/settings/example.rb
171
191
  - examples/helpers/stats/example.rb
@@ -175,6 +195,7 @@ files:
175
195
  - examples/mailsettings/mailsettings.rb
176
196
  - examples/partnersettings/partnersettings.rb
177
197
  - examples/scopes/scopes.rb
198
+ - examples/senderauthentication/senderauthentication.rb
178
199
  - examples/senders/senders.rb
179
200
  - examples/stats/stats.rb
180
201
  - examples/subusers/subusers.rb
@@ -182,11 +203,12 @@ files:
182
203
  - examples/templates/templates.rb
183
204
  - examples/trackingsettings/trackingsettings.rb
184
205
  - examples/user/user.rb
185
- - examples/whitelabel/whitelabel.rb
186
206
  - gemfiles/Sinatra_1.gemfile
187
207
  - gemfiles/Sinatra_2.gemfile
208
+ - lib/rack/sendgrid_webhook_verification.rb
188
209
  - lib/sendgrid-ruby.rb
189
- - lib/sendgrid/client.rb
210
+ - lib/sendgrid/base_interface.rb
211
+ - lib/sendgrid/helpers/eventwebhook/eventwebhook.rb
190
212
  - lib/sendgrid/helpers/inbound/README.md
191
213
  - lib/sendgrid/helpers/inbound/app.rb
192
214
  - lib/sendgrid/helpers/inbound/config.yml
@@ -195,6 +217,7 @@ files:
195
217
  - lib/sendgrid/helpers/inbound/sample_data/raw_data.txt
196
218
  - lib/sendgrid/helpers/inbound/sample_data/raw_data_with_attachments.txt
197
219
  - lib/sendgrid/helpers/inbound/send.rb
220
+ - lib/sendgrid/helpers/ip_management/ip_management.rb
198
221
  - lib/sendgrid/helpers/mail/README.md
199
222
  - lib/sendgrid/helpers/mail/asm.rb
200
223
  - lib/sendgrid/helpers/mail/attachment.rb
@@ -217,6 +240,8 @@ files:
217
240
  - lib/sendgrid/helpers/mail/subscription_tracking.rb
218
241
  - lib/sendgrid/helpers/mail/substitution.rb
219
242
  - lib/sendgrid/helpers/mail/tracking_settings.rb
243
+ - lib/sendgrid/helpers/permissions/scope.rb
244
+ - lib/sendgrid/helpers/permissions/scopes.yml
220
245
  - lib/sendgrid/helpers/settings/README.md
221
246
  - lib/sendgrid/helpers/settings/mail_settings_dto.rb
222
247
  - lib/sendgrid/helpers/settings/partner_settings_dto.rb
@@ -226,9 +251,15 @@ files:
226
251
  - lib/sendgrid/helpers/stats/email_stats.rb
227
252
  - lib/sendgrid/helpers/stats/metrics.rb
228
253
  - lib/sendgrid/helpers/stats/stats_response.rb
254
+ - lib/sendgrid/sendgrid.rb
255
+ - lib/sendgrid/twilio_email.rb
229
256
  - lib/sendgrid/version.rb
230
257
  - mail_helper_v3.md
231
258
  - sendgrid-ruby.gemspec
259
+ - spec/fixtures/event_webhook.rb
260
+ - spec/rack/sendgrid_webhook_verification_spec.rb
261
+ - spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb
262
+ - spec/sendgrid/helpers/ip_management/ip_management_spec.rb
232
263
  - spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb
233
264
  - spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb
234
265
  - spec/sendgrid/helpers/settings/settings_spec.rb
@@ -237,13 +268,29 @@ files:
237
268
  - spec/sendgrid/helpers/stats/email_stats_spec.rb
238
269
  - spec/sendgrid/helpers/stats/metrics_spec.rb
239
270
  - spec/sendgrid/helpers/stats/stats_response_spec.rb
271
+ - spec/sendgrid/sendgrid_spec.rb
272
+ - spec/sendgrid/twilio_email_spec.rb
240
273
  - spec/spec_helper.rb
241
- - test/prism.sh
274
+ - static/img/github-fork.png
275
+ - static/img/github-sign-up.png
276
+ - test/sendgrid/helpers/mail/test_attachment.rb
242
277
  - test/sendgrid/helpers/mail/test_category.rb
278
+ - test/sendgrid/helpers/mail/test_data_residency.rb
243
279
  - test/sendgrid/helpers/mail/test_email.rb
244
280
  - test/sendgrid/helpers/mail/test_mail.rb
245
281
  - test/sendgrid/helpers/mail/test_personalizations.rb
282
+ - test/sendgrid/permissions/test_scopes.rb
246
283
  - test/sendgrid/test_sendgrid-ruby.rb
284
+ - twilio_sendgrid_logo.png
285
+ - use-cases/README.md
286
+ - use-cases/domain-authentication.md
287
+ - use-cases/email-statistics.md
288
+ - use-cases/legacy-templates.md
289
+ - use-cases/personalizations.md
290
+ - use-cases/sms.md
291
+ - use-cases/transactional-templates.md
292
+ - use-cases/twilio-email.md
293
+ - use-cases/twilio-setup.md
247
294
  homepage: http://github.com/sendgrid/sendgrid-ruby
248
295
  licenses:
249
296
  - MIT
@@ -263,12 +310,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
310
  - !ruby/object:Gem::Version
264
311
  version: '0'
265
312
  requirements: []
266
- rubyforge_project:
267
- rubygems_version: 2.6.10
313
+ rubygems_version: 3.3.26
268
314
  signing_key:
269
315
  specification_version: 4
270
- summary: Official SendGrid Gem
316
+ summary: Official Twilio SendGrid Gem
271
317
  test_files:
318
+ - spec/fixtures/event_webhook.rb
319
+ - spec/rack/sendgrid_webhook_verification_spec.rb
320
+ - spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb
321
+ - spec/sendgrid/helpers/ip_management/ip_management_spec.rb
272
322
  - spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb
273
323
  - spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb
274
324
  - spec/sendgrid/helpers/settings/settings_spec.rb
@@ -277,10 +327,14 @@ test_files:
277
327
  - spec/sendgrid/helpers/stats/email_stats_spec.rb
278
328
  - spec/sendgrid/helpers/stats/metrics_spec.rb
279
329
  - spec/sendgrid/helpers/stats/stats_response_spec.rb
330
+ - spec/sendgrid/sendgrid_spec.rb
331
+ - spec/sendgrid/twilio_email_spec.rb
280
332
  - spec/spec_helper.rb
281
- - test/prism.sh
333
+ - test/sendgrid/helpers/mail/test_attachment.rb
282
334
  - test/sendgrid/helpers/mail/test_category.rb
335
+ - test/sendgrid/helpers/mail/test_data_residency.rb
283
336
  - test/sendgrid/helpers/mail/test_email.rb
284
337
  - test/sendgrid/helpers/mail/test_mail.rb
285
338
  - test/sendgrid/helpers/mail/test_personalizations.rb
339
+ - test/sendgrid/permissions/test_scopes.rb
286
340
  - test/sendgrid/test_sendgrid-ruby.rb
data/.codeclimate.yml DELETED
@@ -1,21 +0,0 @@
1
- ---
2
- engines:
3
- duplication:
4
- enabled: true
5
- config:
6
- languages:
7
- - ruby
8
- fixme:
9
- enabled: true
10
- rubocop:
11
- enabled: true
12
- bundler-audit:
13
- enabled: true
14
- ratings:
15
- paths:
16
- - "**.rb"
17
- exclude_paths:
18
- - examples/
19
- - spec/
20
- - test/
21
- - gemfiles/
@@ -1,17 +0,0 @@
1
- #### Issue Summary
2
-
3
- A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples.
4
-
5
-
6
- #### Steps to Reproduce
7
-
8
- 1. This is the first step
9
- 2. This is the second step
10
- 3. Further steps, etc.
11
-
12
- Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?
13
-
14
- #### Technical details:
15
-
16
- * sendgrid-ruby Version: master (latest commit: [commit number])
17
- * Ruby Version: 2.2
@@ -1,24 +0,0 @@
1
- <!--
2
- We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines given above, then fill out the blanks below.
3
-
4
-
5
- Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
6
- e.g.
7
- Fixes #1
8
- Closes #2
9
- -->
10
- # Fixes #
11
-
12
- ### Checklist
13
- - [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
14
- - [ ] I have read the [Contribution Guide] and my PR follows them.
15
- - [ ] I updated my branch with the master branch.
16
- - [ ] I have added tests that prove my fix is effective or that my feature works
17
- - [ ] I have added necessary documentation about the functionality in the appropriate .md file
18
- - [ ] I have added in line documentation to the code I modified
19
-
20
- ### Short description of what this PR does:
21
- -
22
- -
23
-
24
- If you have questions, please send an email to [Sendgrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
data/.travis.yml DELETED
@@ -1,29 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.6
4
- - 2.3.4
5
- - 2.4.1
6
- gemfile:
7
- - gemfiles/Sinatra_1.gemfile
8
- - gemfiles/Sinatra_2.gemfile
9
- before_script:
10
- - mkdir prism
11
- - mkdir prism/bin
12
- - export PATH=$PATH:$PWD/prism/bin/
13
- - ./test/prism.sh
14
- notifications:
15
- hipchat:
16
- rooms:
17
- secure: gYBEwOGBTxHE2nrxsHQqp2UdjRtCX04wVLYEimeT9RG/0LClS4nzJF7DaXLWlAwgLPmk+KV2+nXuLO5oausBr9ODmWhho8G0F90RPR47NupcvT1RM+I2ZbxSjHCUICL22mdnZd8ye/mrk/YtFWYmgmH7ILRK3BuYovXFoKoRnLg=
18
- template:
19
- - '<a href="https://travis-ci.org/%{repository}/builds/%{build_id}">%{repository}
20
- Build %{build_number}</a> on branch <i>%{branch}</i> by %{author}: <strong>%{message}</strong>
21
- <a href="https://github.com/sendgrid/%{repository}/commits/%{commit}">View on GitHub</a>'
22
- format: html
23
- notify: false
24
- script:
25
- - rake test
26
- - rake spec
27
- before_install:
28
- - gem update bundler
29
-
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014-2018 SendGrid, Inc.
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/USE_CASES.md DELETED
@@ -1,147 +0,0 @@
1
- This documentation provides examples for specific use cases. Please [open an issue](https://github.com/sendgrid/sendgrid-ruby/issues) or make a pull request for any use cases you would like us to document here. Thank you!
2
-
3
- # Table of Contents
4
-
5
- * [Transactional Templates](#transactional-templates)
6
- * [How to Setup a Domain Whitelabel](#domain-whitelabel)
7
- * [How to View Email Statistics](#email-statistics)
8
-
9
- <a name="transactional-templates"></a>
10
- # (LEGACY) Transactional Templates
11
-
12
- IF YOU ARE USING OUR NEW TEMPLATES, PLEASE SEE [THIS ISSUE](https://github.com/sendgrid/sendgrid-ruby/issues/301).
13
-
14
- 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.
15
-
16
- Template ID (replace with your own):
17
-
18
- ```text
19
- 13b8f94f-bcae-4ec6-b752-70d6cb59f932
20
- ```
21
-
22
- Email Subject:
23
-
24
- ```text
25
- <%subject%>
26
- ```
27
-
28
- Template Body:
29
-
30
- ```html
31
- <html>
32
- <head>
33
- <title></title>
34
- </head>
35
- <body>
36
- Hello -name-,
37
- <br /><br/>
38
- I'm glad you are trying out the template feature!
39
- <br /><br/>
40
- <%body%>
41
- <br /><br/>
42
- I hope you are having a great day in -city- :)
43
- <br /><br/>
44
- </body>
45
- </html>
46
- ```
47
-
48
- ## With Mail Helper Class
49
-
50
- ```ruby
51
- require 'sendgrid-ruby'
52
- include SendGrid
53
-
54
- mail = Mail.new
55
- mail.from = Email.new(email: 'test@example.com')
56
- mail.subject = 'I\'m replacing the subject tag'
57
- personalization = Personalization.new
58
- personalization.add_to(Email.new(email: 'test@example.com'))
59
- personalization.add_substitution(Substitution.new(key: '-name-', value: 'Example User'))
60
- personalization.add_substitution(Substitution.new(key: '-city-', value: 'Denver'))
61
- mail.add_personalization(personalization)
62
- mail.add_content(Content.new(type: 'text/html', value: 'I\'m replacing the <strong>body tag</strong>'))
63
- mail.template_id = '13b8f94f-bcae-4ec6-b752-70d6cb59f932'
64
-
65
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
66
- begin
67
- response = sg.client.mail._("send").post(request_body: mail.to_json)
68
- rescue Exception => e
69
- puts e.message
70
- end
71
- puts response.status_code
72
- puts response.body
73
- puts response.parsed_body
74
- puts response.headers
75
- ```
76
-
77
- ## Without Mail Helper Class
78
-
79
- ```ruby
80
- require 'sendgrid-ruby'
81
- include SendGrid
82
-
83
- data = JSON.parse('{
84
- "personalizations": [
85
- {
86
- "to": [
87
- {
88
- "email": "test@example.com"
89
- }
90
- ],
91
- "substitutions": {
92
- "-name-": "Example User",
93
- "-city-": "Denver"
94
- },
95
- "subject": "I\'m replacing the subject tag"
96
- }
97
- ],
98
- "from": {
99
- "email": "test@example.com"
100
- },
101
- "content": [
102
- {
103
- "type": "text/html",
104
- "value": "I\'m replacing the <strong>body tag</strong>"
105
- }
106
- ],
107
- "template_id": "13b8f94f-bcae-4ec6-b752-70d6cb59f932"
108
- }')
109
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
110
- begin
111
- response = sg.client.mail._("send").post(request_body: data)
112
- rescue Exception => e
113
- puts e.message
114
- end
115
- puts response.status_code
116
- puts response.body
117
- puts response.parsed_body
118
- puts response.headers
119
- ```
120
-
121
- ## Adding Attachments
122
-
123
- ```ruby
124
- attachment = Attachment.new
125
- attachment.content = Base64.strict_encode64(File.open(fpath, 'rb').read)
126
- attachment.type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
127
- attachment.filename = fname
128
- attachment.disposition = 'attachment'
129
- attachment.content_id = 'Reports Sheet'
130
- mail.add_attachment(attachment)
131
-
132
- ```
133
- Attachments must be base64 encoded, using Base64's strict_encode64 where no line feeds are added.
134
-
135
- <a name="domain-whitelabel"></a>
136
- # How to Setup a Domain Whitelabel
137
-
138
- You can find documentation for how to setup a domain whitelabel via the UI [here](https://sendgrid.com/docs/Classroom/Basics/Whitelabel/setup_domain_whitelabel.html) and via API [here](https://github.com/sendgrid/sendgrid-ruby/blob/master/USAGE.md#whitelabel).
139
-
140
- Find more information about all of SendGrid's whitelabeling related documentation [here](https://sendgrid.com/docs/Classroom/Basics/Whitelabel/index.html).
141
-
142
- <a name="email-statistics"></a>
143
- # How to View Email Statistics
144
-
145
- You can find documentation for how to view your email statistics via the UI [here](https://app.sendgrid.com/statistics) and via API [here](https://github.com/sendgrid/sendgrid-ruby/blob/master/USAGE.md#stats).
146
-
147
- Alternatively, we can post events to a URL of your choice via our [Event Webhook](https://sendgrid.com/docs/API_Reference/Webhooks/event.html) about events that occur as SendGrid processes your email.
data/docker/Dockerfile DELETED
@@ -1,12 +0,0 @@
1
- FROM ruby:2.4.2-jessie
2
-
3
- # Clone sendgrid-ruby
4
- WORKDIR /sources
5
- RUN git clone https://github.com/sendgrid/sendgrid-ruby.git
6
-
7
- # Bundle
8
- WORKDIR /sources/sendgrid-ruby
9
- RUN bundle install
10
-
11
- # Install prism
12
- RUN curl https://raw.githubusercontent.com/stoplightio/prism/master/install.sh | sh
data/docker/README.md DELETED
@@ -1,30 +0,0 @@
1
- # Docker image for sendgrid-ruby
2
-
3
- ## Quickstart
4
- 1. [Install Docker](https://docs.docker.com/engine/installation/) on your machine.
5
- 2. Run `docker run --rm -it sendgrid/sendgrid-ruby irb`.
6
- 3. Run `require './lib/sendgrid-ruby.rb'`.
7
-
8
- ## Poke around
9
-
10
- If you would like to just poke around in the image and check some examples:
11
- ```sh
12
- docker run --rm -it sendgrid/sendgrid-ruby bash
13
- ```
14
-
15
- If you want to mount your fork or specific version of the gem:
16
- ```sh
17
- docker run --rm -v /path/to/local/sendgrid-ruby:/sources/sendgrid-ruby -it sendgrid/sendgrid-ruby bash
18
- ```
19
-
20
- ## Running tests
21
-
22
- If you would like to run the tests present in the image:
23
- ```sh
24
- docker run --rm sendgrid/sendgrid-ruby rake
25
- ```
26
-
27
- If you want to run tests on your fork or a specific version, mount the codebase onto the image:
28
- ```sh
29
- docker run --rm -v /path/to/local/sendgrid-ruby:/sources/sendgrid-ruby sendgrid/sendgrid-ruby rake
30
- ```
@@ -1,35 +0,0 @@
1
- # Quickly and easily access the SendGrid API.
2
- require 'ruby_http_client'
3
- require_relative 'version'
4
-
5
- module SendGrid
6
- # Initialize the HTTP client
7
- class API
8
- attr_accessor :client
9
- attr_reader :request_headers, :host, :version
10
- # * *Args* :
11
- # - +api_key+ -> your SendGrid API key
12
- # - +host+ -> the base URL for the API
13
- # - +request_headers+ -> any headers that you want to be globally applied
14
- # - +version+ -> the version of the API you wish to access,
15
- # currently only "v3" is supported
16
- #
17
- def initialize(api_key: '', host: nil, request_headers: nil, version: nil)
18
- @api_key = api_key
19
- @host = host ? host : 'https://api.sendgrid.com'
20
- @version = version ? version : 'v3'
21
- @user_agent = "sendgrid/#{SendGrid::VERSION};ruby"
22
- @request_headers = JSON.parse('
23
- {
24
- "Authorization": "Bearer ' + @api_key + '",
25
- "Accept": "application/json",
26
- "User-agent": "' + @user_agent + '"
27
- }
28
- ')
29
-
30
- @request_headers = @request_headers.merge(request_headers) if request_headers
31
- @client = Client.new(host: "#{@host}/#{@version}",
32
- request_headers: @request_headers)
33
- end
34
- end
35
- end