sendgrid-ruby 6.2.0 → 6.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/config.yml +10 -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 +147 -9
  8. data/CONTRIBUTING.md +11 -21
  9. data/Dockerfile +14 -0
  10. data/FIRST_TIMERS.md +79 -0
  11. data/Gemfile +0 -1
  12. data/ISSUE_TEMPLATE.md +5 -1
  13. data/{LICENSE.md → LICENSE} +1 -1
  14. data/Makefile +9 -2
  15. data/PULL_REQUEST_TEMPLATE.md +5 -5
  16. data/README.md +23 -31
  17. data/Rakefile +2 -3
  18. data/TROUBLESHOOTING.md +17 -5
  19. data/USAGE.md +146 -39
  20. data/examples/accesssettings/accesssettings.rb +9 -12
  21. data/examples/alerts/alerts.rb +8 -11
  22. data/examples/apikeys/apikeys.rb +12 -15
  23. data/examples/asm/asm.rb +27 -30
  24. data/examples/browsers/browsers.rb +0 -3
  25. data/examples/campaigns/campaigns.rb +29 -32
  26. data/examples/categories/categories.rb +0 -3
  27. data/examples/clients/clients.rb +1 -4
  28. data/examples/contactdb/contactdb.rb +63 -66
  29. data/examples/devices/devices.rb +0 -3
  30. data/examples/emailactivity/emailactivity.rb +52 -0
  31. data/examples/geo/geo.rb +0 -3
  32. data/examples/helpers/eventwebhook/example.rb +16 -0
  33. data/examples/helpers/mail/example.rb +24 -13
  34. data/examples/helpers/settings/example.rb +1 -1
  35. data/examples/helpers/stats/example.rb +4 -4
  36. data/examples/ips/ips.rb +19 -22
  37. data/examples/mail/mail.rb +72 -75
  38. data/examples/mailboxproviders/mailboxproviders.rb +0 -3
  39. data/examples/mailsettings/mailsettings.rb +21 -24
  40. data/examples/partnersettings/partnersettings.rb +3 -6
  41. data/examples/scopes/scopes.rb +8 -10
  42. data/examples/senderauthentication/senderauthentication.rb +41 -44
  43. data/examples/senders/senders.rb +28 -31
  44. data/examples/stats/stats.rb +0 -3
  45. data/examples/subusers/subusers.rb +17 -20
  46. data/examples/suppression/suppression.rb +15 -18
  47. data/examples/templates/templates.rb +29 -31
  48. data/examples/trackingsettings/trackingsettings.rb +14 -17
  49. data/examples/user/user.rb +41 -44
  50. data/lib/rack/sendgrid_webhook_verification.rb +55 -0
  51. data/lib/sendgrid/base_interface.rb +8 -4
  52. data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +50 -0
  53. data/lib/sendgrid/helpers/inbound/README.md +5 -5
  54. data/lib/sendgrid/helpers/inbound/app.rb +2 -2
  55. data/lib/sendgrid/helpers/inbound/public/index.html +1 -1
  56. data/lib/sendgrid/helpers/inbound/send.rb +3 -3
  57. data/lib/sendgrid/helpers/ip_management/ip_management.rb +1 -1
  58. data/lib/sendgrid/helpers/mail/README.md +3 -3
  59. data/lib/sendgrid/helpers/mail/asm.rb +6 -18
  60. data/lib/sendgrid/helpers/mail/attachment.rb +12 -42
  61. data/lib/sendgrid/helpers/mail/bcc_settings.rb +6 -18
  62. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +8 -18
  63. data/lib/sendgrid/helpers/mail/category.rb +2 -2
  64. data/lib/sendgrid/helpers/mail/click_tracking.rb +6 -18
  65. data/lib/sendgrid/helpers/mail/content.rb +4 -3
  66. data/lib/sendgrid/helpers/mail/custom_arg.rb +6 -10
  67. data/lib/sendgrid/helpers/mail/email.rb +10 -5
  68. data/lib/sendgrid/helpers/mail/footer.rb +7 -27
  69. data/lib/sendgrid/helpers/mail/ganalytics.rb +10 -54
  70. data/lib/sendgrid/helpers/mail/header.rb +6 -10
  71. data/lib/sendgrid/helpers/mail/mail.rb +32 -48
  72. data/lib/sendgrid/helpers/mail/mail_settings.rb +9 -25
  73. data/lib/sendgrid/helpers/mail/open_tracking.rb +6 -18
  74. data/lib/sendgrid/helpers/mail/personalization.rb +40 -27
  75. data/lib/sendgrid/helpers/mail/section.rb +6 -10
  76. data/lib/sendgrid/helpers/mail/spam_check.rb +7 -27
  77. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +8 -36
  78. data/lib/sendgrid/helpers/mail/substitution.rb +6 -10
  79. data/lib/sendgrid/helpers/mail/tracking_settings.rb +8 -20
  80. data/lib/sendgrid/helpers/permissions/scope.rb +2 -2
  81. data/lib/sendgrid/helpers/settings/README.md +2 -2
  82. data/lib/sendgrid/helpers/settings/settings.rb +1 -1
  83. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
  84. data/lib/sendgrid/helpers/stats/metrics.rb +5 -5
  85. data/lib/sendgrid/sendgrid.rb +4 -3
  86. data/lib/sendgrid/twilio_email.rb +1 -1
  87. data/lib/sendgrid/version.rb +1 -1
  88. data/lib/sendgrid-ruby.rb +2 -0
  89. data/mail_helper_v3.md +12 -12
  90. data/sendgrid-ruby.gemspec +8 -8
  91. data/spec/fixtures/event_webhook.rb +22 -0
  92. data/spec/rack/sendgrid_webhook_verification_spec.rb +142 -0
  93. data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +105 -0
  94. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +3 -3
  95. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +3 -3
  96. data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
  97. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +3 -3
  98. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +3 -3
  99. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
  100. data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
  101. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
  102. data/spec/spec_helper.rb +3 -1
  103. data/static/img/github-fork.png +0 -0
  104. data/static/img/github-sign-up.png +0 -0
  105. data/test/sendgrid/helpers/mail/test_attachment.rb +4 -6
  106. data/test/sendgrid/helpers/mail/test_category.rb +0 -2
  107. data/test/sendgrid/helpers/mail/test_email.rb +17 -10
  108. data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
  109. data/test/sendgrid/helpers/mail/test_personalizations.rb +145 -92
  110. data/test/sendgrid/permissions/test_scopes.rb +1 -3
  111. data/test/sendgrid/test_sendgrid-ruby.rb +1964 -1986
  112. data/twilio_sendgrid_logo.png +0 -0
  113. data/use-cases/README.md +17 -0
  114. data/use-cases/domain-authentication.md +5 -0
  115. data/use-cases/email-statistics.md +52 -0
  116. data/use-cases/legacy-templates.md +98 -0
  117. data/use-cases/personalizations.md +34 -0
  118. data/use-cases/sms.md +39 -0
  119. data/use-cases/transactional-templates.md +111 -0
  120. data/use-cases/twilio-email.md +13 -0
  121. data/use-cases/twilio-setup.md +54 -0
  122. metadata +69 -34
  123. data/.codeclimate.yml +0 -21
  124. data/.travis.yml +0 -40
  125. data/USE_CASES.md +0 -405
  126. data/docker/Dockerfile +0 -12
  127. data/docker/README.md +0 -30
  128. data/test/prism.sh +0 -42
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/
data/.travis.yml DELETED
@@ -1,40 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - ruby-head
4
- - 2.7
5
- - 2.6
6
- - 2.5
7
- - 2.4
8
- - jruby-9.2
9
- gemfile:
10
- - gemfiles/Sinatra_1.gemfile
11
- - gemfiles/Sinatra_2.gemfile
12
- before_script:
13
- - mkdir prism
14
- - mkdir prism/bin
15
- - export PATH=$PATH:$PWD/prism/bin/
16
- - "./test/prism.sh"
17
- install: make install
18
- script: make test
19
- matrix:
20
- allow_failures:
21
- - rvm: ruby-head
22
- fast_finish: true
23
- deploy:
24
- provider: rubygems
25
- api_key:
26
- secure: CWlfN170i/fHPrIufHHLWQ0utjuhxf4ELSxKeypIuO2CNTqNMzocDAa2vxMt4XfO6d2wFPV/LC+IHR7i+sp7PKvjRoa4BLUUxjfBNDboc0gGESeUYlAxwsJo0tOVCNmpxgjQKqtPLz/19A/v/xpxLv2Im/9Idqa5ATd06sMDdM8=
27
- gem: sendgrid-ruby
28
- on:
29
- tags: true
30
- rvm: '2.4'
31
- condition: '$BUNDLE_GEMFILE == *"gemfiles/Sinatra_1.gemfile"'
32
-
33
- notifications:
34
- slack:
35
- if: branch = master
36
- on_pull_requests: false
37
- on_success: never
38
- on_failure: change
39
- rooms:
40
- - secure: QwoVrGveeA1bo/26fO2A+OQHmUX69NLaC214qd18C1Z8ztYMHkd05/9+k9HFb+PSdPkGLSeYOPWAKJUqJWB7HfGINNGpRGIPFcmfB7vhvvLFnhud/SAdQPRZ+SCeZPdpZcjpVRLYENKv259ucGPBCPFXh1HfJF92R0IrKeW5CII=
data/USE_CASES.md DELETED
@@ -1,405 +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 an Email With Twilio Email (Pilot)](#send-an-email-with-twilio-email-pilot)
15
- * [Send an SMS Message](#send-an-sms-message)
16
-
17
- <a name="transactional-templates"></a>
18
- # Transactional Templates
19
-
20
- 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.
21
-
22
- Template ID (replace with your own):
23
-
24
- ```text
25
- d-2c214ac919e84170b21855cc129b4a5f
26
- ```
27
- Email Subject:
28
- ```text
29
- {{subject}}
30
- ```
31
-
32
- Template Body:
33
-
34
- ```html
35
- <html>
36
- <head>
37
- <title></title>
38
- </head>
39
- <body>
40
- Hello {{name}},
41
- <br/><br/>
42
- I'm glad you are trying out the template feature!
43
- <br/><br/>
44
- I hope you are having a great day in {{city}} :)
45
- <br/><br/>
46
- </body>
47
- </html>
48
- ```
49
-
50
- ## With Mail Helper Class
51
- ```ruby
52
- require 'sendgrid-ruby'
53
- include SendGrid
54
-
55
- mail = Mail.new
56
- mail.from = Email.new(email: 'test@example.com')
57
- personalization = Personalization.new
58
- personalization.add_to(Email.new(email: 'test@example.com'))
59
- personalization.add_dynamic_template_data({
60
- "subject" => "Testing Templates",
61
- "name" => "Example User",
62
- "city" => "Denver"
63
- })
64
- mail.add_personalization(personalization)
65
- mail.template_id = 'd-2c214ac919e84170b21855cc129b4a5f'
66
-
67
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
68
- begin
69
- response = sg.client.mail._("send").post(request_body: mail.to_json)
70
- rescue Exception => e
71
- puts e.message
72
- end
73
- puts response.status_code
74
- puts response.body
75
- puts response.parsed_body
76
- puts response.headers
77
- ```
78
-
79
- ## Without Mail Helper Class
80
-
81
- ```ruby
82
- require 'sendgrid-ruby'
83
- include SendGrid
84
-
85
- data = JSON.parse('{
86
- "personalizations": [
87
- {
88
- "to": [
89
- {
90
- "email": "test@example.com"
91
- }
92
- ],
93
- "dynamic_template_data": {
94
- "subject": "Testing Templates",
95
- "name": "Example User",
96
- "city": "Denver"
97
- }
98
- }
99
- ],
100
- "from": {
101
- "email": "test@example.com"
102
- },
103
- "template_id": "d-2c214ac919e84170b21855cc129b4a5f"
104
- }')
105
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
106
- begin
107
- response = sg.client.mail._("send").post(request_body: data)
108
- rescue Exception => e
109
- puts e.message
110
- end
111
- puts response.status_code
112
- puts response.body
113
- puts response.parsed_body
114
- puts response.headers
115
- ```
116
-
117
- <a name="legacy-templates"></a>
118
- # Legacy Templates
119
-
120
- 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.
121
-
122
- Template ID (replace with your own):
123
-
124
- ```text
125
- 13b8f94f-bcae-4ec6-b752-70d6cb59f932
126
- ```
127
-
128
- Email Subject:
129
-
130
- ```text
131
- <%subject%>
132
- ```
133
-
134
- Template Body:
135
-
136
- ```html
137
- <html>
138
- <head>
139
- <title></title>
140
- </head>
141
- <body>
142
- Hello -name-,
143
- <br /><br/>
144
- I'm glad you are trying out the template feature!
145
- <br /><br/>
146
- <%body%>
147
- <br /><br/>
148
- I hope you are having a great day in -city- :)
149
- <br /><br/>
150
- </body>
151
- </html>
152
- ```
153
-
154
- ## With Mail Helper Class
155
-
156
- ```ruby
157
- require 'sendgrid-ruby'
158
- include SendGrid
159
-
160
- mail = SendGrid::Mail.new
161
- mail.from = Email.new(email: 'test@example.com')
162
- mail.subject = 'I\'m replacing the subject tag'
163
- personalization = Personalization.new
164
- personalization.add_to(Email.new(email: 'test@example.com'))
165
- personalization.add_substitution(Substitution.new(key: '-name-', value: 'Example User'))
166
- personalization.add_substitution(Substitution.new(key: '-city-', value: 'Denver'))
167
- mail.add_personalization(personalization)
168
- mail.template_id = '13b8f94f-bcae-4ec6-b752-70d6cb59f932'
169
-
170
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
171
- begin
172
- response = sg.client.mail._("send").post(request_body: mail.to_json)
173
- rescue Exception => e
174
- puts e.message
175
- end
176
- puts response.status_code
177
- puts response.body
178
- puts response.parsed_body
179
- puts response.headers
180
- ```
181
-
182
- ## Without Mail Helper Class
183
-
184
- ```ruby
185
- require 'sendgrid-ruby'
186
- include SendGrid
187
-
188
- data = JSON.parse('{
189
- "personalizations": [
190
- {
191
- "to": [
192
- {
193
- "email": "test@example.com"
194
- }
195
- ],
196
- "substitutions": {
197
- "-name-": "Example User",
198
- "-city-": "Denver"
199
- },
200
- "subject": "I\'m replacing the subject tag"
201
- }
202
- ],
203
- "from": {
204
- "email": "test@example.com"
205
- },
206
- "template_id": "13b8f94f-bcae-4ec6-b752-70d6cb59f932"
207
- }')
208
- sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
209
- begin
210
- response = sg.client.mail._("send").post(request_body: data)
211
- rescue Exception => e
212
- puts e.message
213
- end
214
- puts response.status_code
215
- puts response.body
216
- puts response.parsed_body
217
- puts response.headers
218
- ```
219
-
220
- ## Adding Attachments
221
-
222
- ```ruby
223
- attachment = Attachment.new
224
- attachment.content = Base64.strict_encode64(File.open(fpath, 'rb').read)
225
- attachment.type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
226
- attachment.filename = fname
227
- attachment.disposition = 'attachment'
228
- attachment.content_id = 'Reports Sheet'
229
- mail.add_attachment(attachment)
230
-
231
- ```
232
- Attachments must be base64 encoded, using Base64's strict_encode64 where no line feeds are added.
233
-
234
- <a name="domain-authentication"></a>
235
- # How to Setup a Domain Authentication
236
-
237
- 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).
238
-
239
- Find more information about all of SendGrid's authentication related documentation [here](https://sendgrid.com/docs/ui/account-and-settings/).
240
-
241
- <a name="email-statistics"></a>
242
- # How to View Email Statistics
243
-
244
- 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).
245
-
246
- 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.
247
-
248
- You can also use the email statistics helper to make it easier to interact with the API.
249
-
250
- ```ruby
251
- require 'sendgrid-ruby'
252
- require 'date'
253
-
254
- include SendGrid
255
-
256
- sg_client = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY']).client
257
- stats = SendGrid::EmailStats.new(sendgrid_client: sg_client)
258
-
259
- # Fetch stats by day, between 2 dates
260
- from = Date.new(2017, 10, 01)
261
- to = Date.new(2017, 10, 12)
262
-
263
- email_stats = stats.by_day(from, to)
264
-
265
- email_stats.metrics
266
-
267
- if !email_stats.error?
268
- email_stats.metrics.each do |metric|
269
- puts "Date - #{metric.date}"
270
- puts "Number of Requests - #{metric.requests}"
271
- puts "Bounces - #{metric.bounces}"
272
- puts "Opens - #{metric.opens}"
273
- puts "Clicks - #{metric.clicks}"
274
- end
275
- end
276
-
277
- # Fetch stats by week, between 2 dates for a category
278
- from = Date.new(2017, 10, 01)
279
- to = Date.new(2017, 10, 12)
280
- category = 'abcd'
281
-
282
- email_stats = stats.by_week(from, to, category)
283
-
284
- if !email_stats.error?
285
- email_stats.metrics.each do |metric|
286
- puts "Date - #{metric.date}"
287
- puts "Number of Requests - #{metric.requests}"
288
- puts "Bounces - #{metric.bounces}"
289
- puts "Opens - #{metric.opens}"
290
- puts "Clicks - #{metric.clicks}"
291
- end
292
- end
293
-
294
- ```
295
-
296
- # Send an Email With Twilio Email (Pilot)
297
-
298
- ### 1. Obtain a Free Twilio Account
299
-
300
- Sign up for a free Twilio account [here](https://www.twilio.com/try-twilio?source=sendgrid-ruby).
301
-
302
- ### 2. Set Up Your Environment Variables
303
-
304
- The Twilio API allows for authentication using with either an API key/secret or your Account SID/Auth Token. You can create an API key [here](https://twil.io/get-api-key) or obtain your Account SID and Auth Token [here](https://twil.io/console).
305
-
306
- Once you have those, follow the steps below based on your operating system.
307
-
308
- #### Linux/Mac
309
-
310
- ```bash
311
- echo "export TWILIO_API_KEY='YOUR_TWILIO_API_KEY'" > twilio.env
312
- echo "export TWILIO_API_SECRET='YOUR_TWILIO_API_SECRET'" >> twilio.env
313
-
314
- # or
315
-
316
- echo "export TWILIO_ACCOUNT_SID='YOUR_TWILIO_ACCOUNT_SID'" > twilio.env
317
- echo "export TWILIO_AUTH_TOKEN='YOUR_TWILIO_AUTH_TOKEN'" >> twilio.env
318
- ```
319
-
320
- Then:
321
-
322
- ```bash
323
- echo "twilio.env" >> .gitignore
324
- source ./twilio.env
325
- ```
326
-
327
- #### Windows
328
-
329
- Temporarily set the environment variable (accessible only during the current CLI session):
330
-
331
- ```bash
332
- set TWILIO_API_KEY=YOUR_TWILIO_API_KEY
333
- set TWILIO_API_SECRET=YOUR_TWILIO_API_SECRET
334
-
335
- : or
336
-
337
- set TWILIO_ACCOUNT_SID=YOUR_TWILIO_ACCOUNT_SID
338
- set TWILIO_AUTH_TOKEN=YOUR_TWILIO_AUTH_TOKEN
339
- ```
340
-
341
- Or permanently set the environment variable (accessible in all subsequent CLI sessions):
342
-
343
- ```bash
344
- setx TWILIO_API_KEY "YOUR_TWILIO_API_KEY"
345
- setx TWILIO_API_SECRET "YOUR_TWILIO_API_SECRET"
346
-
347
- : or
348
-
349
- setx TWILIO_ACCOUNT_SID "YOUR_TWILIO_ACCOUNT_SID"
350
- setx TWILIO_AUTH_TOKEN "YOUR_TWILIO_AUTH_TOKEN"
351
- ```
352
-
353
- ### 3. Initialize the Twilio Email Client
354
-
355
- ```ruby
356
- mail_client = TwilioEmail::API(username: ENV['TWILIO_API_KEY'], password: ENV['TWILIO_API_SECRET'])
357
-
358
- # or
359
-
360
- mail_client = TwilioEmail::API(username: ENV['TWILIO_ACCOUNT_SID'], password: ENV['TWILIO_AUTH_TOKEN'])
361
- ```
362
-
363
- This client has the same interface as the `SendGrid::API` client.
364
-
365
- # Send an SMS Message
366
-
367
- First, follow the above steps for creating a Twilio account and setting up environment variables with the proper credentials.
368
-
369
- Then, install the Twilio Helper Library. Add this line to your application's Gemfile:
370
-
371
- ```bash
372
- gem 'twilio-ruby'
373
- ```
374
-
375
- And then execute:
376
-
377
- ```bash
378
- bundle
379
- ```
380
-
381
- Or install it yourself using:
382
-
383
- ```bash
384
- gem install twilio-ruby
385
- ```
386
-
387
- Finally, send a message.
388
-
389
- ```ruby
390
- require 'twilio-ruby'
391
-
392
- # put your own credentials here
393
- account_sid = ENV['TWILIO_ACCOUNT_SID']
394
- auth_token = ENV['TWILIO_AUTH_TOKEN']
395
-
396
- # set up a client to talk to the Twilio REST API
397
- @client = Twilio::REST::Client.new account_sid, auth_token
398
- @client.api.account.messages.create(
399
- from: '+14159341234',
400
- to: '+16105557069',
401
- body: 'Hey there!'
402
- )
403
- ```
404
-
405
- 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.5.1-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
- ```
data/test/prism.sh DELETED
@@ -1,42 +0,0 @@
1
- #!/bin/bash
2
-
3
- install () {
4
-
5
- set -eu
6
-
7
- UNAME=$(uname)
8
- ARCH=$(uname -m)
9
- if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then
10
- echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases"
11
- exit 1
12
- fi
13
-
14
- if [ "$UNAME" = "Darwin" ] ; then
15
- OSX_ARCH=$(uname -m)
16
- if [ "${OSX_ARCH}" = "x86_64" ] ; then
17
- PLATFORM="darwin_amd64"
18
- fi
19
- elif [ "$UNAME" = "Linux" ] ; then
20
- LINUX_ARCH=$(uname -m)
21
- if [ "${LINUX_ARCH}" = "i686" ] ; then
22
- PLATFORM="linux_386"
23
- elif [ "${LINUX_ARCH}" = "x86_64" ] ; then
24
- PLATFORM="linux_amd64"
25
- fi
26
- fi
27
-
28
- #LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2)
29
- LATEST="v0.2.7"
30
- URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM"
31
- DEST=./prism/bin/prism
32
-
33
- if [ -z $LATEST ] ; then
34
- echo "Error requesting. Download binary from ${URL}"
35
- exit 1
36
- else
37
- curl -L $URL -o $DEST
38
- chmod +x $DEST
39
- fi
40
- }
41
-
42
- install