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
data/docker/README.md DELETED
@@ -1,30 +0,0 @@
1
- # Docker image for sendgrid-ruby
2
-
3
- ## Quickstart
4
- 1. [Install Docker](https://docs.docker.com/engine/installation/) on your machine.
5
- 2. Run `docker run --rm -it sendgrid/sendgrid-ruby irb`.
6
- 3. Run `require './lib/sendgrid-ruby.rb'`.
7
-
8
- ## Poke around
9
-
10
- If you would like to just poke around in the image and check some examples:
11
- ```sh
12
- docker run --rm -it sendgrid/sendgrid-ruby bash
13
- ```
14
-
15
- If you want to mount your fork or specific version of the gem:
16
- ```sh
17
- docker run --rm -v /path/to/local/sendgrid-ruby:/sources/sendgrid-ruby -it sendgrid/sendgrid-ruby bash
18
- ```
19
-
20
- ## Running tests
21
-
22
- If you would like to run the tests present in the image:
23
- ```sh
24
- docker run --rm sendgrid/sendgrid-ruby rake
25
- ```
26
-
27
- If you want to run tests on your fork or a specific version, mount the codebase onto the image:
28
- ```sh
29
- docker run --rm -v /path/to/local/sendgrid-ruby:/sources/sendgrid-ruby sendgrid/sendgrid-ruby rake
30
- ```
@@ -1,38 +0,0 @@
1
- # Quickly and easily access the Twilio SendGrid API.
2
- require 'ruby_http_client'
3
- require_relative 'version'
4
-
5
- module SendGrid
6
- # Initialize the HTTP client
7
- class API
8
- attr_accessor :client
9
- attr_reader :request_headers, :host, :version, :impersonate_subuser
10
- # * *Args* :
11
- # - +api_key+ -> your Twilio SendGrid API key
12
- # - +host+ -> the base URL for the API
13
- # - +request_headers+ -> any headers that you want to be globally applied
14
- # - +version+ -> the version of the API you wish to access,
15
- # currently only "v3" is supported
16
- #
17
- def initialize(api_key: '', host: nil, request_headers: nil, version: nil, impersonate_subuser: nil)
18
- @api_key = api_key
19
- @host = host ? host : 'https://api.sendgrid.com'
20
- @version = version ? version : 'v3'
21
- @impersonate_subuser = impersonate_subuser
22
- @user_agent = "sendgrid/#{SendGrid::VERSION};ruby"
23
- @request_headers = JSON.parse('
24
- {
25
- "Authorization": "Bearer ' + @api_key + '",
26
- "Accept": "application/json",
27
- "User-agent": "' + @user_agent + '"
28
- }
29
- ')
30
- @request_headers['On-Behalf-Of'] = @impersonate_subuser if @impersonate_subuser
31
-
32
-
33
- @request_headers = @request_headers.merge(request_headers) if request_headers
34
- @client = Client.new(host: "#{@host}/#{@version}",
35
- request_headers: @request_headers)
36
- end
37
- end
38
- end
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