sendgrid-ruby 1.1.6 → 6.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +21 -0
  3. data/.env_sample +1 -3
  4. data/.gitignore +1 -0
  5. data/.travis.yml +28 -17
  6. data/CHANGELOG.md +231 -1
  7. data/CODE_OF_CONDUCT.md +73 -0
  8. data/CONTRIBUTING.md +214 -0
  9. data/Gemfile +5 -4
  10. data/ISSUE_TEMPLATE.md +26 -0
  11. data/LICENSE.md +21 -0
  12. data/Makefile +7 -0
  13. data/PULL_REQUEST_TEMPLATE.md +31 -0
  14. data/README.md +161 -225
  15. data/Rakefile +9 -2
  16. data/TROUBLESHOOTING.md +137 -0
  17. data/UPGRADE.md +5 -0
  18. data/USAGE.md +5037 -0
  19. data/USE_CASES.md +377 -0
  20. data/config.ru +4 -0
  21. data/docker/Dockerfile +12 -0
  22. data/docker/README.md +30 -0
  23. data/examples/accesssettings/accesssettings.rb +83 -0
  24. data/examples/alerts/alerts.rb +62 -0
  25. data/examples/apikeys/apikeys.rb +84 -0
  26. data/examples/asm/asm.rb +173 -0
  27. data/examples/browsers/browsers.rb +16 -0
  28. data/examples/campaigns/campaigns.rb +153 -0
  29. data/examples/categories/categories.rb +36 -0
  30. data/examples/clients/clients.rb +27 -0
  31. data/examples/contactdb/contactdb.rb +395 -0
  32. data/examples/devices/devices.rb +16 -0
  33. data/examples/geo/geo.rb +16 -0
  34. data/examples/helpers/mail/example.rb +147 -0
  35. data/examples/helpers/settings/example.rb +23 -0
  36. data/examples/helpers/stats/example.rb +42 -0
  37. data/examples/ips/ips.rb +167 -0
  38. data/examples/mail/mail.rb +173 -0
  39. data/examples/mailboxproviders/mailboxproviders.rb +16 -0
  40. data/examples/mailsettings/mailsettings.rb +219 -0
  41. data/examples/partnersettings/partnersettings.rb +39 -0
  42. data/examples/scopes/scopes.rb +61 -0
  43. data/examples/senderauthentication/senderauthentication.rb +310 -0
  44. data/examples/senders/senders.rb +98 -0
  45. data/examples/stats/stats.rb +16 -0
  46. data/examples/subusers/subusers.rb +169 -0
  47. data/examples/suppression/suppression.rb +201 -0
  48. data/examples/templates/templates.rb +129 -0
  49. data/examples/trackingsettings/trackingsettings.rb +110 -0
  50. data/examples/user/user.rb +293 -0
  51. data/gemfiles/Sinatra_1.gemfile +6 -0
  52. data/gemfiles/Sinatra_2.gemfile +6 -0
  53. data/lib/sendgrid/client.rb +33 -57
  54. data/lib/sendgrid/helpers/inbound/README.md +98 -0
  55. data/lib/sendgrid/helpers/inbound/app.rb +32 -0
  56. data/lib/sendgrid/helpers/inbound/config.yml +26 -0
  57. data/lib/sendgrid/helpers/inbound/public/index.html +10 -0
  58. data/lib/sendgrid/helpers/inbound/sample_data/default_data.txt +58 -0
  59. data/lib/sendgrid/helpers/inbound/sample_data/raw_data.txt +57 -0
  60. data/lib/sendgrid/helpers/inbound/sample_data/raw_data_with_attachments.txt +298 -0
  61. data/lib/sendgrid/helpers/inbound/send.rb +26 -0
  62. data/lib/sendgrid/helpers/ip_management/ip_management.rb +17 -0
  63. data/lib/sendgrid/helpers/mail/README.md +14 -0
  64. data/lib/sendgrid/helpers/mail/asm.rb +33 -0
  65. data/lib/sendgrid/helpers/mail/attachment.rb +86 -0
  66. data/lib/sendgrid/helpers/mail/bcc_settings.rb +33 -0
  67. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +43 -0
  68. data/lib/sendgrid/helpers/mail/category.rb +20 -0
  69. data/lib/sendgrid/helpers/mail/click_tracking.rb +33 -0
  70. data/lib/sendgrid/helpers/mail/content.rb +20 -0
  71. data/lib/sendgrid/helpers/mail/custom_arg.rb +24 -0
  72. data/lib/sendgrid/helpers/mail/email.rb +29 -0
  73. data/lib/sendgrid/helpers/mail/footer.rb +43 -0
  74. data/lib/sendgrid/helpers/mail/ganalytics.rb +74 -0
  75. data/lib/sendgrid/helpers/mail/header.rb +24 -0
  76. data/lib/sendgrid/helpers/mail/mail.rb +140 -0
  77. data/lib/sendgrid/helpers/mail/mail_settings.rb +63 -0
  78. data/lib/sendgrid/helpers/mail/open_tracking.rb +33 -0
  79. data/lib/sendgrid/helpers/mail/personalization.rb +82 -0
  80. data/lib/sendgrid/helpers/mail/section.rb +24 -0
  81. data/lib/sendgrid/helpers/mail/spam_check.rb +43 -0
  82. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +53 -0
  83. data/lib/sendgrid/helpers/mail/substitution.rb +24 -0
  84. data/lib/sendgrid/helpers/mail/tracking_settings.rb +53 -0
  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 +14 -0
  88. data/lib/sendgrid/helpers/settings/mail_settings_dto.rb +13 -0
  89. data/lib/sendgrid/helpers/settings/partner_settings_dto.rb +13 -0
  90. data/lib/sendgrid/helpers/settings/settings.rb +28 -0
  91. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +24 -0
  92. data/lib/sendgrid/helpers/settings/user_settings_dto.rb +13 -0
  93. data/lib/sendgrid/helpers/stats/email_stats.rb +46 -0
  94. data/lib/sendgrid/helpers/stats/metrics.rb +35 -0
  95. data/lib/sendgrid/helpers/stats/stats_response.rb +31 -0
  96. data/lib/sendgrid/version.rb +1 -1
  97. data/lib/sendgrid-ruby.rb +27 -6
  98. data/mail_helper_v3.md +390 -0
  99. data/sendgrid-ruby.gemspec +13 -17
  100. data/spec/sendgrid/helpers/ip_management/ip_management_spec.rb +12 -0
  101. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +32 -0
  102. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +24 -0
  103. data/spec/sendgrid/helpers/settings/settings_spec.rb +25 -0
  104. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +27 -0
  105. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +24 -0
  106. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +112 -0
  107. data/spec/sendgrid/helpers/stats/metrics_spec.rb +46 -0
  108. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +76 -0
  109. data/spec/spec_helper.rb +10 -1
  110. data/test/prism.sh +42 -0
  111. data/test/sendgrid/helpers/mail/test_attachment.rb +35 -0
  112. data/test/sendgrid/helpers/mail/test_category.rb +27 -0
  113. data/test/sendgrid/helpers/mail/test_email.rb +34 -0
  114. data/test/sendgrid/helpers/mail/test_mail.rb +261 -0
  115. data/test/sendgrid/helpers/mail/test_personalizations.rb +161 -0
  116. data/test/sendgrid/permissions/test_scopes.rb +38 -0
  117. data/test/sendgrid/test_sendgrid-ruby.rb +2751 -0
  118. metadata +149 -115
  119. data/.rspec +0 -2
  120. data/.rubocop.yml +0 -30
  121. data/FETCH_HEAD +0 -0
  122. data/Guardfile +0 -10
  123. data/LICENSE.txt +0 -22
  124. data/example.rb +0 -41
  125. data/lib/sendgrid/exceptions.rb +0 -7
  126. data/lib/sendgrid/mail.rb +0 -182
  127. data/lib/sendgrid/recipient.rb +0 -29
  128. data/lib/sendgrid/response.rb +0 -14
  129. data/lib/sendgrid/template.rb +0 -26
  130. data/lib/sendgrid/template_mailer.rb +0 -59
  131. data/spec/lib/sendgrid/client_spec.rb +0 -87
  132. data/spec/lib/sendgrid/mail_spec.rb +0 -151
  133. data/spec/lib/sendgrid/recipient_spec.rb +0 -91
  134. data/spec/lib/sendgrid/template_mailer_spec.rb +0 -86
  135. data/spec/lib/sendgrid/template_spec.rb +0 -61
  136. data/spec/lib/sendgrid_spec.rb +0 -7
metadata CHANGED
@@ -1,102 +1,67 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 6.0.4
5
5
  platform: ruby
6
6
  authors:
7
+ - Elmer Thomas
7
8
  - Robin Johnson
8
9
  - Eddie Zaneski
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2015-11-27 00:00:00.000000000 Z
13
+ date: 2020-01-22 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
- name: smtpapi
16
+ name: ruby_http_client
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
19
  - - "~>"
19
20
  - !ruby/object:Gem::Version
20
- version: '0.1'
21
+ version: 3.3.0
21
22
  type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
26
  - - "~>"
26
27
  - !ruby/object:Gem::Version
27
- version: '0.1'
28
+ version: 3.3.0
28
29
  - !ruby/object:Gem::Dependency
29
- name: faraday
30
+ name: sinatra
30
31
  requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '0.9'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '0.9'
42
- - !ruby/object:Gem::Dependency
43
- name: mimemagic
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :runtime
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
32
  requirements:
53
33
  - - ">="
54
34
  - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: rake
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
35
+ version: 1.4.7
36
+ - - "<"
61
37
  - !ruby/object:Gem::Version
62
- version: '0'
38
+ version: '3'
63
39
  type: :development
64
40
  prerelease: false
65
41
  version_requirements: !ruby/object:Gem::Requirement
66
42
  requirements:
67
43
  - - ">="
68
44
  - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: rspec
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
45
+ version: 1.4.7
46
+ - - "<"
82
47
  - !ruby/object:Gem::Version
83
- version: '0'
48
+ version: '3'
84
49
  - !ruby/object:Gem::Dependency
85
- name: rspec-nc
50
+ name: rake
86
51
  requirement: !ruby/object:Gem::Requirement
87
52
  requirements:
88
- - - ">="
53
+ - - "~>"
89
54
  - !ruby/object:Gem::Version
90
55
  version: '0'
91
56
  type: :development
92
57
  prerelease: false
93
58
  version_requirements: !ruby/object:Gem::Requirement
94
59
  requirements:
95
- - - ">="
60
+ - - "~>"
96
61
  - !ruby/object:Gem::Version
97
62
  version: '0'
98
63
  - !ruby/object:Gem::Dependency
99
- name: webmock
64
+ name: rspec
100
65
  requirement: !ruby/object:Gem::Requirement
101
66
  requirements:
102
67
  - - ">="
@@ -110,7 +75,7 @@ dependencies:
110
75
  - !ruby/object:Gem::Version
111
76
  version: '0'
112
77
  - !ruby/object:Gem::Dependency
113
- name: guard
78
+ name: pry
114
79
  requirement: !ruby/object:Gem::Requirement
115
80
  requirements:
116
81
  - - ">="
@@ -124,7 +89,7 @@ dependencies:
124
89
  - !ruby/object:Gem::Version
125
90
  version: '0'
126
91
  - !ruby/object:Gem::Dependency
127
- name: guard-rspec
92
+ name: faker
128
93
  requirement: !ruby/object:Gem::Requirement
129
94
  requirements:
130
95
  - - ">="
@@ -152,83 +117,142 @@ dependencies:
152
117
  - !ruby/object:Gem::Version
153
118
  version: '0'
154
119
  - !ruby/object:Gem::Dependency
155
- name: guard-rubocop
156
- requirement: !ruby/object:Gem::Requirement
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- version: '0'
161
- type: :development
162
- prerelease: false
163
- version_requirements: !ruby/object:Gem::Requirement
164
- requirements:
165
- - - ">="
166
- - !ruby/object:Gem::Version
167
- version: '0'
168
- - !ruby/object:Gem::Dependency
169
- name: ruby_gntp
170
- requirement: !ruby/object:Gem::Requirement
171
- requirements:
172
- - - ">="
173
- - !ruby/object:Gem::Version
174
- version: '0'
175
- type: :development
176
- prerelease: false
177
- version_requirements: !ruby/object:Gem::Requirement
178
- requirements:
179
- - - ">="
180
- - !ruby/object:Gem::Version
181
- version: '0'
182
- - !ruby/object:Gem::Dependency
183
- name: bundler
120
+ name: minitest
184
121
  requirement: !ruby/object:Gem::Requirement
185
122
  requirements:
186
123
  - - "~>"
187
124
  - !ruby/object:Gem::Version
188
- version: '1.6'
125
+ version: '5.9'
189
126
  type: :development
190
127
  prerelease: false
191
128
  version_requirements: !ruby/object:Gem::Requirement
192
129
  requirements:
193
130
  - - "~>"
194
131
  - !ruby/object:Gem::Version
195
- version: '1.6'
196
- description: Interact with SendGrids API in native Ruby
197
- email: community@sendgrid.com
132
+ version: '5.9'
133
+ description: Official Twilio SendGrid Gem to Interact with Twilio SendGrids API in
134
+ native Ruby
135
+ email: dx@sendgrid.com
198
136
  executables: []
199
137
  extensions: []
200
138
  extra_rdoc_files: []
201
139
  files:
140
+ - ".codeclimate.yml"
202
141
  - ".env_sample"
203
142
  - ".gitignore"
204
- - ".rspec"
205
- - ".rubocop.yml"
206
143
  - ".travis.yml"
207
144
  - CHANGELOG.md
208
- - FETCH_HEAD
145
+ - CODE_OF_CONDUCT.md
146
+ - CONTRIBUTING.md
209
147
  - Gemfile
210
- - Guardfile
211
- - LICENSE.txt
148
+ - ISSUE_TEMPLATE.md
149
+ - LICENSE.md
150
+ - Makefile
151
+ - PULL_REQUEST_TEMPLATE.md
212
152
  - README.md
213
153
  - Rakefile
214
- - example.rb
154
+ - TROUBLESHOOTING.md
155
+ - UPGRADE.md
156
+ - USAGE.md
157
+ - USE_CASES.md
158
+ - config.ru
159
+ - docker/Dockerfile
160
+ - docker/README.md
161
+ - examples/accesssettings/accesssettings.rb
162
+ - examples/alerts/alerts.rb
163
+ - examples/apikeys/apikeys.rb
164
+ - examples/asm/asm.rb
165
+ - examples/browsers/browsers.rb
166
+ - examples/campaigns/campaigns.rb
167
+ - examples/categories/categories.rb
168
+ - examples/clients/clients.rb
169
+ - examples/contactdb/contactdb.rb
170
+ - examples/devices/devices.rb
171
+ - examples/geo/geo.rb
172
+ - examples/helpers/mail/example.rb
173
+ - examples/helpers/settings/example.rb
174
+ - examples/helpers/stats/example.rb
175
+ - examples/ips/ips.rb
176
+ - examples/mail/mail.rb
177
+ - examples/mailboxproviders/mailboxproviders.rb
178
+ - examples/mailsettings/mailsettings.rb
179
+ - examples/partnersettings/partnersettings.rb
180
+ - examples/scopes/scopes.rb
181
+ - examples/senderauthentication/senderauthentication.rb
182
+ - examples/senders/senders.rb
183
+ - examples/stats/stats.rb
184
+ - examples/subusers/subusers.rb
185
+ - examples/suppression/suppression.rb
186
+ - examples/templates/templates.rb
187
+ - examples/trackingsettings/trackingsettings.rb
188
+ - examples/user/user.rb
189
+ - gemfiles/Sinatra_1.gemfile
190
+ - gemfiles/Sinatra_2.gemfile
215
191
  - lib/sendgrid-ruby.rb
216
192
  - lib/sendgrid/client.rb
217
- - lib/sendgrid/exceptions.rb
218
- - lib/sendgrid/mail.rb
219
- - lib/sendgrid/recipient.rb
220
- - lib/sendgrid/response.rb
221
- - lib/sendgrid/template.rb
222
- - lib/sendgrid/template_mailer.rb
193
+ - lib/sendgrid/helpers/inbound/README.md
194
+ - lib/sendgrid/helpers/inbound/app.rb
195
+ - lib/sendgrid/helpers/inbound/config.yml
196
+ - lib/sendgrid/helpers/inbound/public/index.html
197
+ - lib/sendgrid/helpers/inbound/sample_data/default_data.txt
198
+ - lib/sendgrid/helpers/inbound/sample_data/raw_data.txt
199
+ - lib/sendgrid/helpers/inbound/sample_data/raw_data_with_attachments.txt
200
+ - lib/sendgrid/helpers/inbound/send.rb
201
+ - lib/sendgrid/helpers/ip_management/ip_management.rb
202
+ - lib/sendgrid/helpers/mail/README.md
203
+ - lib/sendgrid/helpers/mail/asm.rb
204
+ - lib/sendgrid/helpers/mail/attachment.rb
205
+ - lib/sendgrid/helpers/mail/bcc_settings.rb
206
+ - lib/sendgrid/helpers/mail/bypass_list_management.rb
207
+ - lib/sendgrid/helpers/mail/category.rb
208
+ - lib/sendgrid/helpers/mail/click_tracking.rb
209
+ - lib/sendgrid/helpers/mail/content.rb
210
+ - lib/sendgrid/helpers/mail/custom_arg.rb
211
+ - lib/sendgrid/helpers/mail/email.rb
212
+ - lib/sendgrid/helpers/mail/footer.rb
213
+ - lib/sendgrid/helpers/mail/ganalytics.rb
214
+ - lib/sendgrid/helpers/mail/header.rb
215
+ - lib/sendgrid/helpers/mail/mail.rb
216
+ - lib/sendgrid/helpers/mail/mail_settings.rb
217
+ - lib/sendgrid/helpers/mail/open_tracking.rb
218
+ - lib/sendgrid/helpers/mail/personalization.rb
219
+ - lib/sendgrid/helpers/mail/section.rb
220
+ - lib/sendgrid/helpers/mail/spam_check.rb
221
+ - lib/sendgrid/helpers/mail/subscription_tracking.rb
222
+ - lib/sendgrid/helpers/mail/substitution.rb
223
+ - lib/sendgrid/helpers/mail/tracking_settings.rb
224
+ - lib/sendgrid/helpers/permissions/scope.rb
225
+ - lib/sendgrid/helpers/permissions/scopes.yml
226
+ - lib/sendgrid/helpers/settings/README.md
227
+ - lib/sendgrid/helpers/settings/mail_settings_dto.rb
228
+ - lib/sendgrid/helpers/settings/partner_settings_dto.rb
229
+ - lib/sendgrid/helpers/settings/settings.rb
230
+ - lib/sendgrid/helpers/settings/tracking_settings_dto.rb
231
+ - lib/sendgrid/helpers/settings/user_settings_dto.rb
232
+ - lib/sendgrid/helpers/stats/email_stats.rb
233
+ - lib/sendgrid/helpers/stats/metrics.rb
234
+ - lib/sendgrid/helpers/stats/stats_response.rb
223
235
  - lib/sendgrid/version.rb
236
+ - mail_helper_v3.md
224
237
  - sendgrid-ruby.gemspec
225
- - spec/lib/sendgrid/client_spec.rb
226
- - spec/lib/sendgrid/mail_spec.rb
227
- - spec/lib/sendgrid/recipient_spec.rb
228
- - spec/lib/sendgrid/template_mailer_spec.rb
229
- - spec/lib/sendgrid/template_spec.rb
230
- - spec/lib/sendgrid_spec.rb
238
+ - spec/sendgrid/helpers/ip_management/ip_management_spec.rb
239
+ - spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb
240
+ - spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb
241
+ - spec/sendgrid/helpers/settings/settings_spec.rb
242
+ - spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb
243
+ - spec/sendgrid/helpers/settings/user_settings_dto_spec.rb
244
+ - spec/sendgrid/helpers/stats/email_stats_spec.rb
245
+ - spec/sendgrid/helpers/stats/metrics_spec.rb
246
+ - spec/sendgrid/helpers/stats/stats_response_spec.rb
231
247
  - spec/spec_helper.rb
248
+ - test/prism.sh
249
+ - test/sendgrid/helpers/mail/test_attachment.rb
250
+ - test/sendgrid/helpers/mail/test_category.rb
251
+ - test/sendgrid/helpers/mail/test_email.rb
252
+ - test/sendgrid/helpers/mail/test_mail.rb
253
+ - test/sendgrid/helpers/mail/test_personalizations.rb
254
+ - test/sendgrid/permissions/test_scopes.rb
255
+ - test/sendgrid/test_sendgrid-ruby.rb
232
256
  homepage: http://github.com/sendgrid/sendgrid-ruby
233
257
  licenses:
234
258
  - MIT
@@ -241,23 +265,33 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
265
  requirements:
242
266
  - - ">="
243
267
  - !ruby/object:Gem::Version
244
- version: '0'
268
+ version: '2.2'
245
269
  required_rubygems_version: !ruby/object:Gem::Requirement
246
270
  requirements:
247
271
  - - ">="
248
272
  - !ruby/object:Gem::Version
249
273
  version: '0'
250
274
  requirements: []
251
- rubyforge_project:
252
- rubygems_version: 2.4.8
275
+ rubygems_version: 3.0.3
253
276
  signing_key:
254
277
  specification_version: 4
255
- summary: Official SendGrid Gem
278
+ summary: Official Twilio SendGrid Gem
256
279
  test_files:
257
- - spec/lib/sendgrid/client_spec.rb
258
- - spec/lib/sendgrid/mail_spec.rb
259
- - spec/lib/sendgrid/recipient_spec.rb
260
- - spec/lib/sendgrid/template_mailer_spec.rb
261
- - spec/lib/sendgrid/template_spec.rb
262
- - spec/lib/sendgrid_spec.rb
280
+ - spec/sendgrid/helpers/ip_management/ip_management_spec.rb
281
+ - spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb
282
+ - spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb
283
+ - spec/sendgrid/helpers/settings/settings_spec.rb
284
+ - spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb
285
+ - spec/sendgrid/helpers/settings/user_settings_dto_spec.rb
286
+ - spec/sendgrid/helpers/stats/email_stats_spec.rb
287
+ - spec/sendgrid/helpers/stats/metrics_spec.rb
288
+ - spec/sendgrid/helpers/stats/stats_response_spec.rb
263
289
  - spec/spec_helper.rb
290
+ - test/prism.sh
291
+ - test/sendgrid/helpers/mail/test_attachment.rb
292
+ - test/sendgrid/helpers/mail/test_category.rb
293
+ - test/sendgrid/helpers/mail/test_email.rb
294
+ - test/sendgrid/helpers/mail/test_mail.rb
295
+ - test/sendgrid/helpers/mail/test_personalizations.rb
296
+ - test/sendgrid/permissions/test_scopes.rb
297
+ - test/sendgrid/test_sendgrid-ruby.rb
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,30 +0,0 @@
1
- Metrics/AbcSize:
2
- Max: 37
3
-
4
- # Configuration parameters: CountComments.
5
- Metrics/ClassLength:
6
- Max: 109
7
-
8
- Metrics/CyclomaticComplexity:
9
- Max: 7
10
-
11
- # Configuration parameters: AllowURI, URISchemes.
12
- Metrics/LineLength:
13
- Max: 132
14
-
15
- # Configuration parameters: CountComments.
16
- Metrics/MethodLength:
17
- Max: 22
18
-
19
- Style/Documentation:
20
- Enabled: false
21
-
22
- # Cop supports --auto-correct.
23
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
24
- Style/SpaceInsideBlockBraces:
25
- Enabled: false
26
-
27
- # Cop supports --auto-correct.
28
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
29
- Style/SpaceInsideHashLiteralBraces:
30
- Enabled: false
data/FETCH_HEAD DELETED
File without changes
data/Guardfile DELETED
@@ -1,10 +0,0 @@
1
- notification :gntp
2
- guard :rspec, cmd: 'rspec' do
3
- watch(%r{^spec/.+_spec\.rb$})
4
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
5
- watch('spec/spec_helper.rb') { 'spec' }
6
- end
7
-
8
- guard :rubocop, all_on_start: false do
9
- watch(%r{^lib/(.+)\.rb$})
10
- end
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 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/example.rb DELETED
@@ -1,41 +0,0 @@
1
- # test using: ruby example.rb
2
- # using ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
3
- # attachment is sent but only a corrupted 1k file
4
-
5
-
6
- require_relative "lib/sendgrid-ruby.rb"
7
-
8
- require 'dotenv'
9
- Dotenv.load
10
-
11
- # sendgrid_username = ENV['SENDGRID_USERNAME']
12
- # sendgrid_password = ENV['SENDGRID_PASSWORD']
13
- sendgrid_apikey = ENV['SENDGRID_APIKEY']
14
-
15
- # client = SendGrid::Client.new(api_user: sendgrid_username, api_key: sendgrid_password)
16
-
17
- client = SendGrid::Client.new do |c|
18
- # c.api_user = sendgrid_username
19
- c.api_key = sendgrid_apikey
20
- end
21
-
22
- mail = SendGrid::Mail.new do |m|
23
- m.to = 'to@example.com'
24
- m.to_name = 'John Doe'
25
- m.from = 'from@example.com'
26
- m.from_name = 'Jane Doe'
27
- m.cc = 'cc@example.com'
28
- m.cc_name = 'John Doe CC'
29
- m.bcc = 'bcc@examlpe.com'
30
- m.bcc_name = 'Jane Doe BCC'
31
- m.subject = 'Hello world!'
32
- m.text = 'I heard you like the beach.'
33
- m.html = 'I heard you like the beach <div><img src="cid:beach"></div>'
34
- end
35
- mail.add_content('/tmp/beach.jpg', 'beach')
36
- mail.add_attachment('/tmp/report.pdf', 'report.pdf')
37
- result = client.send(mail)
38
- puts result.code
39
- puts result.body
40
-
41
- # puts client.send(SendGrid::Mail.new(to: 'elmer.thomas@sendgrid.com', from: 'elmer@thinkingserious.com', subject: 'Hello world!', text: 'Hi there, testing from Ruby!', html: '<b>Hi there, testing from Ruby!</b>'))
@@ -1,7 +0,0 @@
1
- module SendGrid
2
- class Exception < StandardError
3
- def initialize(message)
4
- super(message)
5
- end
6
- end
7
- end
data/lib/sendgrid/mail.rb DELETED
@@ -1,182 +0,0 @@
1
- require 'json'
2
- require 'smtpapi'
3
- require 'mimemagic'
4
-
5
- module SendGrid
6
- class Mail
7
- attr_accessor :to, :to_name, :from, :from_name, :subject, :text, :html, :cc, :cc_name,
8
- :bcc, :bcc_name, :reply_to, :date, :smtpapi, :attachments, :content, :template
9
-
10
- def initialize(params = {})
11
- params.each do |k, v|
12
- send(:"#{k}=", v) unless v.nil?
13
- end
14
-
15
- yield self if block_given?
16
- end
17
-
18
- def add_to(email, name = nil)
19
- if email.is_a?(Array)
20
- to.concat(email)
21
- else
22
- to << email
23
- end
24
- add_to_name(name) if name
25
- end
26
-
27
- def to
28
- @to ||= []
29
- end
30
-
31
- def to_name
32
- @to_name ||= []
33
- end
34
-
35
- def add_to_name(name)
36
- if name.is_a?(Array)
37
- to_name.concat(name)
38
- else
39
- to_name << name
40
- end
41
- end
42
-
43
- def cc
44
- @cc ||= []
45
- end
46
-
47
- def cc_name
48
- @cc_name ||= []
49
- end
50
-
51
- def add_cc(email, name = nil)
52
- if email.is_a?(Array)
53
- cc.concat(email)
54
- else
55
- cc << email
56
- end
57
- add_cc_name(name) if name
58
- end
59
-
60
- def add_cc_name(name)
61
- if name.is_a?(Array)
62
- cc_name.concat(name)
63
- else
64
- cc_name << name
65
- end
66
- end
67
-
68
- def bcc
69
- @bcc ||= []
70
- end
71
-
72
- def bcc_name
73
- @bcc_name ||= []
74
- end
75
-
76
- def add_bcc(email, name = nil)
77
- if email.is_a?(Array)
78
- bcc.concat(email)
79
- else
80
- bcc << email
81
- end
82
- add_bcc_name(name) if name
83
- end
84
-
85
- def add_bcc_name(name)
86
- if name.is_a?(Array)
87
- bcc_name.concat(name)
88
- else
89
- bcc_name << name
90
- end
91
- end
92
-
93
- def add_attachment(path, name = nil)
94
- mime_type = MimeMagic.by_path(path)
95
- file = Faraday::UploadIO.new(path, mime_type)
96
- name ||= File.basename(file)
97
- attachments << {file: file, name: name}
98
- end
99
-
100
- def headers
101
- @headers ||= {}
102
- end
103
-
104
- def attachments
105
- @attachments ||= []
106
- end
107
-
108
- def contents
109
- @contents ||= []
110
- end
111
-
112
- def add_content(path, cid)
113
- mime_type = MimeMagic.by_path(path)
114
- file = Faraday::UploadIO.new(path, mime_type)
115
- name ||= File.basename(file)
116
- contents << {file: file, cid: cid, name: name}
117
- end
118
-
119
- def smtpapi
120
- @smtpapi ||= Smtpapi::Header.new
121
- end
122
-
123
- def smtpapi_json
124
- if !template.nil? && template.is_a?(Template)
125
- template.add_to_smtpapi(smtpapi)
126
- end
127
-
128
- smtpapi.to_json
129
- end
130
-
131
- # rubocop:disable Style/HashSyntax
132
- def to_h
133
- payload = {
134
- :from => from,
135
- :fromname => from_name,
136
- :subject => subject,
137
- :to => to,
138
- :toname => to_name,
139
- :date => date,
140
- :replyto => reply_to,
141
- :cc => cc,
142
- :ccname => cc_name,
143
- :bcc => bcc,
144
- :bccname => bcc_name,
145
- :text => text,
146
- :html => html,
147
- :'x-smtpapi' => smtpapi_json,
148
- :content => ({":default"=>"0"} unless contents.empty?),
149
- :files => ({":default"=>"0"} unless attachments.empty? and contents.empty?)
150
- # If I don't define a default value, I get a Nil error when
151
- # in attachments.each do |file|
152
- #:files => ({} unless attachments.empty?)
153
- }.reject {|_, v| v.nil? || v.empty?}
154
-
155
- payload.delete(:'x-smtpapi') if payload[:'x-smtpapi'] == '{}'
156
-
157
- payload[:to] = payload[:from] if payload[:to].nil? and not smtpapi.to.empty?
158
-
159
- unless attachments.empty?
160
- attachments.each do |file|
161
- payload[:files][file[:name]] = file[:file]
162
- end
163
- if payload[:files].has_key?(":default")
164
- payload[:files].delete(":default")
165
- end
166
- end
167
-
168
- unless contents.empty?
169
- contents.each do |content|
170
- payload[:content][content[:name]] = content[:cid]
171
- payload[:files][content[:name]] = content[:file]
172
- end
173
- if payload[:content].has_key?(":default")
174
- payload[:content].delete(":default")
175
- end
176
- end
177
-
178
- payload
179
- end
180
- # rubocop:enable Style/HashSyntax
181
- end
182
- end