sendgrid-ruby 6.0.0 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +1 -1
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +8 -0
  5. data/.rubocop_todo.yml +111 -0
  6. data/.travis.yml +26 -25
  7. data/CHANGELOG.md +185 -10
  8. data/CODE_OF_CONDUCT.md +57 -25
  9. data/CONTRIBUTING.md +11 -23
  10. data/Dockerfile +14 -0
  11. data/FIRST_TIMERS.md +79 -0
  12. data/Gemfile +0 -1
  13. data/ISSUE_TEMPLATE.md +30 -0
  14. data/LICENSE +21 -0
  15. data/Makefile +15 -0
  16. data/PULL_REQUEST_TEMPLATE.md +31 -0
  17. data/README.md +28 -37
  18. data/Rakefile +2 -3
  19. data/TROUBLESHOOTING.md +9 -7
  20. data/USAGE.md +146 -39
  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/devices/devices.rb +0 -3
  31. data/examples/emailactivity/emailactivity.rb +52 -0
  32. data/examples/geo/geo.rb +0 -3
  33. data/examples/helpers/eventwebhook/example.rb +16 -0
  34. data/examples/helpers/mail/example.rb +19 -13
  35. data/examples/helpers/settings/example.rb +1 -1
  36. data/examples/helpers/stats/example.rb +4 -4
  37. data/examples/ips/ips.rb +19 -22
  38. data/examples/mail/mail.rb +72 -75
  39. data/examples/mailboxproviders/mailboxproviders.rb +0 -3
  40. data/examples/mailsettings/mailsettings.rb +21 -24
  41. data/examples/partnersettings/partnersettings.rb +3 -6
  42. data/examples/scopes/scopes.rb +8 -10
  43. data/examples/senderauthentication/senderauthentication.rb +41 -44
  44. data/examples/senders/senders.rb +28 -31
  45. data/examples/stats/stats.rb +0 -3
  46. data/examples/subusers/subusers.rb +17 -20
  47. data/examples/suppression/suppression.rb +15 -18
  48. data/examples/templates/templates.rb +29 -31
  49. data/examples/trackingsettings/trackingsettings.rb +14 -17
  50. data/examples/user/user.rb +41 -44
  51. data/lib/rack/sendgrid_webhook_verification.rb +55 -0
  52. data/lib/sendgrid-ruby.rb +5 -1
  53. data/lib/sendgrid/base_interface.rb +40 -0
  54. data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +50 -0
  55. data/lib/sendgrid/helpers/inbound/README.md +5 -5
  56. data/lib/sendgrid/helpers/inbound/app.rb +2 -2
  57. data/lib/sendgrid/helpers/inbound/public/index.html +1 -1
  58. data/lib/sendgrid/helpers/inbound/send.rb +3 -3
  59. data/lib/sendgrid/helpers/ip_management/ip_management.rb +1 -1
  60. data/lib/sendgrid/helpers/mail/README.md +3 -3
  61. data/lib/sendgrid/helpers/mail/asm.rb +4 -18
  62. data/lib/sendgrid/helpers/mail/attachment.rb +12 -43
  63. data/lib/sendgrid/helpers/mail/bcc_settings.rb +4 -18
  64. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +6 -18
  65. data/lib/sendgrid/helpers/mail/category.rb +2 -4
  66. data/lib/sendgrid/helpers/mail/click_tracking.rb +4 -18
  67. data/lib/sendgrid/helpers/mail/content.rb +2 -3
  68. data/lib/sendgrid/helpers/mail/custom_arg.rb +4 -10
  69. data/lib/sendgrid/helpers/mail/email.rb +8 -5
  70. data/lib/sendgrid/helpers/mail/footer.rb +5 -27
  71. data/lib/sendgrid/helpers/mail/ganalytics.rb +9 -55
  72. data/lib/sendgrid/helpers/mail/header.rb +4 -10
  73. data/lib/sendgrid/helpers/mail/mail.rb +30 -48
  74. data/lib/sendgrid/helpers/mail/mail_settings.rb +7 -25
  75. data/lib/sendgrid/helpers/mail/open_tracking.rb +4 -18
  76. data/lib/sendgrid/helpers/mail/personalization.rb +32 -27
  77. data/lib/sendgrid/helpers/mail/section.rb +4 -10
  78. data/lib/sendgrid/helpers/mail/spam_check.rb +5 -27
  79. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +6 -36
  80. data/lib/sendgrid/helpers/mail/substitution.rb +4 -10
  81. data/lib/sendgrid/helpers/mail/tracking_settings.rb +6 -20
  82. data/lib/sendgrid/helpers/permissions/scope.rb +2 -2
  83. data/lib/sendgrid/helpers/settings/README.md +2 -2
  84. data/lib/sendgrid/helpers/settings/settings.rb +1 -1
  85. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
  86. data/lib/sendgrid/helpers/stats/metrics.rb +5 -7
  87. data/lib/sendgrid/helpers/stats/stats_response.rb +0 -2
  88. data/lib/sendgrid/sendgrid.rb +21 -0
  89. data/lib/sendgrid/twilio_email.rb +21 -0
  90. data/lib/sendgrid/version.rb +1 -1
  91. data/mail_helper_v3.md +12 -12
  92. data/sendgrid-ruby.gemspec +11 -10
  93. data/spec/fixtures/event_webhook.rb +22 -0
  94. data/spec/rack/sendgrid_webhook_verification_spec.rb +142 -0
  95. data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +105 -0
  96. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +1 -1
  97. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +1 -1
  98. data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
  99. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +1 -1
  100. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +1 -1
  101. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
  102. data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
  103. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
  104. data/spec/sendgrid/sendgrid_spec.rb +11 -0
  105. data/spec/sendgrid/twilio_email_spec.rb +11 -0
  106. data/spec/spec_helper.rb +3 -1
  107. data/static/img/github-fork.png +0 -0
  108. data/static/img/github-sign-up.png +0 -0
  109. data/test/sendgrid/helpers/mail/test_attachment.rb +4 -6
  110. data/test/sendgrid/helpers/mail/test_category.rb +0 -2
  111. data/test/sendgrid/helpers/mail/test_email.rb +17 -10
  112. data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
  113. data/test/sendgrid/helpers/mail/test_personalizations.rb +133 -93
  114. data/test/sendgrid/permissions/test_scopes.rb +1 -3
  115. data/test/sendgrid/test_sendgrid-ruby.rb +1967 -1985
  116. data/twilio_sendgrid_logo.png +0 -0
  117. data/use-cases/README.md +16 -0
  118. data/use-cases/domain-authentication.md +5 -0
  119. data/use-cases/email-statistics.md +52 -0
  120. data/use-cases/legacy-templates.md +98 -0
  121. data/use-cases/sms.md +39 -0
  122. data/use-cases/transactional-templates.md +111 -0
  123. data/use-cases/twilio-email.md +13 -0
  124. data/use-cases/twilio-setup.md +54 -0
  125. metadata +88 -34
  126. data/.github/ISSUE_TEMPLATE +0 -17
  127. data/.github/PULL_REQUEST_TEMPLATE +0 -26
  128. data/LICENSE.txt +0 -22
  129. data/USE_CASES.md +0 -377
  130. data/docker/Dockerfile +0 -12
  131. data/docker/README.md +0 -30
  132. data/lib/sendgrid/client.rb +0 -38
  133. data/test/prism.sh +0 -42
@@ -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,26 +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
- **All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.**
5
-
6
- 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!
7
- e.g.
8
- Fixes #1
9
- Closes #2
10
- -->
11
- # Fixes #
12
-
13
- ### Checklist
14
- - [ ] I acknowledge that all my contributions will be made under the project's license
15
- - [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
16
- - [ ] I have read the [Contribution Guide] and my PR follows them.
17
- - [ ] I updated my branch with the master branch.
18
- - [ ] I have added tests that prove my fix is effective or that my feature works
19
- - [ ] I have added necessary documentation about the functionality in the appropriate .md file
20
- - [ ] I have added in line documentation to the code I modified
21
-
22
- ### Short description of what this PR does:
23
- -
24
- -
25
-
26
- If you have questions, please send an email to [Twilio SendGrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014-2019 Twilio 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,377 +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
- * [With Mail Helper Class](#with-mail-helper-class)
7
- * [Without Mail Helper Class](#without-mail-helper-class)
8
- * [Legacy Templates](#legacy-templates)
9
- * [With Mail Helper Class](#with-mail-helper-class-1)
10
- * [Without Mail Helper Class](#without-mail-helper-class-1)
11
- * [Adding Attachments](#adding-attachments)
12
- * [How to Setup a Domain Authentication](#how-to-setup-a-domain-authentication)
13
- * [How to View Email Statistics](#how-to-view-email-statistics)
14
- * [Send a SMS Message](#send-a-sms-message)
15
- * [1. Obtain a Free Twilio Account](#1-obtain-a-free-twilio-account)
16
- * [2. Update Your Environment Variables](#2-update-your-environment-variables)
17
- * [Mac](#mac)
18
- * [Windows](#windows)
19
- * [3. Install the Twilio Helper Library](#3-install-the-twilio-helper-library)
20
- * [4. Setup Work](#4-setup-work)
21
- * [5. Send an SMS](#5-send-an-sms)
22
-
23
- <a name="transactional-templates"></a>
24
- # Transactional Templates
25
-
26
- For this example, we assume you have created a [transactional template](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html) in the UI or via the API. Following is the template content we used for testing.
27
-
28
- Template ID (replace with your own):
29
-
30
- ```text
31
- d-2c214ac919e84170b21855cc129b4a5f
32
- ```
33
- Email Subject:
34
- ```text
35
- {{subject}}
36
- ```
37
-
38
- Template Body:
39
-
40
- ```html
41
- <html>
42
- <head>
43
- <title></title>
44
- </head>
45
- <body>
46
- Hello {{name}},
47
- <br/><br/>
48
- I'm glad you are trying out the template feature!
49
- <br/><br/>
50
- I hope you are having a great day in {{city}} :)
51
- <br/><br/>
52
- </body>
53
- </html>
54
- ```
55
-
56
- ## With Mail Helper Class
57
- ```ruby
58
- require 'sendgrid-ruby'
59
- include SendGrid
60
-
61
- mail = Mail.new
62
- mail.from = Email.new(email: 'test@example.com')
63
- personalization = Personalization.new
64
- personalization.add_to(Email.new(email: 'test@example.com'))
65
- personalization.add_dynamic_template_data({
66
- "subject" => "Testing Templates",
67
- "name" => "Example User",
68
- "city" => "Denver"
69
- })
70
- mail.add_personalization(personalization)
71
- mail.template_id = 'd-2c214ac919e84170b21855cc129b4a5f'
72
-
73
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
74
- begin
75
- response = sg.client.mail._("send").post(request_body: mail.to_json)
76
- rescue Exception => e
77
- puts e.message
78
- end
79
- puts response.status_code
80
- puts response.body
81
- puts response.parsed_body
82
- puts response.headers
83
- ```
84
-
85
- ## Without Mail Helper Class
86
-
87
- ```ruby
88
- require 'sendgrid-ruby'
89
- include SendGrid
90
-
91
- data = JSON.parse('{
92
- "personalizations": [
93
- {
94
- "to": [
95
- {
96
- "email": "test@example.com"
97
- }
98
- ],
99
- "dynamic_template_data": {
100
- "subject": "Testing Templates",
101
- "name": "Example User",
102
- "city": "Denver"
103
- }
104
- }
105
- ],
106
- "from": {
107
- "email": "test@example.com"
108
- },
109
- "template_id": "d-2c214ac919e84170b21855cc129b4a5f"
110
- }')
111
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
112
- begin
113
- response = sg.client.mail._("send").post(request_body: data)
114
- rescue Exception => e
115
- puts e.message
116
- end
117
- puts response.status_code
118
- puts response.body
119
- puts response.parsed_body
120
- puts response.headers
121
- ```
122
-
123
- <a name="legacy-templates"></a>
124
- # Legacy Templates
125
-
126
- For this example, we assume you have created a [legacy template](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). Following is the template content we used for testing.
127
-
128
- Template ID (replace with your own):
129
-
130
- ```text
131
- 13b8f94f-bcae-4ec6-b752-70d6cb59f932
132
- ```
133
-
134
- Email Subject:
135
-
136
- ```text
137
- <%subject%>
138
- ```
139
-
140
- Template Body:
141
-
142
- ```html
143
- <html>
144
- <head>
145
- <title></title>
146
- </head>
147
- <body>
148
- Hello -name-,
149
- <br /><br/>
150
- I'm glad you are trying out the template feature!
151
- <br /><br/>
152
- <%body%>
153
- <br /><br/>
154
- I hope you are having a great day in -city- :)
155
- <br /><br/>
156
- </body>
157
- </html>
158
- ```
159
-
160
- ## With Mail Helper Class
161
-
162
- ```ruby
163
- require 'sendgrid-ruby'
164
- include SendGrid
165
-
166
- mail = SendGrid::Mail.new
167
- mail.from = Email.new(email: 'test@example.com')
168
- mail.subject = 'I\'m replacing the subject tag'
169
- personalization = Personalization.new
170
- personalization.add_to(Email.new(email: 'test@example.com'))
171
- personalization.add_substitution(Substitution.new(key: '-name-', value: 'Example User'))
172
- personalization.add_substitution(Substitution.new(key: '-city-', value: 'Denver'))
173
- mail.add_personalization(personalization)
174
- mail.template_id = '13b8f94f-bcae-4ec6-b752-70d6cb59f932'
175
-
176
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
177
- begin
178
- response = sg.client.mail._("send").post(request_body: mail.to_json)
179
- rescue Exception => e
180
- puts e.message
181
- end
182
- puts response.status_code
183
- puts response.body
184
- puts response.parsed_body
185
- puts response.headers
186
- ```
187
-
188
- ## Without Mail Helper Class
189
-
190
- ```ruby
191
- require 'sendgrid-ruby'
192
- include SendGrid
193
-
194
- data = JSON.parse('{
195
- "personalizations": [
196
- {
197
- "to": [
198
- {
199
- "email": "test@example.com"
200
- }
201
- ],
202
- "substitutions": {
203
- "-name-": "Example User",
204
- "-city-": "Denver"
205
- },
206
- "subject": "I\'m replacing the subject tag"
207
- }
208
- ],
209
- "from": {
210
- "email": "test@example.com"
211
- },
212
- "template_id": "13b8f94f-bcae-4ec6-b752-70d6cb59f932"
213
- }')
214
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
215
- begin
216
- response = sg.client.mail._("send").post(request_body: data)
217
- rescue Exception => e
218
- puts e.message
219
- end
220
- puts response.status_code
221
- puts response.body
222
- puts response.parsed_body
223
- puts response.headers
224
- ```
225
-
226
- ## Adding Attachments
227
-
228
- ```ruby
229
- attachment = Attachment.new
230
- attachment.content = Base64.strict_encode64(File.open(fpath, 'rb').read)
231
- attachment.type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
232
- attachment.filename = fname
233
- attachment.disposition = 'attachment'
234
- attachment.content_id = 'Reports Sheet'
235
- mail.add_attachment(attachment)
236
-
237
- ```
238
- Attachments must be base64 encoded, using Base64's strict_encode64 where no line feeds are added.
239
-
240
- <a name="domain-authentication"></a>
241
- # How to Setup a Domain Authentication
242
-
243
- You can find documentation for how to setup a domain authentication via the UI [here](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) and via API [here](https://github.com/sendgrid/sendgrid-nodejs/blob/master/packages/client/USAGE.md#sender-authentication).
244
-
245
- Find more information about all of SendGrid's authentication related documentation [here](https://sendgrid.com/docs/ui/account-and-settings/).
246
-
247
- <a name="email-statistics"></a>
248
- # How to View Email Statistics
249
-
250
- 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).
251
-
252
- 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 Twilio SendGrid processes your email.
253
-
254
- You can also use the email statistics helper to make it easier to interact with the API.
255
-
256
- ```ruby
257
- require 'sendgrid-ruby'
258
- require 'date'
259
-
260
- include SendGrid
261
-
262
- sg_client = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY']).client
263
- stats = SendGrid::EmailStats.new(sendgrid_client: sg_client)
264
-
265
- # Fetch stats by day, between 2 dates
266
- from = Date.new(2017, 10, 01)
267
- to = Date.new(2017, 10, 12)
268
-
269
- email_stats = stats.by_day(from, to)
270
-
271
- email_stats.metrics
272
-
273
- if !email_stats.error?
274
- email_stats.metrics.each do |metric|
275
- puts "Date - #{metric.date}"
276
- puts "Number of Requests - #{metric.requests}"
277
- puts "Bounces - #{metric.bounces}"
278
- puts "Opens - #{metric.opens}"
279
- puts "Clicks - #{metric.clicks}"
280
- end
281
- end
282
-
283
- # Fetch stats by week, between 2 dates for a category
284
- from = Date.new(2017, 10, 01)
285
- to = Date.new(2017, 10, 12)
286
- category = 'abcd'
287
-
288
- email_stats = stats.by_week(from, to, category)
289
-
290
- if !email_stats.error?
291
- email_stats.metrics.each do |metric|
292
- puts "Date - #{metric.date}"
293
- puts "Number of Requests - #{metric.requests}"
294
- puts "Bounces - #{metric.bounces}"
295
- puts "Opens - #{metric.opens}"
296
- puts "Clicks - #{metric.clicks}"
297
- end
298
- end
299
-
300
- ```
301
-
302
- <a name="sms"></a>
303
- # Send a SMS Message
304
-
305
- Following are the steps to add Twilio SMS to your app:
306
-
307
- ## 1. Obtain a Free Twilio Account
308
-
309
- Sign up for a free Twilio account [here](https://www.twilio.com/try-twilio?source=sendgrid-ruby).
310
-
311
- ## 2. Update Your Environment Variables
312
-
313
- You can obtain your Account Sid and Auth Token from [twilio.com/console](https://twilio.com/console).
314
-
315
- ### Mac
316
-
317
- ```bash
318
- echo "export TWILIO_ACCOUNT_SID='YOUR_TWILIO_ACCOUNT_SID'" > twilio.env
319
- echo "export TWILIO_AUTH_TOKEN='YOUR_TWILIO_AUTH_TOKEN'" >> twilio.env
320
- echo "twilio.env" >> .gitignore
321
- source ./twilio.env
322
- ```
323
-
324
- ### Windows
325
-
326
- Temporarily set the environment variable (accessible only during the current CLI session):
327
-
328
- ```bash
329
- set TWILIO_ACCOUNT_SID=YOUR_TWILIO_ACCOUNT_SID
330
- set TWILIO_AUTH_TOKEN=YOUR_TWILIO_AUTH_TOKEN
331
- ```
332
-
333
- Permanently set the environment variable (accessible in all subsequent CLI sessions):
334
-
335
- ```bash
336
- setx TWILIO_ACCOUNT_SID "YOUR_TWILIO_ACCOUNT_SID"
337
- setx TWILIO_AUTH_TOKEN "YOUR_TWILIO_AUTH_TOKEN"
338
- ```
339
-
340
- ## 3. Install the Twilio Helper Library
341
-
342
- To install using [Bundler][bundler] grab the latest stable version:
343
-
344
- ```ruby
345
- gem 'twilio-ruby', '~> 5.23.1'
346
- ```
347
-
348
- To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
349
-
350
- ```bash
351
- gem install twilio-ruby -v 5.23.1
352
- ```
353
-
354
- ## 4. Setup Work
355
-
356
- ```ruby
357
- require 'twilio-ruby'
358
-
359
- # put your own credentials here
360
- account_sid = ENV['TWILIO_ACCOUNT_SID']
361
- auth_token = ENV['TWILIO_AUTH_TOKEN']
362
-
363
- # set up a client to talk to the Twilio REST API
364
- @client = Twilio::REST::Client.new account_sid, auth_token
365
- ```
366
-
367
- ## 5. Send an SMS
368
-
369
- ```ruby
370
- @client.api.account.messages.create(
371
- from: '+14159341234',
372
- to: '+16105557069',
373
- body: 'Hey there!'
374
- )
375
- ```
376
-
377
- For more information, please visit the [Twilio SMS Ruby documentation](https://www.twilio.com/docs/sms/quickstart/ruby).
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