sendgrid-ruby 4.0.8 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +21 -0
  3. data/.env_sample +1 -0
  4. data/.github/PULL_REQUEST_TEMPLATE +26 -0
  5. data/.gitignore +1 -0
  6. data/.travis.yml +11 -2
  7. data/CHANGELOG.md +119 -3
  8. data/CODE_OF_CONDUCT.md +41 -0
  9. data/CONTRIBUTING.md +34 -30
  10. data/Gemfile +4 -1
  11. data/LICENSE.txt +1 -1
  12. data/README.md +53 -24
  13. data/Rakefile +7 -2
  14. data/TROUBLESHOOTING.md +41 -15
  15. data/UPGRADE.md +5 -0
  16. data/USAGE.md +1130 -1129
  17. data/USE_CASES.md +280 -16
  18. data/config.ru +4 -0
  19. data/docker/Dockerfile +12 -0
  20. data/docker/README.md +30 -0
  21. data/examples/helpers/mail/example.rb +62 -45
  22. data/examples/helpers/settings/example.rb +23 -0
  23. data/examples/helpers/stats/example.rb +42 -0
  24. data/examples/ips/ips.rb +13 -0
  25. data/examples/mail/mail.rb +2 -2
  26. data/examples/scopes/scopes.rb +49 -3
  27. data/examples/{whitelabel/whitelabel.rb → senderauthentication/senderauthentication.rb} +27 -27
  28. data/examples/suppression/suppression.rb +10 -10
  29. data/gemfiles/Sinatra_1.gemfile +6 -0
  30. data/gemfiles/Sinatra_2.gemfile +6 -0
  31. data/lib/sendgrid-ruby.rb +27 -1
  32. data/lib/sendgrid/client.rb +12 -9
  33. data/lib/sendgrid/helpers/inbound/README.md +98 -0
  34. data/lib/sendgrid/helpers/inbound/app.rb +32 -0
  35. data/lib/sendgrid/helpers/inbound/config.yml +26 -0
  36. data/lib/sendgrid/helpers/inbound/public/index.html +10 -0
  37. data/lib/sendgrid/helpers/inbound/sample_data/default_data.txt +58 -0
  38. data/lib/sendgrid/helpers/inbound/sample_data/raw_data.txt +57 -0
  39. data/lib/sendgrid/helpers/inbound/sample_data/raw_data_with_attachments.txt +298 -0
  40. data/lib/sendgrid/helpers/inbound/send.rb +26 -0
  41. data/lib/sendgrid/helpers/ip_management/ip_management.rb +17 -0
  42. data/lib/sendgrid/helpers/mail/README.md +1 -1
  43. data/lib/sendgrid/helpers/mail/asm.rb +33 -0
  44. data/lib/sendgrid/helpers/mail/attachment.rb +86 -0
  45. data/lib/sendgrid/helpers/mail/bcc_settings.rb +33 -0
  46. data/lib/sendgrid/helpers/mail/bypass_list_management.rb +43 -0
  47. data/lib/sendgrid/helpers/mail/category.rb +20 -0
  48. data/lib/sendgrid/helpers/mail/click_tracking.rb +33 -0
  49. data/lib/sendgrid/helpers/mail/content.rb +20 -0
  50. data/lib/sendgrid/helpers/mail/custom_arg.rb +24 -0
  51. data/lib/sendgrid/helpers/mail/email.rb +29 -0
  52. data/lib/sendgrid/helpers/mail/footer.rb +43 -0
  53. data/lib/sendgrid/helpers/mail/ganalytics.rb +74 -0
  54. data/lib/sendgrid/helpers/mail/header.rb +24 -0
  55. data/lib/sendgrid/helpers/mail/mail.rb +36 -895
  56. data/lib/sendgrid/helpers/mail/mail_settings.rb +63 -0
  57. data/lib/sendgrid/helpers/mail/open_tracking.rb +33 -0
  58. data/lib/sendgrid/helpers/mail/personalization.rb +82 -0
  59. data/lib/sendgrid/helpers/mail/section.rb +24 -0
  60. data/lib/sendgrid/helpers/mail/spam_check.rb +43 -0
  61. data/lib/sendgrid/helpers/mail/subscription_tracking.rb +53 -0
  62. data/lib/sendgrid/helpers/mail/substitution.rb +24 -0
  63. data/lib/sendgrid/helpers/mail/tracking_settings.rb +53 -0
  64. data/lib/sendgrid/helpers/permissions/scope.rb +28 -0
  65. data/lib/sendgrid/helpers/permissions/scopes.yml +309 -0
  66. data/lib/sendgrid/helpers/settings/README.md +14 -0
  67. data/lib/sendgrid/helpers/settings/mail_settings_dto.rb +13 -0
  68. data/lib/sendgrid/helpers/settings/partner_settings_dto.rb +13 -0
  69. data/lib/sendgrid/helpers/settings/settings.rb +28 -0
  70. data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +24 -0
  71. data/lib/sendgrid/helpers/settings/user_settings_dto.rb +13 -0
  72. data/lib/sendgrid/helpers/stats/email_stats.rb +46 -0
  73. data/lib/sendgrid/helpers/stats/metrics.rb +35 -0
  74. data/lib/sendgrid/helpers/stats/stats_response.rb +31 -0
  75. data/lib/sendgrid/version.rb +2 -2
  76. data/mail_helper_v3.md +390 -0
  77. data/sendgrid-ruby.gemspec +12 -5
  78. data/spec/sendgrid/helpers/ip_management/ip_management_spec.rb +12 -0
  79. data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +32 -0
  80. data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +24 -0
  81. data/spec/sendgrid/helpers/settings/settings_spec.rb +25 -0
  82. data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +27 -0
  83. data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +24 -0
  84. data/spec/sendgrid/helpers/stats/email_stats_spec.rb +112 -0
  85. data/spec/sendgrid/helpers/stats/metrics_spec.rb +46 -0
  86. data/spec/sendgrid/helpers/stats/stats_response_spec.rb +76 -0
  87. data/spec/spec_helper.rb +10 -0
  88. data/test/sendgrid/helpers/mail/test_attachment.rb +35 -0
  89. data/test/sendgrid/helpers/mail/test_category.rb +27 -0
  90. data/test/sendgrid/helpers/mail/test_email.rb +34 -0
  91. data/test/sendgrid/helpers/mail/test_mail.rb +198 -59
  92. data/test/sendgrid/helpers/mail/test_personalizations.rb +161 -0
  93. data/test/sendgrid/permissions/test_scopes.rb +38 -0
  94. data/test/sendgrid/test_sendgrid-ruby.rb +90 -9
  95. metadata +170 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a840acb40e2da148fe009b968673e85da03b126
4
- data.tar.gz: 835cfbda40d0ef43706814349b7db9bd580c622c
3
+ metadata.gz: 2a951fe9149a9c9e1ca5e9c9ce053995bb80810c
4
+ data.tar.gz: e974acc6b662c335d35ad99702a173a70b656c0c
5
5
  SHA512:
6
- metadata.gz: 338e8d6b6a2d2f9ae1f91cc96945f59b607a5c0c9ab859db4cf4a0c5e57227178f26c48714204b357ea099f18aa8e96f208a2ece258f763d4b5748893e037af2
7
- data.tar.gz: 3b24b4d95faddb1a5fd1376ce956738372931476bd712a6c697153fa322b00fba4495d76aeeec698e41ef6263b22a96d645c642e24c6636020a034a694633c14
6
+ metadata.gz: 9f51d4253bd7708337a981c2f196b4e37f3d8b092a469d11b7300815d3faef5bec7c6df32c98c1be8158dd71146d87d4983b560710d4d8715dcf0f1d55f6b62d
7
+ data.tar.gz: 7beeb7406e6e7b5370d42aa5d35b471bcab706b43bead079a58104cc4f641b19f7fa11ec6f17b95d7e0f371c5dde99832369b8fc2940457a907a64d214c0d0d2
@@ -0,0 +1,21 @@
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/
@@ -0,0 +1 @@
1
+ export SENDGRID_API_KEY=''
@@ -0,0 +1,26 @@
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/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  # Created by https://www.gitignore.io
2
2
 
3
3
  ### Ruby ###
4
+ bin
4
5
  *.gem
5
6
  *.rbc
6
7
  /.config
@@ -1,6 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2
3
+ - 2.2.6
4
+ - 2.3.4
5
+ - 2.4.1
6
+ gemfile:
7
+ - gemfiles/Sinatra_1.gemfile
8
+ - gemfiles/Sinatra_2.gemfile
4
9
  before_script:
5
10
  - mkdir prism
6
11
  - mkdir prism/bin
@@ -17,4 +22,8 @@ notifications:
17
22
  format: html
18
23
  notify: false
19
24
  script:
20
- - rake
25
+ - rake test
26
+ - rake spec
27
+ before_install:
28
+ - gem update bundler
29
+
@@ -1,11 +1,127 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [4.0.8] - 2016-2-17 ##
4
+ ## [6.0.0] - 2019-06-04 ##
5
+ ### BREAKING CHANGE
6
+ - [PR #284](https://github.com/sendgrid/sendgrid-ruby/pull/284): The sinatra gem is no longer specified as a dependency of this gem. If you would like to use the inbound processing, please follow the [upgrade guide](https://github.com/sendgrid/sendgrid-ruby/blob/master/UPGRADE.md). Big thanks to [@jjb](https://github.com/jjb) for the PR!
7
+
8
+ ### Added
9
+ - [PR #271](https://github.com/sendgrid/sendgrid-ruby/pull/271): Add ability to impersonate a subuser. Big thanks to [@danilospa](https://github.com/danilospa) for the PR!
10
+ - [PR #278](https://github.com/sendgrid/sendgrid-ruby/pull/278): Make SendGrid permissions management easy. Big thanks to [@sony-mathew](https://github.com/sony-mathew) for the PR!
11
+ - [PR #343](https://github.com/sendgrid/sendgrid-ruby/pull/343) and [PR #345](https://github.com/sendgrid/sendgrid-ruby/pull/345): Update README.md with examples for dynamic templates and corrections to the old legacy template example. Big thanks to [@kylearoberts](https://github.com/kylearoberts) for the PR!
12
+ - [PR #216](https://github.com/sendgrid/sendgrid-ruby/pull/216): Get unassigned IPs example. Big thanks to [@cristianossd](https://github.com/cristianossd) for the PR!
13
+ - [PR #231](https://github.com/sendgrid/sendgrid-ruby/pull/231): Add support for IO objects set as Attachment content. Big thanks to [@awj](https://github.com/awj) for the PR!
14
+ - [PR #232](https://github.com/sendgrid/sendgrid-ruby/pull/232): Add method to check email content for secret keys. Big thanks to [@jaredsilver](https://github.com/jaredsilver) for the PR!
15
+ - [PR #236](https://github.com/sendgrid/sendgrid-ruby/pull/236): Add an IpManagement helper. Big thanks to [@brokenthumbs](https://github.com/brokenthumbs) for the PR!
16
+ - [PR #264](https://github.com/sendgrid/sendgrid-ruby/pull/264): Add Email Statistics helper example. Big thanks to [@jeremyjung](https://github.com/jeremyjung) for the PR!
17
+ - [PR #246](https://github.com/sendgrid/sendgrid-ruby/pull/246): Modified Mail Class calling examples with SendGrid::Mail. Big thanks to [@rohan-techfreak](https://github.com/rohan-techfreak) for the PR!
18
+ - [PR #268](https://github.com/sendgrid/sendgrid-ruby/pull/268): Added Code Review to CONTRIBUTING.md. Big thanks to [@mptap](https://github.com/mptap) for the PR!
19
+ - [PR #276](https://github.com/sendgrid/sendgrid-ruby/pull/276): Codebase Improvement: Use attr_accessor instead of getters and setters. Big thanks to [@rahul26goyal](https://github.com/rahul26goyal) for the PR!
20
+ - [PR #365](https://github.com/sendgrid/sendgrid-ruby/pull/365): Add our Developer Experience Engineer career opportunity to the README. Big thanks to [@mptap](https://github.com/mptap) for the PR!
21
+
22
+ ### Fixes
23
+ - [PR #262](https://github.com/sendgrid/sendgrid-ruby/pull/262): Fix CONTRIBUTING.md formatting. Big thanks to [@thepriefy](https://github.com/thepriefy) for the PR!
24
+ - [PR #277](https://github.com/sendgrid/sendgrid-ruby/pull/277): Fix travis warning. Big thanks to [@rahul26goyal](https://github.com/rahul26goyal) for the PR!
25
+ - [PR #303](https://github.com/sendgrid/sendgrid-ruby/pull/303): Update readme tags and fix minor test failures. Big thanks to [@af4ro](https://github.com/af4ro) for the PR!
26
+ - [PR #370](https://github.com/sendgrid/sendgrid-ruby/pull/370): Remove references to "Whitelabel". Big thanks to [@crweiner](https://github.com/crweiner) for the PR!
27
+ - [PR #383](https://github.com/sendgrid/sendgrid-ruby/pull/383): Correct endpoint for single spam report requests. Big thanks to [@bermannoah](https://github.com/bermannoah) for the PR!
28
+
29
+ ## [5.3.0] - 2018-10-12 ##
30
+ ### Added
31
+ - [PR #300](https://github.com/sendgrid/sendgrid-ruby/pull/300): Support for Dynamic Templates. Big thanks to [@nedcampion](https://github.com/nedcampion) for the PR!
32
+ - [PR #178](https://github.com/sendgrid/sendgrid-ruby/pull/178): Convert key/value arguments to CustomArgs to strings. Big thanks to [@sitaramshelke](https://github.com/sitaramshelke) for the PR!
33
+ - [PR #258](https://github.com/sendgrid/sendgrid-ruby/pull/258): Added unittest to check for specific repo files. Big thanks to [@mptap](https://github.com/mptap) for the PR!
34
+ - [PR #255](https://github.com/sendgrid/sendgrid-ruby/pull/255): Add a unittest to check the license.md file date range. Big thanks to [@prashuchaudhary](https://github.com/prashuchaudhary) for the PR!
35
+ - [PR #181](https://github.com/sendgrid/sendgrid-ruby/pull/181): Add Docker. Big thanks to [@shrivara](https://github.com/shrivara) for the PR!
36
+ - [PR #248](https://github.com/sendgrid/sendgrid-ruby/pull/248): Added .codeclimate.yml. Big thanks to [@proton](https://github.com/proton) for the PR!
37
+ - [PR #260](https://github.com/sendgrid/sendgrid-ruby/pull/260): Update ruby-http-client dependency to support v3.3.0. Big thanks to [@mptap](https://github.com/mptap) for the PR!
38
+ - [PR #304](https://github.com/sendgrid/sendgrid-ruby/pull/304): Readability update for documentation. Big thanks to [@af4ro](https://github.com/af4ro) for the PR!
39
+ - [PR #306](https://github.com/sendgrid/sendgrid-ruby/pull/306): Update example to work in Rails console. Big thanks to [@RogerPodacter](https://github.com/RogerPodacter) for the PR!
40
+
41
+ ### Fixes
42
+ - [PR #252](https://github.com/sendgrid/sendgrid-ruby/pull/252): Update LICENSE, set correct year. Big thanks to [@pushkyn](https://github.com/pushkyn) for the PR!
43
+ - [PR #257](https://github.com/sendgrid/sendgrid-ruby/pull/257): README.md typo fix. Big thanks to [@shucon](https://github.com/shucon) for the PR!
44
+
45
+ ## [5.2.0] - 2017-10-30 ##
46
+ ### Added
47
+ - PR #234: Helpers for email statistics - global, category, subuser
48
+ - Thanks to [Awin Abi](https://github.com/awinabi) for the pull request!
49
+
50
+ ## [5.1.0] - 2017-9-1 ##
51
+ ### Added
52
+ - #173: Update ruby-http-client dependency
53
+ - [#12](https://github.com/sendgrid/ruby-http-client/pull/12) Add a helper that returns the response body as a hash via the `parsed_body` method in the `Response` object.
54
+ - Thanks to [Diego Camargo](https://github.com/belfazt) for the pull request!
55
+
56
+ ## [5.0.0] - 2017-05-27
57
+ ### BREAKING CHANGE
58
+ - #108 Fix unexpected `Mail` `#categories`, `#categories=` behavior
59
+ - Fixed Issue #95 Refactor Mail Helper Array Assignments
60
+ - `personalization.to` becomes `personalization.add_to()`
61
+ - `personalization.cc` becomes `personalization.add_cc()`
62
+ - `personalization.bcc` becomes `personalization.add_bcc()`
63
+ - `personalization.headers` becomes `personalization.add_header()`
64
+ - `personalization.substitutions` becomes `personalization.add_substitution()`
65
+ - `personalization.custom_args` becomes `personalization.add_custom_arg()`
66
+ - `mail.personalizations` becomes `mail.add_personalization()`
67
+ - `mail.contents` becomes `mail.add_content()`
68
+ - `mail.attachments` becomes `mail.add_attachment()`
69
+ - `mail.sections` becomes `mail.add_section()`
70
+ - `mail.headers` becomes `mail.add_header()`
71
+ - `mail.categories` becomes `mail.add_category()`
72
+ - `mail.custom_args` becomes `mail.custom_args()`
73
+ - For a full example of usage, please [see here](https://github.com/sendgrid/sendgrid-ruby/blob/master/examples/helpers/mail/example.rb#L21).
74
+
75
+ ## [4.3.3] - 2017-5-2
76
+ ### Update
77
+ - #157: Specify required ruby version as '>= 2.2'
78
+ - This library does not support [Ruby 2.1 or below](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/).
79
+ - Thanks to [Ryunosuke Sato](https://github.com/tricknotes) for the pull request!
80
+
81
+ ## [4.3.2] - 2017-5-1 ##
82
+ ### Fixes
83
+ - #161: Fixed problematic Sinatra dependency
84
+ - Brings back Rails 4 compatibility (and Rack 1.x applications, in general), also removes release candidate version constraint (both broken in #160). Moreover, ensures that tests are run against two major Sinatra versions, which should protect from compatibility issues in future, somewhat. Related issue: #159.
85
+ - Thanks to [Sebastian Skałacki](https://github.com/skalee) for the pull request!
86
+
87
+ ## [4.3.1] - 2017-4-12 ##
88
+ ### Fixes
89
+ - #160: Updated sinatra version to 2.0
90
+ - Fixes bundler dependency issues with rails >5.0 and rack 2.0. Solves #159
91
+ - Thanks to [gkats](https://github.com/gkats) for the pull request!
92
+
93
+ ## [4.3.0] - 2017-4-12 ##
94
+ ### Added
95
+ - #70: Adds an account settings management helper object
96
+ - See the [helper README](https://github.com/sendgrid/sendgrid-ruby/tree/master/lib/sendgrid/helpers/settings) for details
97
+ - Thanks to [Kyle Kern](https://github.com/kernkw) for the pull request!
98
+
99
+ ## [4.2.1] - 2017-4-10 ##
100
+ ### Fixed
101
+ - #112: Fixes version ambiguity in gemspec
102
+ - Thanks to [Chris McKnight](https://github.com/cmckni3) for the pull request!
103
+
104
+ ## [4.2.0] - 2017-4-10 ##
105
+ ### Added
106
+ - #148: Set api_key to empty string
107
+ - This makes creating an API key for a SendGrid subuser who does not have an API key easier. See #146 for details
108
+ - Thanks to [Adam Beck](https://github.com/Gwash3189) for the pull request!
109
+
110
+ ## [4.1.1] - 2017-4-6 ##
111
+ ### Fixed
112
+ - #115 #134: Fix typos in initialize methods
113
+ - Thanks to [Ben Jackson](https://github.com/benjackson84) for the pull request!
114
+
115
+ ## [4.1.0] - 2017-4-6 ##
116
+ ### Add
117
+ - #144: Add [Inbound Email Parse Webhook](https://sendgrid.com/docs/API_Reference/Webhooks/inbound_email.html) support
118
+ - Thanks to [Wataru Sato](https://github.com/awwa) for the pull request!
119
+
120
+ ## [4.0.8] - 2017-2-17 ##
5
121
  ### Add
6
122
  - Solves #147: Add User Agent string
7
123
 
8
- ## [4.0.7] - 2016-1-25 ##
124
+ ## [4.0.7] - 2017-1-25 ##
9
125
  ### Fixes
10
126
  - [Pull Request #7](https://github.com/sendgrid/ruby-http-client/pull/7)
11
127
  - Fixes [issue #6](https://github.com/sendgrid/ruby-http-client/issues/6): TLS certificates not verified
@@ -108,4 +224,4 @@ Inline content support
108
224
 
109
225
  ## [1.0.3] - 2015-10-01 ##
110
226
  ### Fixed
111
- Payload 'to' attribute fix for smtpapi
227
+ Payload 'to' attribute fix for smtpapi
@@ -0,0 +1,41 @@
1
+ # Twilio SendGrid Community Code of Conduct
2
+
3
+ The Twilio SendGrid open-source community is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences successes and continued growth. When you're working with members of the community, we encourage you to follow these guidelines, which help steer our interactions and strive to maintain a positive, successful and growing community.
4
+
5
+ ### Be Open
6
+ Members of the community are open to collaboration, whether it's on pull requests, code reviews, approvals, issues or otherwise. We're receptive to constructive comments and criticism, as the experiences and skill sets of all members contribute to the whole of our efforts. We're accepting of all who wish to take part in our activities, fostering an environment where anyone can participate, and everyone can make a difference.
7
+
8
+ ### Be Considerate
9
+ Members of the community are considerate of their peers, which include other contributors and users of Twilio SendGrid. We're thoughtful when addressing the efforts of others, keeping in mind that often the labor was completed with the intent of the good of the community. We're attentive in our communications, whether in person or online, and we're tactful when approaching differing views.
10
+
11
+ ### Be Respectful
12
+ Members of the community are respectful. We're respectful of others, their positions, their skills, their commitments and their efforts. We're respectful of the volunteer efforts that permeate the Twilio SendGrid community. We're respectful of the processes outlined in the community, and we work within them. When we disagree, we are courteous in raising our issues. Overall, we're good to each other. We contribute to this community not because we have to, but because we want to. If we remember that, these guidelines will come naturally.
13
+
14
+ ## Additional Guidance
15
+
16
+ ### Disclose Potential Conflicts of Interest
17
+ Community discussions often involve interested parties. We expect participants to be aware when they are conflicted due to employment or other projects they are involved in and disclose those interests to other project members. When in doubt, over-disclose. Perceived conflicts of interest are important to address so that the community’s decisions are credible even when unpopular, difficult or favorable to the interests of one group over another.
18
+
19
+ ### Interpretation
20
+ This Code is not exhaustive or complete. It is not a rulebook; it serves to distill our common understanding of a collaborative, shared environment and goals. We expect it to be followed in spirit as much as in the letter. When in doubt, try to abide by [Twilio SendGrid’s cultural values](https://sendgrid.com/blog/employee-engagement-the-4h-way) defined by our “4H’s”: Happy, Hungry, Humble and Honest.
21
+
22
+ ### Enforcement
23
+ Most members of the Twilio SendGrid community always comply with this Code, not because of the existence of this Code, but because they have long experience participating in open-source communities where the conduct described above is normal and expected. However, failure to observe this Code may be grounds for suspension, reporting the user for abuse or changing permissions for outside contributors.
24
+
25
+ ## If you have concerns about someone’s conduct
26
+ **Initiate Direct Contact** - It is always appropriate to email a community member (if contact information is available), mention that you think their behavior was out of line, and (if necessary) point them to this Code.
27
+
28
+ **Discuss Publicly** - Discussing publicly is always acceptable. Note, though, that approaching the person directly may be better, as it tends to make them less defensive, and it respects the time of other community members, so you probably want to try direct contact first.
29
+
30
+ **Contact the Moderators** - You can reach the Twilio SendGrid moderators by emailing dx@sendgrid.com.
31
+
32
+ ## Submission to Twilio SendGrid Repositories
33
+ Finally, just a reminder, changes to the Twilio SendGrid repositories will only be accepted upon completion of the [Twilio SendGrid Contributor Agreement](https://cla.sendgrid.com).
34
+
35
+ ## Attribution
36
+
37
+ Twilio SendGrid thanks the following, on which it draws for content and inspiration:
38
+
39
+ * [Ruby Community Code of Conduct](https://www.python.org/psf/codeofconduct/)
40
+ * [Open Source Initiative General Code of Conduct](https://opensource.org/codeofconduct)
41
+ * [Apache Code of Conduct](https://www.apache.org/foundation/policies/conduct.html)
@@ -1,32 +1,28 @@
1
- Hello! Thank you for choosing to help contribute to one of the SendGrid open source libraries. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
2
-
3
- - [CLAs and CCLAs](#cla)
4
- - [Roadmap & Milestones](#roadmap)
5
- - [Feature Request](#feature_request)
6
- - [Submit a Bug Report](#submit_a_bug_report)
7
- - [Improvements to the Codebase](#improvements_to_the_codebase)
8
- - [Understanding the Code Base](#understanding_the_codebase)
1
+ Hello! Thank you for choosing to help contribute to one of the Twilio SendGrid open-source libraries. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
2
+
3
+ **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.**
4
+ - [Feature Request](#feature-request)
5
+ - [Submit a Bug Report](#submit-a-bug-report)
6
+ - [Please use our Bug Report Template](#please-use-our-bug-report-template)
7
+ - [Improvements to the Codebase](#improvements-to-the-codebase)
8
+ - [Development Environment](#development-environment)
9
+ - [Install and Run Locally](#install-and-run-locally)
10
+ - [Prerequisites](#prerequisites)
11
+ - [Initial setup:](#initial-setup)
12
+ - [Environment Variables](#environment-variables)
13
+ - [Execute:](#execute)
14
+ - [Understanding the Code Base](#understanding-the-code-base)
9
15
  - [Testing](#testing)
10
- - [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
11
- - [Creating a Pull Request](#creating_a_pull_request)
16
+ - [Style Guidelines & Naming Conventions](#style-guidelines--naming-conventions)
17
+ - [Creating a Pull Request](#creating-a-pull-request)
18
+ - [Code Reviews](#code-reviews)
12
19
 
13
20
  <a name="roadmap"></a>
14
21
  We use [Milestones](https://github.com/sendgrid/sendgrid-ruby/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
15
22
 
16
- <a name="cla"></a>
17
- ## CLAs and CCLAs
18
-
19
- Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) or a SendGrid Company Contributor Licensing Agreement (CCLA) be filled out by every contributor to a SendGrid open source project.
20
-
21
- Our goal with the CLA and CCLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA and CCLA encourage broad participation by our open source community and help us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
22
-
23
- SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA (or CCLA). Copies of the CLA and CCLA are available [here](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view).
24
-
25
- You may submit your completed [CLA or CCLA](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view) to SendGrid at [dx@sendgrid.com](mailto:dx@sendgrid.com). SendGrid will then confirm you are ready to begin making contributions.
26
-
27
23
  There are a few ways to contribute, which we'll enumerate below:
28
24
 
29
- <a name="feature_request"></a>
25
+ <a name="feature-request"></a>
30
26
  ## Feature Request
31
27
 
32
28
  If you'd like to make a feature request, please read this section.
@@ -36,7 +32,7 @@ The GitHub issue tracker is the preferred channel for library feature requests,
36
32
  - Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
37
33
  - Please be respectful and considerate of others when commenting on issues
38
34
 
39
- <a name="submit_a_bug_report"></a>
35
+ <a name="submit-a-bug-report"></a>
40
36
  ## Submit a Bug Report
41
37
 
42
38
  Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
@@ -53,7 +49,7 @@ Before you decide to create a new issue, please try the following:
53
49
 
54
50
  In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/sendgrid-ruby/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
55
51
 
56
- <a name="improvements_to_the_codebase"></a>
52
+ <a name="improvements-to-the-codebase"></a>
57
53
  ## Improvements to the Codebase
58
54
 
59
55
  We welcome direct contributions to the sendgrid-ruby code base. Thank you!
@@ -83,9 +79,9 @@ We welcome direct contributions to the sendgrid-ruby code base. Thank you!
83
79
  bundle install
84
80
  ```
85
81
 
86
- ## Environment Variables
82
+ ### Environment Variables
87
83
 
88
- First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-ruby).
84
+ First, get your free Twilio SendGrid account [here](https://sendgrid.com/free?source=sendgrid-ruby).
89
85
 
90
86
  Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).
91
87
 
@@ -113,7 +109,7 @@ Then run using:
113
109
  ruby example.rb
114
110
  ```
115
111
 
116
- <a name="understanding_the_codebase"></a>
112
+ <a name="understanding-the-codebase"></a>
117
113
  ## Understanding the Code Base
118
114
 
119
115
  **/examples**
@@ -143,7 +139,7 @@ To run the tests:
143
139
  rake
144
140
  ```
145
141
 
146
- <a name="style_guidelines_and_naming_conventions"></a>
142
+ <a name="style-guidelines-and-naming-conventions"></a>
147
143
  ## Style Guidelines & Naming Conventions
148
144
 
149
145
  Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
@@ -154,7 +150,8 @@ Please run your code through:
154
150
 
155
151
  - [rubocop](https://github.com/bbatsov/rubocop).
156
152
 
157
- ## Creating a Pull Request<a name="creating_a_pull_request"></a>
153
+ <a name="creating-a-pull-request"></a>
154
+ ## Creating a Pull Request
158
155
 
159
156
  1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
160
157
  and configure the remotes:
@@ -162,8 +159,10 @@ Please run your code through:
162
159
  ```bash
163
160
  # Clone your fork of the repo into the current directory
164
161
  git clone https://github.com/sendgrid/sendgrid-ruby
162
+
165
163
  # Navigate to the newly cloned directory
166
- cd sendgrid-python
164
+ cd sendgrid-ruby
165
+
167
166
  # Assign the original repo to a remote called "upstream"
168
167
  git remote add upstream https://github.com/sendgrid/sendgrid-ruby
169
168
  ```
@@ -208,3 +207,8 @@ Please run your code through:
208
207
  with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
209
208
 
210
209
  If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.
210
+
211
+ <a name="code-reviews"></a>
212
+ ## Code Reviews
213
+
214
+ If you can, please look at open PRs and review them. Give feedback and help us merge these PRs much faster! If you don't know how, Github has some [great information on how to review a Pull Request](https://help.github.com/articles/about-pull-request-reviews/).
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gemspec
3
+ gemspec
4
+
5
+ gem 'ruby_http_client'
6
+
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2016 SendGrid, Inc.
1
+ Copyright (c) 2014-2019 Twilio SendGrid, Inc.
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,21 +1,31 @@
1
- [![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-ruby)
1
+ ![Twilio SendGrid Logo](https://github.com/sendgrid/sendgrid-python/raw/master/twilio_sendgrid_logo.png)
2
2
 
3
- Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-ruby/issues/94). Your support is appreciated!
3
+ [![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-ruby)
4
+ [![Gem Version](https://badge.fury.io/rb/sendgrid-ruby.svg)](https://badge.fury.io/rb/sendgrid-ruby)
5
+ [![Email Notifications Badge](https://dx.sendgrid.com/badge/ruby)](https://dx.sendgrid.com/newsletter/ruby)
6
+ [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
7
+ [![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
8
+ [![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-ruby.svg)](https://github.com/sendgrid/sendgrid-ruby/graphs/contributors)
9
+ [![Open Source Helpers](https://www.codetriage.com/sendgrid/sendgrid-ruby/badges/users.svg)](https://www.codetriage.com/sendgrid/sendgrid-ruby)
10
+
11
+ **NEW:** Subscribe to email [notifications](https://dx.sendgrid.com/newsletter/ruby) for releases and breaking changes.
4
12
 
5
- **This library allows you to quickly and easily use the SendGrid Web API v3 via Ruby.**
13
+ **This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via Ruby.**
6
14
 
7
- Version 3.X.X+ of this library provides full support for all SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint).
15
+ Version 3.X.X+ of this library provides full support for all Twilio SendGrid [Web API v3](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html) endpoints, including the new [v3 /mail/send](https://sendgrid.com/blog/introducing-v3mailsend-sendgrids-new-mail-endpoint).
8
16
 
9
- This library represents the beginning of a new path for SendGrid. We want this library to be community driven and SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-ruby/issues) and [pull requests](https://github.com/sendgrid/sendgrid-ruby/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests.
17
+ This library represents the beginning of a new path for Twilio SendGrid. We want this library to be community driven and Twilio SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/sendgrid/sendgrid-ruby/issues) and [pull requests](https://github.com/sendgrid/sendgrid-ruby/blob/master/CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests.
10
18
 
11
- Please browse the rest of this README for further detail.
19
+ Please browse the rest of this README for further details.
12
20
 
13
21
  We appreciate your continued support, thank you!
14
22
 
15
23
  # Table of Contents
16
24
 
25
+ * [Announcements](#announcements)
17
26
  * [Installation](#installation)
18
- * [Quick Start](#quick_start)
27
+ * [Quick Start](#quick-start)
28
+ * [Processing Inbound Email](#inbound)
19
29
  * [Usage](#usage)
20
30
  * [Use Cases](#use_cases)
21
31
  * [Announcements](#announcements)
@@ -23,14 +33,21 @@ We appreciate your continued support, thank you!
23
33
  * [How to Contribute](#contribute)
24
34
  * [Troubleshooting](#troubleshooting)
25
35
  * [About](#about)
36
+ * [License](#license)
37
+
38
+ <a name="announcements"></a>
39
+ # Announcements
40
+
41
+ **NEW:** If you're a software engineer who is passionate about #DeveloperExperience and/or #OpenSource, [this is an incredible opportunity to join our #DX team](https://sendgrid.com/careers/role/1421152/?gh_jid=1421152) as a Developer Experience Engineer and work with [@thinkingserious](https://github.com/thinkingserious) and [@aroach](https://github.com/aroach)! Tell your friends :)
42
+
26
43
 
27
44
  <a name="installation"></a>
28
45
  # Installation
29
46
 
30
47
  ## Prerequisites
31
48
 
32
- - Ruby version 2.1+
33
- - The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-ruby)
49
+ - Ruby version >= 2.2 (except version [2.6.0](https://github.com/sendgrid/sendgrid-ruby/blob/master/TROUBLESHOOTING.md#ruby-versions))
50
+ - The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-ruby)
34
51
 
35
52
  ## Setup Environment Variables
36
53
 
@@ -65,7 +82,7 @@ gem install sendgrid-ruby
65
82
 
66
83
  - [Ruby-HTTP-Client](https://github.com/sendgrid/ruby-http-client)
67
84
 
68
- <a name="quick_start"></a>
85
+ <a name="quick-start"></a>
69
86
  # Quick Start
70
87
 
71
88
  ## Hello Email
@@ -78,16 +95,17 @@ The following is the minimum needed code to send an email with the [/mail/send H
78
95
  require 'sendgrid-ruby'
79
96
  include SendGrid
80
97
 
81
- from = Email.new(email: 'test@example.com')
82
- subject = 'Hello World from the SendGrid Ruby Library!'
83
- to = Email.new(email: 'test@example.com')
84
- content = Content.new(type: 'text/plain', value: 'Hello, Email!')
85
- mail = Mail.new(from, subject, to, content)
98
+ from = SendGrid::Email.new(email: 'test@example.com')
99
+ to = SendGrid::Email.new(email: 'test@example.com')
100
+ subject = 'Sending with Twilio SendGrid is Fun'
101
+ content = SendGrid::Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
102
+ mail = SendGrid::Mail.new(from, subject, to, content)
86
103
 
87
104
  sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
88
105
  response = sg.client.mail._('send').post(request_body: mail.to_json)
89
106
  puts response.status_code
90
107
  puts response.body
108
+ puts response.parsed_body
91
109
  puts response.headers
92
110
  ```
93
111
 
@@ -109,7 +127,7 @@ data = JSON.parse('{
109
127
  "email": "test@example.com"
110
128
  }
111
129
  ],
112
- "subject": "Hello World from the SendGrid Ruby Library!"
130
+ "subject": "Sending with Twilio SendGrid is Fun"
113
131
  }
114
132
  ],
115
133
  "from": {
@@ -118,7 +136,7 @@ data = JSON.parse('{
118
136
  "content": [
119
137
  {
120
138
  "type": "text/plain",
121
- "value": "Hello, Email!"
139
+ "value": "and easy to do anywhere, even with Ruby"
122
140
  }
123
141
  ]
124
142
  }')
@@ -126,6 +144,7 @@ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
126
144
  response = sg.client.mail._("send").post(request_body: data)
127
145
  puts response.status_code
128
146
  puts response.body
147
+ puts response.parsed_body
129
148
  puts response.headers
130
149
  ```
131
150
 
@@ -137,6 +156,7 @@ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
137
156
  response = sg.client.suppression.bounces.get()
138
157
  puts response.status_code
139
158
  puts response.body
159
+ puts response.parsed_body
140
160
  puts response.headers
141
161
  ```
142
162
 
@@ -148,19 +168,26 @@ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
148
168
  response = sg.client._("suppression/bounces").get()
149
169
  puts response.status_code
150
170
  puts response.body
171
+ puts response.parsed_body
151
172
  puts response.headers
152
173
  ```
153
174
 
175
+ <a name="inbound"></a>
176
+ # Processing Inbound Email
177
+
178
+ Please see [our helper](https://github.com/sendgrid/sendgrid-ruby/tree/master/lib/sendgrid/helpers/inbound) for utilizing our Inbound Parse webhook.
179
+
154
180
  <a name="usage"></a>
155
181
  # Usage
156
182
 
157
- - [SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html)
183
+ - [Twilio SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html)
158
184
  - [Library Usage Docs](https://github.com/sendgrid/sendgrid-ruby/tree/master/USAGE.md)
159
185
  - [Example Code](https://github.com/sendgrid/sendgrid-ruby/tree/master/examples)
160
186
  - [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)
161
- - [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-python/tree/master/sendgrid/helpers/mail) - build a request object payload for a v3 /mail/send API call.
187
+ - [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-ruby/tree/master/lib/sendgrid/helpers/mail) - build a request object payload for a v3 /mail/send API call.
188
+ - [Settings Helper](https://github.com/sendgrid/sendgrid-ruby/tree/master/lib/sendgrid/helpers/settings)
162
189
 
163
- <a name="use_cases">
190
+ <a name="use_cases"></a>
164
191
  # Use Cases
165
192
 
166
193
  [Examples of common API use cases](https://github.com/sendgrid/sendgrid-ruby/blob/master/USE_CASES.md), such as how to send an email with a transactional template.
@@ -170,7 +197,7 @@ puts response.headers
170
197
 
171
198
  Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-ruby/issues/94). Your support is appreciated!
172
199
 
173
- All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-ruby/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-ruby/releases).
200
+ All updates to this library are documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-ruby/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-ruby/releases). You may also subscribe to email [release notifications](https://dx.sendgrid.com/newsletter/ruby) for releases and breaking changes.
174
201
 
175
202
  <a name="roadmap"></a>
176
203
  # Roadmap
@@ -186,6 +213,7 @@ We encourage contribution to our libraries (you might even score some nifty swag
186
213
  - [Bug Reports](https://github.com/sendgrid/sendgrid-ruby/tree/master/CONTRIBUTING.md#submit_a_bug_report)
187
214
  - [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-ruby/tree/master/CONTRIBUTING.md#cla)
188
215
  - [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-ruby/tree/master/CONTRIBUTING.md#improvements_to_the_codebase)
216
+ - [Review Pull Requests](https://github.com/sendgrid/sendgrid-ruby/blob/master/CONTRIBUTING.md#code-reviews)
189
217
 
190
218
  <a name="troubleshooting"></a>
191
219
  # Troubleshooting
@@ -195,9 +223,10 @@ Please see our [troubleshooting guide](https://github.com/sendgrid/sendgrid-ruby
195
223
  <a name="about"></a>
196
224
  # About
197
225
 
198
- sendgrid-ruby is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
226
+ sendgrid-ruby is guided and supported by the [Developer Experience Team](mailto:dx@sendgrid.com).
199
227
 
200
228
  sendgrid-ruby is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-ruby are trademarks of SendGrid, Inc.
201
229
 
202
- ![SendGrid Logo]
203
- (https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)
230
+ <a name="license"></a>
231
+ # License
232
+ [The MIT License (MIT)](LICENSE.txt)