sendgrid-ruby 6.6.0 → 6.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24757e772b52f0b9e130a824d65bea991c3fe5966f705cd3c2b67fdb8b1ade0e
4
- data.tar.gz: 972ea7b52d490fce2ddb97315356965fab0001e1511087834979620cbeb118a9
3
+ metadata.gz: 0007b5954e3a33c0f866a22292cbdbdac34bc9765bf6cbca06e0c0bef6551e6b
4
+ data.tar.gz: 507d9e1a7e29bfb3c8c47d1f78ff8f36ac0d215265387c92e2b87ec41810ebac
5
5
  SHA512:
6
- metadata.gz: af9a46c70ff25fadfce7458b64a75e0255063d7f082ff8b9d9f4bbff9f0aa3136969864b717f6f01666ee1c04c354a3bb03afc9dc3620de26ffb4b63e0011002
7
- data.tar.gz: 7992f9c04da91c16f76eee4cfd6860df83584046c00cff6a3b3f1b5ac0318e2bde8c8f2ee1329016bc28d0fd7c62a0c92d56bedf71805bfb86a5a6436f85035a
6
+ metadata.gz: c1895f4561c350751bc1aa22b4995132d04fa6c5b76368f57eccde5673114ef50ca42b7d20ebf71d2a35ba2f03c78ebb5b58733c00a004878088fe146dbd0ba6
7
+ data.tar.gz: f3e132f93d9bca92bcf44540f2520e8f66fff095cfc9057aefedf7ffbdc848326259b249ae1567e380bcc1b76b737a63d8a90ff02df0dd94883b985feb7ac1f7
@@ -0,0 +1,15 @@
1
+ name: Lint PR
2
+ on:
3
+ pull_request_target:
4
+ types: [ opened, edited, synchronize, reopened ]
5
+
6
+ jobs:
7
+ validate:
8
+ name: Validate title
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: amannn/action-semantic-pull-request@v4
12
+ with:
13
+ types: chore docs fix feat test misc
14
+ env:
15
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,120 @@
1
+ name: Test and Deploy
2
+ on:
3
+ push:
4
+ branches: [ '*' ]
5
+ tags: [ '*' ]
6
+ pull_request:
7
+ branches: [ main ]
8
+ schedule:
9
+ # Run automatically at 8AM PST Monday-Friday
10
+ - cron: '0 15 * * 1-5'
11
+ workflow_dispatch:
12
+
13
+ jobs:
14
+ test:
15
+ name: Test
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 20
18
+ strategy:
19
+ matrix:
20
+ ruby: [ '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', 'jruby-9.2' ]
21
+ env:
22
+ version: ${{ format('ruby:{0}', matrix.ruby) }}
23
+ DOCKER_LOGIN: ${{ secrets.DOCKER_USERNAME && secrets.DOCKER_AUTH_TOKEN }}
24
+ steps:
25
+ - name: Revise env version if necessary
26
+ run: echo "version=jruby:9.2" >> $GITHUB_ENV
27
+ if: ${{ matrix.ruby == 'jruby-9.2' }}
28
+
29
+ - name: Checkout sendgrid-ruby
30
+ uses: actions/checkout@v2
31
+ with:
32
+ fetch-depth: 0
33
+
34
+ - name: Login to Docker Hub
35
+ if: env.DOCKER_LOGIN
36
+ uses: docker/login-action@v1
37
+ with:
38
+ username: ${{ secrets.DOCKER_USERNAME }}
39
+ password: ${{ secrets.DOCKER_AUTH_TOKEN }}
40
+
41
+ - name: Set up Ruby
42
+ uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{ matrix.ruby }}
45
+ bundler-cache: true
46
+
47
+ - run: make install
48
+
49
+ - name: Set up linter
50
+ run: bundle add rubocop --version "~> 1.24.1" --group "development" --skip-install
51
+ if: ${{ matrix.ruby != '2.4' }}
52
+
53
+ - run: bundle install --with development
54
+
55
+ - name: Run linter
56
+ run: bundle exec rubocop
57
+ if: ${{ matrix.ruby != '2.4' }}
58
+
59
+ - name: Run tests
60
+ run: make test-docker
61
+
62
+ deploy:
63
+ name: Deploy
64
+ if: success() && github.ref_type == 'tag'
65
+ needs: [ test ]
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - name: Checkout sendgrid-ruby
69
+ uses: actions/checkout@v2
70
+ with:
71
+ fetch-depth: 0
72
+
73
+ - name: Set up Ruby
74
+ uses: ruby/setup-ruby@v1
75
+ with:
76
+ ruby-version: 3.1
77
+ bundler-cache: true
78
+
79
+ - run: make install
80
+
81
+ - name: Create GitHub Release
82
+ uses: sendgrid/dx-automator/actions/release@main
83
+ with:
84
+ footer: '**[RubyGems](https://rubygems.org/gems/sendgrid-ruby/versions/${version})**'
85
+ env:
86
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87
+
88
+ - name: Publish to Rubygems
89
+ env:
90
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
91
+ run: |
92
+ mkdir -p $HOME/.gem
93
+ touch $HOME/.gem/credentials
94
+ chmod 0600 $HOME/.gem/credentials
95
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
96
+ gem build *.gemspec
97
+ gem push *.gem
98
+
99
+ - name: Submit metric to Datadog
100
+ uses: sendgrid/dx-automator/actions/datadog-release-metric@main
101
+ env:
102
+ DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
103
+
104
+ notify-on-failure:
105
+ name: Slack notify on failure
106
+ if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
107
+ needs: [ test, deploy ]
108
+ runs-on: ubuntu-latest
109
+ steps:
110
+ - uses: rtCamp/action-slack-notify@v2
111
+ env:
112
+ SLACK_COLOR: failure
113
+ SLACK_ICON_EMOJI: ':github:'
114
+ SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
115
+ SLACK_TITLE: Action Failure - ${{ github.repository }}
116
+ SLACK_USERNAME: GitHub Actions
117
+ SLACK_MSG_AUTHOR: twilio-dx
118
+ SLACK_FOOTER: Posted automatically using GitHub Actions
119
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
120
+ MSG_MINIMAL: true
data/.rubocop_todo.yml CHANGED
@@ -1,11 +1,19 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-09-18 20:20:54 UTC using RuboCop version 0.91.0.
3
+ # on 2022-01-25 23:45:43 UTC using RuboCop version 1.22.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
+ # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
+ Bundler/OrderedGems:
14
+ Exclude:
15
+ - 'Gemfile'
16
+
9
17
  # Offense count: 1
10
18
  # Configuration parameters: Include.
11
19
  # Include: **/*.gemspec
@@ -13,37 +21,37 @@ Gemspec/RequiredRubyVersion:
13
21
  Exclude:
14
22
  - 'sendgrid-ruby.gemspec'
15
23
 
16
- # Offense count: 22
24
+ # Offense count: 1
25
+ # Cop supports --auto-correct.
26
+ # Configuration parameters: EnforcedStyle.
27
+ # SupportedStyles: final_newline, final_blank_line
28
+ Layout/TrailingEmptyLines:
29
+ Exclude:
30
+ - 'Gemfile'
31
+
32
+ # Offense count: 24
17
33
  Lint/UselessAssignment:
18
34
  Exclude:
19
35
  - 'examples/scopes/scopes.rb'
20
36
  - 'spec/rack/sendgrid_webhook_verification_spec.rb'
21
37
 
22
- # Offense count: 8
23
- # Configuration parameters: IgnoredMethods.
38
+ # Offense count: 10
39
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
24
40
  Metrics/AbcSize:
25
- Max: 144
26
-
27
- # Offense count: 9
28
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
29
- # ExcludedMethods: refine
30
- Metrics/BlockLength:
31
- Max: 96
41
+ Max: 134
32
42
 
33
43
  # Offense count: 3
34
44
  # Configuration parameters: CountComments, CountAsOne.
35
45
  Metrics/ClassLength:
36
- Max: 2006
37
- Exclude:
38
- - 'test/sendgrid/test_sendgrid-ruby.rb'
46
+ Max: 2018
39
47
 
40
- # Offense count: 41
41
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
48
+ # Offense count: 45
49
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
42
50
  Metrics/MethodLength:
43
51
  Max: 141
44
52
 
45
- # Offense count: 2
46
- # Configuration parameters: CountKeywordArgs.
53
+ # Offense count: 4
54
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
47
55
  Metrics/ParameterLists:
48
56
  Max: 7
49
57
 
@@ -76,15 +84,15 @@ Naming/PredicateName:
76
84
  - 'examples/helpers/eventwebhook/example.rb'
77
85
 
78
86
  # Offense count: 35
87
+ # Configuration parameters: AllowedConstants.
79
88
  Style/Documentation:
80
89
  Enabled: false
81
90
 
82
- # Offense count: 4
83
- # Configuration parameters: EnforcedStyle.
91
+ # Offense count: 3
92
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
84
93
  # SupportedStyles: annotated, template, unannotated
85
94
  Style/FormatStringToken:
86
- Exclude:
87
- - 'examples/emailactivity/emailactivity.rb'
95
+ EnforcedStyle: unannotated
88
96
 
89
97
  # Offense count: 97
90
98
  # Cop supports --auto-correct.
@@ -93,6 +101,14 @@ Style/FormatStringToken:
93
101
  Style/FrozenStringLiteralComment:
94
102
  Enabled: false
95
103
 
104
+ # Offense count: 1
105
+ # Cop supports --auto-correct.
106
+ # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
107
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
108
+ Style/HashSyntax:
109
+ Exclude:
110
+ - 'Gemfile'
111
+
96
112
  # Offense count: 6
97
113
  Style/MixinUsage:
98
114
  Exclude:
@@ -103,9 +119,9 @@ Style/MixinUsage:
103
119
  - 'test/sendgrid/helpers/mail/test_attachment.rb'
104
120
  - 'test/sendgrid/helpers/mail/test_mail.rb'
105
121
 
106
- # Offense count: 55
122
+ # Offense count: 54
107
123
  # Cop supports --auto-correct.
108
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
124
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
109
125
  # URISchemes: http, https
110
126
  Layout/LineLength:
111
- Max: 3211
127
+ Max: 381
data/CHANGELOG.md CHANGED
@@ -1,6 +1,35 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ [2023-12-01] Version 6.7.0
5
+ --------------------------
6
+ **Library - Feature**
7
+ - [PR #496](https://github.com/sendgrid/sendgrid-ruby/pull/496): geolocation setter in sendgrid-ruby for GDPR compliance. Thanks to [@manisha1997](https://github.com/manisha1997)!
8
+
9
+ **Library - Test**
10
+ - [PR #488](https://github.com/sendgrid/sendgrid-ruby/pull/488): Adding misc as PR type. Thanks to [@rakatyal](https://github.com/rakatyal)!
11
+
12
+ **Library - Docs**
13
+ - [PR #486](https://github.com/sendgrid/sendgrid-ruby/pull/486): Modify README. Thanks to [@garethpaul](https://github.com/garethpaul)!
14
+
15
+
16
+ [2022-03-09] Version 6.6.2
17
+ --------------------------
18
+ **Library - Chore**
19
+ - [PR #483](https://github.com/sendgrid/sendgrid-ruby/pull/483): push Datadog Release Metric upon deploy success. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
20
+
21
+
22
+ [2022-02-09] Version 6.6.1
23
+ --------------------------
24
+ **Library - Chore**
25
+ - [PR #482](https://github.com/sendgrid/sendgrid-ruby/pull/482): upgrade supported language versions. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
26
+ - [PR #480](https://github.com/sendgrid/sendgrid-ruby/pull/480): add gh release to workflow. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)!
27
+ - [PR #478](https://github.com/sendgrid/sendgrid-ruby/pull/478): migrate to gh actions. Thanks to [@beebzz](https://github.com/beebzz)!
28
+
29
+ **Library - Fix**
30
+ - [PR #479](https://github.com/sendgrid/sendgrid-ruby/pull/479): set version env var for tests. Thanks to [@beebzz](https://github.com/beebzz)!
31
+
32
+
4
33
  [2021-11-03] Version 6.6.0
5
34
  --------------------------
6
35
  **Library - Feature**
data/CONTRIBUTING.md CHANGED
@@ -1,9 +1,6 @@
1
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
2
 
3
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
4
  - [Improvements to the Codebase](#improvements-to-the-codebase)
8
5
  - [Development Environment](#development-environment)
9
6
  - [Install and Run Locally](#install-and-run-locally)
@@ -19,33 +16,6 @@ Hello! Thank you for choosing to help contribute to one of the Twilio SendGrid o
19
16
 
20
17
  There are a few ways to contribute, which we'll enumerate below:
21
18
 
22
- <a name="feature-request"></a>
23
- ## Feature Request
24
-
25
- If you'd like to make a feature request, please read this section.
26
-
27
- The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
28
-
29
- - Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
30
- - Please be respectful and considerate of others when commenting on issues
31
-
32
- <a name="submit-a-bug-report"></a>
33
- ## Submit a Bug Report
34
-
35
- Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
36
-
37
- A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
38
-
39
- Before you decide to create a new issue, please try the following:
40
-
41
- 1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
42
- 2. Update to the latest version of this code and check if an issue has already been fixed
43
- 3. Copy and fill in the Bug Report Template we have provided below
44
-
45
- ### Please use our Bug Report Template
46
-
47
- In order to make the process easier, we've included a [sample bug report template](ISSUE_TEMPLATE.md).
48
-
49
19
  <a name="improvements-to-the-codebase"></a>
50
20
  ## Improvements to the Codebase
51
21
 
data/FIRST_TIMERS.md CHANGED
@@ -51,29 +51,3 @@ git push origin <topic-branch-name>
51
51
  ## Important notice
52
52
 
53
53
  Before creating a pull request, make sure that you respect the repository's constraints regarding contributions. You can find them in the [CONTRIBUTING.md](CONTRIBUTING.md) file.
54
-
55
- ## Repositories with Open, Easy, Help Wanted, Issue Filters
56
-
57
- * [Python SDK](https://github.com/sendgrid/sendgrid-python/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
58
- * [PHP SDK](https://github.com/sendgrid/sendgrid-php/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
59
- * [C# SDK](https://github.com/sendgrid/sendgrid-csharp/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
60
- * [Ruby SDK](https://github.com/sendgrid/sendgrid-ruby/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
61
- * [Node.js SDK](https://github.com/sendgrid/sendgrid-nodejs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
62
- * [Java SDK](https://github.com/sendgrid/sendgrid-java/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
63
- * [Go SDK](https://github.com/sendgrid/sendgrid-go/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
64
- * [Python SMTPAPI Client](https://github.com/sendgrid/smtpapi-python/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
65
- * [PHP SMTPAPI Client](https://github.com/sendgrid/smtpapi-php/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
66
- * [C# SMTPAPI Client](https://github.com/sendgrid/smtpapi-csharp/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
67
- * [Ruby SMTPAPI Client](https://github.com/sendgrid/smtpapi-ruby/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
68
- * [Node.js SMTPAPI Client](https://github.com/sendgrid/smtpapi-nodejs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
69
- * [Java SMTPAPI Client](https://github.com/sendgrid/smtpapi-java/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
70
- * [Go SMTPAPI Client](https://github.com/sendgrid/smtpapi-go/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
71
- * [Python HTTP Client](https://github.com/sendgrid/python-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
72
- * [PHP HTTP Client](https://github.com/sendgrid/php-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
73
- * [C# HTTP Client](https://github.com/sendgrid/csharp-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
74
- * [Java HTTP Client](https://github.com/sendgrid/java-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
75
- * [Ruby HTTP Client](https://github.com/sendgrid/ruby-http-client/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
76
- * [Go HTTP Client](https://github.com/sendgrid/rest/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
77
- * [Open API Definition](https://github.com/sendgrid/sendgrid-oai/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
78
- * [DX Automator](https://github.com/sendgrid/dx-automator/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
79
- * [Documentation](https://github.com/sendgrid/docs/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22difficulty%3A+easy%22+label%3A%22status%3A+help+wanted%22)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (C) 2021, Twilio SendGrid, Inc. <help@twilio.com>
3
+ Copyright (C) 2023, Twilio SendGrid, Inc. <help@twilio.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/Makefile CHANGED
@@ -5,7 +5,6 @@ install:
5
5
 
6
6
  test:
7
7
  bundle exec rake
8
- rubocop
9
8
 
10
9
  test-integ: test
11
10
 
@@ -3,7 +3,7 @@ We appreciate the effort for this pull request but before that please make sure
3
3
 
4
4
  Please format the PR title appropriately based on the type of change:
5
5
  <type>[!]: <description>
6
- Where <type> is one of: docs, chore, feat, fix, test.
6
+ Where <type> is one of: docs, chore, feat, fix, test, misc.
7
7
  Add a '!' after the type for breaking changes (e.g. feat!: new breaking feature).
8
8
 
9
9
  **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.**
data/README.md CHANGED
@@ -1,25 +1,19 @@
1
1
  ![Twilio SendGrid Logo](twilio_sendgrid_logo.png)
2
2
 
3
- [![Travis Badge](https://travis-ci.com/sendgrid/sendgrid-ruby.svg?branch=main)](https://travis-ci.com/sendgrid/sendgrid-ruby)
3
+ [![Travis Badge](https://github.com/sendgrid/sendgrid-ruby/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/sendgrid-ruby/actions/workflows/test-and-deploy.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/sendgrid-ruby.svg)](https://badge.fury.io/rb/sendgrid-ruby)
5
5
  [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
6
  [![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
7
7
  [![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-ruby.svg)](https://github.com/sendgrid/sendgrid-ruby/graphs/contributors)
8
8
  [![Open Source Helpers](https://www.codetriage.com/sendgrid/sendgrid-ruby/badges/users.svg)](https://www.codetriage.com/sendgrid/sendgrid-ruby)
9
9
 
10
- **NEW:** Subscribe to email [notifications](https://dx.sendgrid.com/newsletter/ruby) for releases and breaking changes.
11
-
12
- **The default branch name for this repository has been changed to `main` as of 07/27/2020.**
13
-
14
10
  **This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via Ruby.**
15
11
 
16
12
  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).
17
13
 
18
14
  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](CONTRIBUTING.md) or simply upvote or comment on existing issues or pull requests.
19
15
 
20
- Please browse the rest of this README for further details.
21
-
22
- We appreciate your continued support, thank you!
16
+ **If you need help using SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).**
23
17
 
24
18
  # Table of Contents
25
19
 
@@ -33,6 +27,7 @@ We appreciate your continued support, thank you!
33
27
  * [How to Contribute](#contribute)
34
28
  * [Troubleshooting](#troubleshooting)
35
29
  * [About](#about)
30
+ * [Support](#support)
36
31
  * [License](#license)
37
32
 
38
33
  <a name="installation"></a>
@@ -189,9 +184,7 @@ Please see [our helper](lib/sendgrid/helpers/inbound) for utilizing our Inbound
189
184
  <a name="announcements"></a>
190
185
  # Announcements
191
186
 
192
- Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-ruby/issues/94). Your support is appreciated!
193
-
194
- All updates to this library are documented in our [CHANGELOG](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.
187
+ All updates to this library are documented in our [CHANGELOG](CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-ruby/releases).
195
188
 
196
189
  <a name="contribute"></a>
197
190
  # How to Contribute
@@ -213,9 +206,9 @@ Please see our [troubleshooting guide](TROUBLESHOOTING.md) for common library is
213
206
 
214
207
  sendgrid-ruby is maintained and funded by Twilio SendGrid, Inc. The names and logos for sendgrid-ruby are trademarks of Twilio SendGrid, Inc.
215
208
 
216
- If you need help installing or using the library, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).
209
+ <a name="support"></a>
217
210
 
218
- If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!
211
+ If you need help using SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).
219
212
 
220
213
  <a name="license"></a>
221
214
  # License
@@ -0,0 +1,48 @@
1
+ require 'sendgrid-ruby'
2
+
3
+ # Example 1
4
+ # Sending using "global" data residency
5
+
6
+ from = SendGrid::Email.new(email: 'example@abc.com')
7
+ to = SendGrid::Email.new(email: 'example@abc.com')
8
+ subject = 'Sending with Twilio SendGrid is Fun'
9
+ content = SendGrid::Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
10
+ mail = SendGrid::Mail.new(from, subject, to, content)
11
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
12
+ sg.sendgrid_data_residency(region: "global")
13
+ puts sg.host
14
+ response = sg.client.mail._('send').post(request_body: mail.to_json)
15
+ puts response.status_code
16
+ puts response.body
17
+ puts response.headers
18
+
19
+ # Example 2
20
+ # Sending using "eu" data residency
21
+
22
+ from = SendGrid::Email.new(email: 'example@abc.com')
23
+ to = SendGrid::Email.new(email: 'example@abc.com')
24
+ subject = 'Sending with Twilio SendGrid is Fun'
25
+ content = SendGrid::Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
26
+ mail = SendGrid::Mail.new(from, subject, to, content)
27
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY_EU'])
28
+ sg.sendgrid_data_residency(region: 'eu')
29
+ puts sg.host
30
+ response = sg.client.mail._('send').post(request_body: mail.to_json)
31
+ puts response.status_code
32
+ puts response.body
33
+ puts response.headers
34
+
35
+ # Example 3
36
+ # Sending using no data residency
37
+
38
+ from = SendGrid::Email.new(email: 'example@abc.com')
39
+ to = SendGrid::Email.new(email: 'example@abc.com')
40
+ subject = 'Sending with Twilio SendGrid is Fun'
41
+ content = SendGrid::Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
42
+ mail = SendGrid::Mail.new(from, subject, to, content)
43
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
44
+ puts sg.host
45
+ response = sg.client.mail._('send').post(request_body: mail.to_json)
46
+ puts response.status_code
47
+ puts response.body
48
+ puts response.headers
@@ -37,4 +37,21 @@ class BaseInterface
37
37
  request_headers: @request_headers,
38
38
  http_options: @http_options)
39
39
  end
40
+
41
+ # Client libraries contain setters for specifying region/edge.
42
+ # This supports global and eu regions only. This set will likely expand in the future.
43
+ # Global is the default residency (or region)
44
+ # Global region means the message will be sent through https://api.sendgrid.com
45
+ # EU region means the message will be sent through https://api.eu.sendgrid.com
46
+ # Parameters:
47
+ # - region(String) : specify the region. Currently supports "global" and "eu"
48
+ def sendgrid_data_residency(region:)
49
+ region_host_dict = { "eu" => 'https://api.eu.sendgrid.com', "global" => 'https://api.sendgrid.com' }
50
+ raise ArgumentError, "region can only be \"eu\" or \"global\"" if region.nil? || !region_host_dict.key?(region)
51
+
52
+ @host = region_host_dict[region]
53
+ @client = SendGrid::Client.new(host: "#{@host}/#{@version}",
54
+ request_headers: @request_headers,
55
+ http_options: @http_options)
56
+ end
40
57
  end
@@ -1,3 +1,3 @@
1
1
  module SendGrid
2
- VERSION = '6.6.0'.freeze
2
+ VERSION = '6.7.0'.freeze
3
3
  end
@@ -25,7 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rack'
26
26
  spec.add_development_dependency 'rake', '~> 13.0'
27
27
  spec.add_development_dependency 'rspec'
28
- spec.add_development_dependency 'rubocop'
29
28
  spec.add_development_dependency 'simplecov', '~> 0.18.5'
30
29
  spec.add_development_dependency 'sinatra', '>= 1.4.7', '< 3'
31
30
  end
@@ -0,0 +1,44 @@
1
+ require_relative '../../../../lib/sendgrid-ruby'
2
+ require 'minitest/autorun'
3
+
4
+ class TestDataResidency < Minitest::Test
5
+ include SendGrid
6
+
7
+ def setup
8
+ @global_email = 'https://api.sendgrid.com'
9
+ @eu_email = 'https://api.eu.sendgrid.com'
10
+ end
11
+
12
+ def test_with_global_data_residency
13
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
14
+ sg.sendgrid_data_residency(region: 'global')
15
+ assert_equal @global_email, sg.host
16
+ end
17
+
18
+ def test_with_global_eu_residency
19
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
20
+ sg.sendgrid_data_residency(region: 'eu')
21
+ assert_equal @eu_email, sg.host
22
+ end
23
+
24
+ def test_with_global_nil_residency
25
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
26
+ assert_raises(ArgumentError) do
27
+ sg.sendgrid_data_residency(region: nil)
28
+ end
29
+ end
30
+
31
+ def test_with_global_invalid_residency
32
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
33
+ assert_raises(ArgumentError) do
34
+ sg.sendgrid_data_residency(region: "abc")
35
+ end
36
+ end
37
+
38
+ def test_with_global_empty_residency
39
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
40
+ assert_raises(ArgumentError) do
41
+ sg.sendgrid_data_residency(region: "")
42
+ end
43
+ end
44
+ end
@@ -33,7 +33,7 @@ class TestAPI < MiniTest::Test
33
33
  assert_equal(test_headers, sg.request_headers)
34
34
  assert_equal('v3', sg.version)
35
35
  assert_equal(subuser, sg.impersonate_subuser)
36
- assert_equal('6.6.0', SendGrid::VERSION)
36
+ assert_equal('6.7.0', SendGrid::VERSION)
37
37
  assert_instance_of(SendGrid::Client, sg.client)
38
38
  assert_equal({}, sg.http_options)
39
39
  end
@@ -2683,12 +2683,8 @@ class TestAPI < MiniTest::Test
2683
2683
  assert(File.file?('./.gitignore'))
2684
2684
  end
2685
2685
 
2686
- def test_travis_exists
2687
- assert(File.file?('./.travis.yml'))
2688
- end
2689
-
2690
- def test_codeclimate_exists
2691
- assert(File.file?('./.codeclimate.yml'))
2686
+ def test_gh_actions_exists
2687
+ assert(File.file?('./.github/workflows/test-and-deploy.yml'))
2692
2688
  end
2693
2689
 
2694
2690
  def test_changelog_exists
@@ -2703,10 +2699,6 @@ class TestAPI < MiniTest::Test
2703
2699
  assert(File.file?('./CONTRIBUTING.md'))
2704
2700
  end
2705
2701
 
2706
- def test_issue_template_exists
2707
- assert(File.file?('./ISSUE_TEMPLATE.md'))
2708
- end
2709
-
2710
2702
  def test_license_exists
2711
2703
  assert(File.file?('./LICENSE'))
2712
2704
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.6.0
4
+ version: 6.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elmer Thomas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-11-03 00:00:00.000000000 Z
13
+ date: 2023-12-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ruby_http_client
@@ -110,20 +110,6 @@ dependencies:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
- - !ruby/object:Gem::Dependency
114
- name: rubocop
115
- requirement: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- version: '0'
120
- type: :development
121
- prerelease: false
122
- version_requirements: !ruby/object:Gem::Requirement
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
113
  - !ruby/object:Gem::Dependency
128
114
  name: simplecov
129
115
  requirement: !ruby/object:Gem::Requirement
@@ -165,20 +151,18 @@ executables: []
165
151
  extensions: []
166
152
  extra_rdoc_files: []
167
153
  files:
168
- - ".codeclimate.yml"
169
154
  - ".env_sample"
170
- - ".github/ISSUE_TEMPLATE/config.yml"
155
+ - ".github/workflows/pr-lint.yml"
156
+ - ".github/workflows/test-and-deploy.yml"
171
157
  - ".gitignore"
172
158
  - ".rubocop.yml"
173
159
  - ".rubocop_todo.yml"
174
- - ".travis.yml"
175
160
  - CHANGELOG.md
176
161
  - CODE_OF_CONDUCT.md
177
162
  - CONTRIBUTING.md
178
163
  - Dockerfile
179
164
  - FIRST_TIMERS.md
180
165
  - Gemfile
181
- - ISSUE_TEMPLATE.md
182
166
  - LICENSE
183
167
  - Makefile
184
168
  - PULL_REQUEST_TEMPLATE.md
@@ -197,6 +181,7 @@ files:
197
181
  - examples/categories/categories.rb
198
182
  - examples/clients/clients.rb
199
183
  - examples/contactdb/contactdb.rb
184
+ - examples/dataresidency/setregion.rb
200
185
  - examples/devices/devices.rb
201
186
  - examples/emailactivity/emailactivity.rb
202
187
  - examples/geo/geo.rb
@@ -290,6 +275,7 @@ files:
290
275
  - static/img/github-sign-up.png
291
276
  - test/sendgrid/helpers/mail/test_attachment.rb
292
277
  - test/sendgrid/helpers/mail/test_category.rb
278
+ - test/sendgrid/helpers/mail/test_data_residency.rb
293
279
  - test/sendgrid/helpers/mail/test_email.rb
294
280
  - test/sendgrid/helpers/mail/test_mail.rb
295
281
  - test/sendgrid/helpers/mail/test_personalizations.rb
@@ -324,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
310
  - !ruby/object:Gem::Version
325
311
  version: '0'
326
312
  requirements: []
327
- rubygems_version: 3.0.8
313
+ rubygems_version: 3.3.26
328
314
  signing_key:
329
315
  specification_version: 4
330
316
  summary: Official Twilio SendGrid Gem
@@ -346,6 +332,7 @@ test_files:
346
332
  - spec/spec_helper.rb
347
333
  - test/sendgrid/helpers/mail/test_attachment.rb
348
334
  - test/sendgrid/helpers/mail/test_category.rb
335
+ - test/sendgrid/helpers/mail/test_data_residency.rb
349
336
  - test/sendgrid/helpers/mail/test_email.rb
350
337
  - test/sendgrid/helpers/mail/test_mail.rb
351
338
  - test/sendgrid/helpers/mail/test_personalizations.rb
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
- - gemfiles/
20
- - spec/
21
- - test/
@@ -1,10 +0,0 @@
1
- contact_links:
2
- - name: Twilio SendGrid Support
3
- url: https://support.sendgrid.com
4
- about: Get Support
5
- - name: Stack Overflow
6
- url: https://stackoverflow.com/questions/tagged/sendgrid-ruby+or+sendgrid+ruby
7
- about: Ask questions on Stack Overflow
8
- - name: Documentation
9
- url: https://sendgrid.com/docs/for-developers/
10
- about: View Reference Documentation
data/.travis.yml DELETED
@@ -1,31 +0,0 @@
1
- language: ruby
2
- env:
3
- - version=ruby:3.0
4
- - version=ruby:2.7
5
- - version=ruby:2.6
6
- - version=ruby:2.5
7
- - version=ruby:2.4
8
- - version=jruby:9.2
9
- gemfile:
10
- - gemfiles/Sinatra_1.gemfile
11
- - gemfiles/Sinatra_2.gemfile
12
- script:
13
- - if [[ "$TRAVIS_BRANCH" == "main" || "$TRAVIS_BRANCH" == "travis" ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
14
- echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin;
15
- fi
16
- - make test-docker
17
- deploy:
18
- provider: rubygems
19
- api_key: "$RUBYGEMS_API_KEY"
20
- gem: sendgrid-ruby
21
- on:
22
- tags: true
23
- condition: $version = ruby:2.4 && $BUNDLE_GEMFILE = *"gemfiles/Sinatra_1.gemfile"
24
- notifications:
25
- slack:
26
- if: branch = main
27
- on_pull_requests: false
28
- on_success: never
29
- on_failure: change
30
- rooms:
31
- secure: oSeohwM+ernyiRYSRLpNlICk0wgj0lku3y5LuouJLRHs45tCAzLZLbgxsor18wCSJkmhfn2vg4Rn969VnskFuj70OhJSLBKL4UXBnR1Ji0ClpfJlGojcbY/5Z8N/eGDrvf5ofA0Jc+L/ut+oSCMXnstEGbx4wBpPTajHuRtvb34=
data/ISSUE_TEMPLATE.md DELETED
@@ -1,30 +0,0 @@
1
- <!--
2
- If this is a feature request, make sure you search Issues for an existing request before creating a new one!
3
-
4
- Please utilize the template below to help us resolve your issue.
5
-
6
- Note that many issues can be resolved by updating to the latest version.
7
- -->
8
-
9
- ### Issue Summary
10
- 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, or code examples.
11
-
12
- ### Steps to Reproduce
13
- 1. This is the first step
14
- 2. This is the second step
15
- 3. Further steps, etc.
16
-
17
- ### Code Snippet
18
- ```ruby
19
- # paste code here
20
- ```
21
-
22
- ### Exception/Log
23
- ```
24
- # paste exception/log here
25
- ```
26
-
27
- ### Technical details:
28
- * sendgrid-ruby version:
29
- * ruby version:
30
-