sendgrid-ruby 6.5.2 → 6.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test-and-deploy.yml +120 -0
- data/.rubocop_todo.yml +41 -25
- data/CHANGELOG.md +23 -0
- data/LICENSE +1 -1
- data/Makefile +0 -1
- data/README.md +1 -3
- data/examples/helpers/mail/example.rb +1 -1
- data/lib/sendgrid/helpers/mail/personalization.rb +6 -2
- data/lib/sendgrid/version.rb +1 -1
- data/sendgrid-ruby.gemspec +0 -1
- data/test/sendgrid/helpers/mail/test_personalizations.rb +13 -0
- data/test/sendgrid/test_sendgrid-ruby.rb +3 -7
- data/use-cases/README.md +1 -0
- data/use-cases/personalizations.md +34 -0
- metadata +5 -19
- data/.codeclimate.yml +0 -21
- data/.travis.yml +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e118713291ab6d133c75101195e33de03deb99d1e950cb55df8a266df10528d
|
4
|
+
data.tar.gz: e444657f217f6d84af54743baa09f145795f9424ac74a6852fc5a73435f18e75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2e41e61bc35633b62734361034a864fac34e6e6351122858d0dfefe9c98b9d7216bc91628d1c68ccc39c83a538e5f019de729102f648164382d8e01e1abed0c
|
7
|
+
data.tar.gz: 450c8ea54db164636cf3101080808248a9602689b17c9be9e3e93f138694019d72422d77d273ac1723077e97d12d7f0676ec479e62dfc434f82631e54f2049ab
|
@@ -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
|
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:
|
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:
|
23
|
-
# Configuration parameters: IgnoredMethods.
|
38
|
+
# Offense count: 10
|
39
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
24
40
|
Metrics/AbcSize:
|
25
|
-
Max:
|
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:
|
37
|
-
Exclude:
|
38
|
-
- 'test/sendgrid/test_sendgrid-ruby.rb'
|
46
|
+
Max: 2018
|
39
47
|
|
40
|
-
# Offense count:
|
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:
|
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:
|
83
|
-
# Configuration parameters:
|
91
|
+
# Offense count: 3
|
92
|
+
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
|
84
93
|
# SupportedStyles: annotated, template, unannotated
|
85
94
|
Style/FormatStringToken:
|
86
|
-
|
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:
|
122
|
+
# Offense count: 54
|
107
123
|
# Cop supports --auto-correct.
|
108
|
-
# Configuration parameters:
|
124
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
109
125
|
# URISchemes: http, https
|
110
126
|
Layout/LineLength:
|
111
|
-
Max:
|
127
|
+
Max: 381
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
[2022-03-09] Version 6.6.2
|
5
|
+
--------------------------
|
6
|
+
**Library - Chore**
|
7
|
+
- [PR #483](https://github.com/sendgrid/sendgrid-ruby/pull/483): push Datadog Release Metric upon deploy success. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
|
8
|
+
|
9
|
+
|
10
|
+
[2022-02-09] Version 6.6.1
|
11
|
+
--------------------------
|
12
|
+
**Library - Chore**
|
13
|
+
- [PR #482](https://github.com/sendgrid/sendgrid-ruby/pull/482): upgrade supported language versions. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
14
|
+
- [PR #480](https://github.com/sendgrid/sendgrid-ruby/pull/480): add gh release to workflow. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)!
|
15
|
+
- [PR #478](https://github.com/sendgrid/sendgrid-ruby/pull/478): migrate to gh actions. Thanks to [@beebzz](https://github.com/beebzz)!
|
16
|
+
|
17
|
+
**Library - Fix**
|
18
|
+
- [PR #479](https://github.com/sendgrid/sendgrid-ruby/pull/479): set version env var for tests. Thanks to [@beebzz](https://github.com/beebzz)!
|
19
|
+
|
20
|
+
|
21
|
+
[2021-11-03] Version 6.6.0
|
22
|
+
--------------------------
|
23
|
+
**Library - Feature**
|
24
|
+
- [PR #473](https://github.com/sendgrid/sendgrid-ruby/pull/473): update tests, use-cases, examples and implementation for From personalization. Thanks to [@beebzz](https://github.com/beebzz)!
|
25
|
+
|
26
|
+
|
4
27
|
[2021-10-18] Version 6.5.2
|
5
28
|
--------------------------
|
6
29
|
**Library - Docs**
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (C)
|
3
|
+
Copyright (C) 2022, 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
data/README.md
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
![Twilio SendGrid Logo](twilio_sendgrid_logo.png)
|
2
2
|
|
3
|
-
[![Travis Badge](https://
|
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
10
|
**The default branch name for this repository has been changed to `main` as of 07/27/2020.**
|
13
11
|
|
14
12
|
**This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via Ruby.**
|
@@ -32,7 +32,7 @@ def kitchen_sink
|
|
32
32
|
personalization.add_bcc(Email.new(email: 'test6@example.com', name: 'Example User'))
|
33
33
|
# Note, the domain of the from email property specified in any personalization must
|
34
34
|
# match the domain of the from email property specified at root level
|
35
|
-
personalization.
|
35
|
+
personalization.add_from(Email.new(email: 'alias@example.com', name: "My alias"))
|
36
36
|
personalization.subject = 'Hello World from the Personalized Twilio SendGrid Ruby Library'
|
37
37
|
personalization.add_header(Header.new(key: 'X-Test', value: 'True'))
|
38
38
|
personalization.add_header(Header.new(key: 'X-Mock', value: 'False'))
|
@@ -2,10 +2,10 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class Personalization
|
5
|
-
attr_reader :tos, :ccs, :bccs, :headers, :substitutions, :custom_args,
|
5
|
+
attr_reader :tos, :from, :ccs, :bccs, :headers, :substitutions, :custom_args,
|
6
6
|
:dynamic_template_data
|
7
7
|
|
8
|
-
attr_accessor :send_at, :subject
|
8
|
+
attr_accessor :send_at, :subject
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
@tos = []
|
@@ -26,6 +26,10 @@ module SendGrid
|
|
26
26
|
@tos << to.to_json
|
27
27
|
end
|
28
28
|
|
29
|
+
def add_from(from)
|
30
|
+
@from = from.to_json
|
31
|
+
end
|
32
|
+
|
29
33
|
def add_cc(cc)
|
30
34
|
raise DuplicatePersonalizationError if duplicate?(cc)
|
31
35
|
|
data/lib/sendgrid/version.rb
CHANGED
data/sendgrid-ruby.gemspec
CHANGED
@@ -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
|
@@ -45,6 +45,19 @@ class TestPersonalization < Minitest::Test
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def test_add_from
|
49
|
+
@personalization = Personalization.new
|
50
|
+
@personalization.add_from(Email.new(email: 'from1@example.com', name: 'Example Sender'))
|
51
|
+
expected_json = {
|
52
|
+
'from' => {
|
53
|
+
'email' => 'from1@example.com',
|
54
|
+
'name' => 'Example Sender'
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
assert_equal @personalization.to_json, expected_json
|
59
|
+
end
|
60
|
+
|
48
61
|
def test_add_cc
|
49
62
|
@personalization = Personalization.new
|
50
63
|
@personalization.add_cc(Email.new(email: 'test1@example.com', name: 'Example User'))
|
@@ -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.
|
36
|
+
assert_equal('6.6.2', 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
|
2687
|
-
assert(File.file?('./.
|
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
|
data/use-cases/README.md
CHANGED
@@ -5,6 +5,7 @@ Please [open an issue](https://github.com/sendgrid/sendgrid-ruby/issues) or [mak
|
|
5
5
|
# Email Use Cases
|
6
6
|
* [Transactional Templates](transactional-templates.md)
|
7
7
|
* [Legacy Templates](legacy-templates.md)
|
8
|
+
* [Personalizations](personalizations.md)
|
8
9
|
|
9
10
|
# Twilio Use Cases
|
10
11
|
* [Twilio Setup](twilio-setup.md)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Personalizations
|
2
|
+
|
3
|
+
This example demonstrates how to send multiple emails with personalizations. For further documentation, refer to [the SendGrid docs](https://docs.sendgrid.com/for-developers/sending-email/personalizations).
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
require 'sendgrid-ruby'
|
7
|
+
include SendGrid
|
8
|
+
|
9
|
+
# Note that the domain for all From addresses must match
|
10
|
+
mail = Mail.new
|
11
|
+
mail.from = Email.new(email: 'test@example.com')
|
12
|
+
mail.add_content(Content.new(type: 'text/plain', value: 'Some test text'))
|
13
|
+
mail.subject = 'Personalized Test Email'
|
14
|
+
|
15
|
+
personalization = Personalization.new
|
16
|
+
personalization.add_to(Email.new(email: 'test1@example.com'))
|
17
|
+
mail.add_personalization(personalization)
|
18
|
+
|
19
|
+
personalization2 = Personalization.new
|
20
|
+
personalization2.add_to(Email.new(email: 'test2@example.com'))
|
21
|
+
personalization2.add_from(Email.new(email: 'test3@example.com'))
|
22
|
+
mail.add_personalization(personalization2)
|
23
|
+
|
24
|
+
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
|
25
|
+
begin
|
26
|
+
response = sg.client.mail._("send").post(request_body: mail.to_json)
|
27
|
+
rescue Exception => e
|
28
|
+
puts e.message
|
29
|
+
end
|
30
|
+
|
31
|
+
puts response.status_code
|
32
|
+
puts response.body
|
33
|
+
puts response.headers
|
34
|
+
```
|
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.
|
4
|
+
version: 6.6.2
|
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:
|
13
|
+
date: 2022-03-09 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,13 +151,12 @@ executables: []
|
|
165
151
|
extensions: []
|
166
152
|
extra_rdoc_files: []
|
167
153
|
files:
|
168
|
-
- ".codeclimate.yml"
|
169
154
|
- ".env_sample"
|
170
155
|
- ".github/ISSUE_TEMPLATE/config.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
|
@@ -300,6 +285,7 @@ files:
|
|
300
285
|
- use-cases/domain-authentication.md
|
301
286
|
- use-cases/email-statistics.md
|
302
287
|
- use-cases/legacy-templates.md
|
288
|
+
- use-cases/personalizations.md
|
303
289
|
- use-cases/sms.md
|
304
290
|
- use-cases/transactional-templates.md
|
305
291
|
- use-cases/twilio-email.md
|
@@ -323,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
323
309
|
- !ruby/object:Gem::Version
|
324
310
|
version: '0'
|
325
311
|
requirements: []
|
326
|
-
rubygems_version: 3.
|
312
|
+
rubygems_version: 3.3.7
|
327
313
|
signing_key:
|
328
314
|
specification_version: 4
|
329
315
|
summary: Official Twilio SendGrid Gem
|
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/
|
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=
|