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.
- checksums.yaml +5 -5
- data/.codeclimate.yml +1 -1
- data/.gitignore +2 -0
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +111 -0
- data/.travis.yml +26 -25
- data/CHANGELOG.md +185 -10
- data/CODE_OF_CONDUCT.md +57 -25
- data/CONTRIBUTING.md +11 -23
- data/Dockerfile +14 -0
- data/FIRST_TIMERS.md +79 -0
- data/Gemfile +0 -1
- data/ISSUE_TEMPLATE.md +30 -0
- data/LICENSE +21 -0
- data/Makefile +15 -0
- data/PULL_REQUEST_TEMPLATE.md +31 -0
- data/README.md +28 -37
- data/Rakefile +2 -3
- data/TROUBLESHOOTING.md +9 -7
- data/USAGE.md +146 -39
- data/examples/accesssettings/accesssettings.rb +9 -12
- data/examples/alerts/alerts.rb +8 -11
- data/examples/apikeys/apikeys.rb +12 -15
- data/examples/asm/asm.rb +27 -30
- data/examples/browsers/browsers.rb +0 -3
- data/examples/campaigns/campaigns.rb +29 -32
- data/examples/categories/categories.rb +0 -3
- data/examples/clients/clients.rb +1 -4
- data/examples/contactdb/contactdb.rb +63 -66
- data/examples/devices/devices.rb +0 -3
- data/examples/emailactivity/emailactivity.rb +52 -0
- data/examples/geo/geo.rb +0 -3
- data/examples/helpers/eventwebhook/example.rb +16 -0
- data/examples/helpers/mail/example.rb +19 -13
- data/examples/helpers/settings/example.rb +1 -1
- data/examples/helpers/stats/example.rb +4 -4
- data/examples/ips/ips.rb +19 -22
- data/examples/mail/mail.rb +72 -75
- data/examples/mailboxproviders/mailboxproviders.rb +0 -3
- data/examples/mailsettings/mailsettings.rb +21 -24
- data/examples/partnersettings/partnersettings.rb +3 -6
- data/examples/scopes/scopes.rb +8 -10
- data/examples/senderauthentication/senderauthentication.rb +41 -44
- data/examples/senders/senders.rb +28 -31
- data/examples/stats/stats.rb +0 -3
- data/examples/subusers/subusers.rb +17 -20
- data/examples/suppression/suppression.rb +15 -18
- data/examples/templates/templates.rb +29 -31
- data/examples/trackingsettings/trackingsettings.rb +14 -17
- data/examples/user/user.rb +41 -44
- data/lib/rack/sendgrid_webhook_verification.rb +55 -0
- data/lib/sendgrid-ruby.rb +5 -1
- data/lib/sendgrid/base_interface.rb +40 -0
- data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +50 -0
- data/lib/sendgrid/helpers/inbound/README.md +5 -5
- data/lib/sendgrid/helpers/inbound/app.rb +2 -2
- data/lib/sendgrid/helpers/inbound/public/index.html +1 -1
- data/lib/sendgrid/helpers/inbound/send.rb +3 -3
- data/lib/sendgrid/helpers/ip_management/ip_management.rb +1 -1
- data/lib/sendgrid/helpers/mail/README.md +3 -3
- data/lib/sendgrid/helpers/mail/asm.rb +4 -18
- data/lib/sendgrid/helpers/mail/attachment.rb +12 -43
- data/lib/sendgrid/helpers/mail/bcc_settings.rb +4 -18
- data/lib/sendgrid/helpers/mail/bypass_list_management.rb +6 -18
- data/lib/sendgrid/helpers/mail/category.rb +2 -4
- data/lib/sendgrid/helpers/mail/click_tracking.rb +4 -18
- data/lib/sendgrid/helpers/mail/content.rb +2 -3
- data/lib/sendgrid/helpers/mail/custom_arg.rb +4 -10
- data/lib/sendgrid/helpers/mail/email.rb +8 -5
- data/lib/sendgrid/helpers/mail/footer.rb +5 -27
- data/lib/sendgrid/helpers/mail/ganalytics.rb +9 -55
- data/lib/sendgrid/helpers/mail/header.rb +4 -10
- data/lib/sendgrid/helpers/mail/mail.rb +30 -48
- data/lib/sendgrid/helpers/mail/mail_settings.rb +7 -25
- data/lib/sendgrid/helpers/mail/open_tracking.rb +4 -18
- data/lib/sendgrid/helpers/mail/personalization.rb +32 -27
- data/lib/sendgrid/helpers/mail/section.rb +4 -10
- data/lib/sendgrid/helpers/mail/spam_check.rb +5 -27
- data/lib/sendgrid/helpers/mail/subscription_tracking.rb +6 -36
- data/lib/sendgrid/helpers/mail/substitution.rb +4 -10
- data/lib/sendgrid/helpers/mail/tracking_settings.rb +6 -20
- data/lib/sendgrid/helpers/permissions/scope.rb +2 -2
- data/lib/sendgrid/helpers/settings/README.md +2 -2
- data/lib/sendgrid/helpers/settings/settings.rb +1 -1
- data/lib/sendgrid/helpers/settings/tracking_settings_dto.rb +3 -5
- data/lib/sendgrid/helpers/stats/metrics.rb +5 -7
- data/lib/sendgrid/helpers/stats/stats_response.rb +0 -2
- data/lib/sendgrid/sendgrid.rb +21 -0
- data/lib/sendgrid/twilio_email.rb +21 -0
- data/lib/sendgrid/version.rb +1 -1
- data/mail_helper_v3.md +12 -12
- data/sendgrid-ruby.gemspec +11 -10
- data/spec/fixtures/event_webhook.rb +22 -0
- data/spec/rack/sendgrid_webhook_verification_spec.rb +142 -0
- data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +105 -0
- data/spec/sendgrid/helpers/settings/mail_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/settings/partner_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/settings/settings_spec.rb +2 -2
- data/spec/sendgrid/helpers/settings/tracking_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/settings/user_settings_dto_spec.rb +1 -1
- data/spec/sendgrid/helpers/stats/email_stats_spec.rb +22 -23
- data/spec/sendgrid/helpers/stats/metrics_spec.rb +19 -20
- data/spec/sendgrid/helpers/stats/stats_response_spec.rb +22 -23
- data/spec/sendgrid/sendgrid_spec.rb +11 -0
- data/spec/sendgrid/twilio_email_spec.rb +11 -0
- data/spec/spec_helper.rb +3 -1
- data/static/img/github-fork.png +0 -0
- data/static/img/github-sign-up.png +0 -0
- data/test/sendgrid/helpers/mail/test_attachment.rb +4 -6
- data/test/sendgrid/helpers/mail/test_category.rb +0 -2
- data/test/sendgrid/helpers/mail/test_email.rb +17 -10
- data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
- data/test/sendgrid/helpers/mail/test_personalizations.rb +133 -93
- data/test/sendgrid/permissions/test_scopes.rb +1 -3
- data/test/sendgrid/test_sendgrid-ruby.rb +1967 -1985
- data/twilio_sendgrid_logo.png +0 -0
- data/use-cases/README.md +16 -0
- data/use-cases/domain-authentication.md +5 -0
- data/use-cases/email-statistics.md +52 -0
- data/use-cases/legacy-templates.md +98 -0
- data/use-cases/sms.md +39 -0
- data/use-cases/transactional-templates.md +111 -0
- data/use-cases/twilio-email.md +13 -0
- data/use-cases/twilio-setup.md +54 -0
- metadata +88 -34
- data/.github/ISSUE_TEMPLATE +0 -17
- data/.github/PULL_REQUEST_TEMPLATE +0 -26
- data/LICENSE.txt +0 -22
- data/USE_CASES.md +0 -377
- data/docker/Dockerfile +0 -12
- data/docker/README.md +0 -30
- data/lib/sendgrid/client.rb +0 -38
- data/test/prism.sh +0 -42
@@ -17,7 +17,7 @@
|
|
17
17
|
# Installation
|
18
18
|
|
19
19
|
In addition to the installation instructions in
|
20
|
-
[the main readme](
|
20
|
+
[the main readme](../../../../README.md#installation),
|
21
21
|
you must also add sinatra to your Gemfile:
|
22
22
|
|
23
23
|
```
|
@@ -47,7 +47,7 @@ bundle install
|
|
47
47
|
ruby ./lib/sendgrid/helpers/inbound/send.rb ./lib/sendgrid/helpers/inbound/sample_data/default_data.txt
|
48
48
|
```
|
49
49
|
|
50
|
-
More sample data can be found [here](
|
50
|
+
More sample data can be found [here](sample_data).
|
51
51
|
|
52
52
|
View the results in the first terminal.
|
53
53
|
|
@@ -82,11 +82,11 @@ Next, send an email to [anything]@inbound.yourdomain.com, then look at the termi
|
|
82
82
|
|
83
83
|
## app.rb
|
84
84
|
|
85
|
-
This module runs a [Sinatra](http://www.sinatrarb.com/) server, that by default (you can change those settings [here](
|
85
|
+
This module runs a [Sinatra](http://www.sinatrarb.com/) server, that by default (you can change those settings [here](config.yml)), listens for POSTs on http://localhost:9292. When the server receives the POST, it parses and prints the key/value data.
|
86
86
|
|
87
87
|
## config.yml
|
88
88
|
|
89
|
-
This module loads application environment variables (located in [config.yml](
|
89
|
+
This module loads application environment variables (located in [config.yml](config.yml)).
|
90
90
|
|
91
91
|
## send.rb & /sample_data
|
92
92
|
|
@@ -95,4 +95,4 @@ This module is used to send sample test data. It is useful for testing and devel
|
|
95
95
|
<a name="contributing"></a>
|
96
96
|
# Contributing
|
97
97
|
|
98
|
-
If you would like to contribute to this project, please see our [contributing guide](
|
98
|
+
If you would like to contribute to this project, please see our [contributing guide](../../../../CONTRIBUTING.md). Thanks!
|
@@ -18,7 +18,7 @@ require 'yaml'
|
|
18
18
|
class Main < Sinatra::Base
|
19
19
|
configure :production, :development do
|
20
20
|
enable :logging
|
21
|
-
set :config, YAML.load_file(File.dirname(__FILE__)
|
21
|
+
set :config, YAML.load_file("#{File.dirname(__FILE__)}/config.yml")
|
22
22
|
end
|
23
23
|
|
24
24
|
get '/' do
|
@@ -26,7 +26,7 @@ class Main < Sinatra::Base
|
|
26
26
|
end
|
27
27
|
|
28
28
|
post settings.config['endpoint'] do
|
29
|
-
filtered = params.select {|k,
|
29
|
+
filtered = params.select { |k, _v| settings.config['keys'].include?(k) }
|
30
30
|
logger.info JSON.pretty_generate(filtered)
|
31
31
|
end
|
32
32
|
end
|
@@ -5,6 +5,6 @@
|
|
5
5
|
<body>
|
6
6
|
<h1>You have successfuly launched the server!</h1>
|
7
7
|
|
8
|
-
Check out <a href="https://github.com/sendgrid/sendgrid-ruby/tree/
|
8
|
+
Check out <a href="https://github.com/sendgrid/sendgrid-ruby/tree/HEAD/sendgrid/helpers/inbound">the documentation</a> on how to use this software to utilize the SendGrid Inbound Parse webhook.
|
9
9
|
</body>
|
10
10
|
</html>
|
@@ -4,11 +4,11 @@ require 'ruby_http_client'
|
|
4
4
|
require 'yaml'
|
5
5
|
require 'optparse'
|
6
6
|
|
7
|
-
OPTS = {}
|
7
|
+
OPTS = {}.freeze
|
8
8
|
opt = OptionParser.new
|
9
|
-
opt.on('--host=HOST') {|v| OPTS[:host] = v}
|
9
|
+
opt.on('--host=HOST') { |v| OPTS[:host] = v }
|
10
10
|
argv = opt.parse!(ARGV)
|
11
|
-
config = YAML.load_file(File.dirname(__FILE__)
|
11
|
+
config = YAML.load_file("#{File.dirname(__FILE__)}/config.yml")
|
12
12
|
host = OPTS[:host] || config['host']
|
13
13
|
client = SendGrid::Client.new(host: host)
|
14
14
|
File.open(argv[0]) do |file|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Quick Start
|
4
4
|
|
5
|
-
Run the [example](
|
5
|
+
Run the [example](../../../../examples/helpers/mail) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
|
6
6
|
|
7
7
|
```bash
|
8
8
|
ruby examples/helpers/mail/example.rb
|
@@ -10,5 +10,5 @@ ruby examples/helpers/mail/example.rb
|
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
-
- See the [example](
|
14
|
-
- [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/
|
13
|
+
- See the [example](../../../../examples/helpers/mail) for a complete working example.
|
14
|
+
- [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html)
|
@@ -2,31 +2,17 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class ASM
|
5
|
+
attr_accessor :group_id, :groups_to_display
|
6
|
+
|
5
7
|
def initialize(group_id: nil, groups_to_display: nil)
|
6
8
|
@group_id = group_id
|
7
9
|
@groups_to_display = groups_to_display
|
8
10
|
end
|
9
11
|
|
10
|
-
def group_id=(group_id)
|
11
|
-
@group_id = group_id
|
12
|
-
end
|
13
|
-
|
14
|
-
def group_id
|
15
|
-
@group_id
|
16
|
-
end
|
17
|
-
|
18
|
-
def groups_to_display=(groups_to_display)
|
19
|
-
@groups_to_display = groups_to_display
|
20
|
-
end
|
21
|
-
|
22
|
-
def groups_to_display
|
23
|
-
@groups_to_display
|
24
|
-
end
|
25
|
-
|
26
12
|
def to_json(*)
|
27
13
|
{
|
28
|
-
'group_id' =>
|
29
|
-
'groups_to_display' =>
|
14
|
+
'group_id' => group_id,
|
15
|
+
'groups_to_display' => groups_to_display
|
30
16
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
31
17
|
end
|
32
18
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
require 'json'
|
2
1
|
require 'base64'
|
3
2
|
|
4
3
|
module SendGrid
|
5
4
|
class Attachment
|
5
|
+
attr_accessor :type, :filename, :disposition, :content_id
|
6
|
+
|
6
7
|
def initialize
|
7
8
|
@content = nil
|
8
9
|
@type = nil
|
@@ -19,52 +20,20 @@ module SendGrid
|
|
19
20
|
def content
|
20
21
|
return @encoded_content if @encoded_content
|
21
22
|
|
22
|
-
if @content.respond_to?(:read)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def type=(type)
|
30
|
-
@type = type
|
31
|
-
end
|
32
|
-
|
33
|
-
def type
|
34
|
-
@type
|
35
|
-
end
|
36
|
-
|
37
|
-
def filename=(filename)
|
38
|
-
@filename = filename
|
39
|
-
end
|
40
|
-
|
41
|
-
def filename
|
42
|
-
@filename
|
43
|
-
end
|
44
|
-
|
45
|
-
def disposition=(disposition)
|
46
|
-
@disposition = disposition
|
47
|
-
end
|
48
|
-
|
49
|
-
def disposition
|
50
|
-
@disposition
|
51
|
-
end
|
52
|
-
|
53
|
-
def content_id=(content_id)
|
54
|
-
@content_id = content_id
|
55
|
-
end
|
56
|
-
|
57
|
-
def content_id
|
58
|
-
@content_id
|
23
|
+
@encoded_content = if @content.respond_to?(:read)
|
24
|
+
encode @content
|
25
|
+
else
|
26
|
+
@content
|
27
|
+
end
|
59
28
|
end
|
60
29
|
|
61
30
|
def to_json(*)
|
62
31
|
{
|
63
|
-
'content' =>
|
64
|
-
'type' =>
|
65
|
-
'filename' =>
|
66
|
-
'disposition' =>
|
67
|
-
'content_id' =>
|
32
|
+
'content' => content,
|
33
|
+
'type' => type,
|
34
|
+
'filename' => filename,
|
35
|
+
'disposition' => disposition,
|
36
|
+
'content_id' => content_id
|
68
37
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
69
38
|
end
|
70
39
|
|
@@ -2,31 +2,17 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class BccSettings
|
5
|
+
attr_accessor :enable, :email
|
6
|
+
|
5
7
|
def initialize(enable: nil, email: nil)
|
6
8
|
@enable = enable
|
7
9
|
@email = email
|
8
10
|
end
|
9
11
|
|
10
|
-
def enable=(enable)
|
11
|
-
@enable = enable
|
12
|
-
end
|
13
|
-
|
14
|
-
def enable
|
15
|
-
@enable
|
16
|
-
end
|
17
|
-
|
18
|
-
def email=(email)
|
19
|
-
@email = email
|
20
|
-
end
|
21
|
-
|
22
|
-
def email
|
23
|
-
@email
|
24
|
-
end
|
25
|
-
|
26
12
|
def to_json(*)
|
27
13
|
{
|
28
|
-
'enable' =>
|
29
|
-
'email' =>
|
14
|
+
'enable' => enable,
|
15
|
+
'email' => email
|
30
16
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
31
17
|
end
|
32
18
|
end
|
@@ -2,41 +2,29 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class BypassListManagement
|
5
|
-
|
6
|
-
@enable = enable
|
7
|
-
end
|
5
|
+
attr_accessor :enable
|
8
6
|
|
9
|
-
def
|
7
|
+
def initialize(enable: nil)
|
10
8
|
@enable = enable
|
11
9
|
end
|
12
10
|
|
13
|
-
def enable
|
14
|
-
@enable
|
15
|
-
end
|
16
|
-
|
17
11
|
def to_json(*)
|
18
12
|
{
|
19
|
-
'enable' =>
|
13
|
+
'enable' => enable
|
20
14
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
21
15
|
end
|
22
16
|
end
|
23
17
|
|
24
18
|
class SandBoxMode
|
25
|
-
|
26
|
-
@enable = enable
|
27
|
-
end
|
19
|
+
attr_accessor :enable
|
28
20
|
|
29
|
-
def
|
21
|
+
def initialize(enable: nil)
|
30
22
|
@enable = enable
|
31
23
|
end
|
32
24
|
|
33
|
-
def enable
|
34
|
-
@enable
|
35
|
-
end
|
36
|
-
|
37
25
|
def to_json(*)
|
38
26
|
{
|
39
|
-
'enable' =>
|
27
|
+
'enable' => enable
|
40
28
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
41
29
|
end
|
42
30
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
1
|
module SendGrid
|
4
2
|
class Category
|
5
3
|
attr_accessor :name
|
@@ -14,7 +12,7 @@ module SendGrid
|
|
14
12
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
15
13
|
end
|
16
14
|
|
17
|
-
alias
|
18
|
-
alias
|
15
|
+
alias category name
|
16
|
+
alias category= name=
|
19
17
|
end
|
20
18
|
end
|
@@ -2,31 +2,17 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class ClickTracking
|
5
|
+
attr_accessor :enable, :enable_text
|
6
|
+
|
5
7
|
def initialize(enable: nil, enable_text: nil)
|
6
8
|
@enable = enable
|
7
9
|
@enable_text = enable_text
|
8
10
|
end
|
9
11
|
|
10
|
-
def enable=(enable)
|
11
|
-
@enable = enable
|
12
|
-
end
|
13
|
-
|
14
|
-
def enable
|
15
|
-
@enable
|
16
|
-
end
|
17
|
-
|
18
|
-
def enable_text=(enable_text)
|
19
|
-
@enable_text = enable_text
|
20
|
-
end
|
21
|
-
|
22
|
-
def enable_text
|
23
|
-
@enable_text
|
24
|
-
end
|
25
|
-
|
26
12
|
def to_json(*)
|
27
13
|
{
|
28
|
-
'enable' =>
|
29
|
-
'enable_text' =>
|
14
|
+
'enable' => enable,
|
15
|
+
'enable_text' => enable_text
|
30
16
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
31
17
|
end
|
32
18
|
end
|
@@ -2,7 +2,6 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class Content
|
5
|
-
|
6
5
|
attr_accessor :type, :value
|
7
6
|
|
8
7
|
def initialize(type: nil, value: nil)
|
@@ -12,8 +11,8 @@ module SendGrid
|
|
12
11
|
|
13
12
|
def to_json(*)
|
14
13
|
{
|
15
|
-
'type' =>
|
16
|
-
'value' =>
|
14
|
+
'type' => type,
|
15
|
+
'value' => value
|
17
16
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
18
17
|
end
|
19
18
|
end
|
@@ -2,22 +2,16 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class CustomArg
|
5
|
+
attr_accessor :custom_arg
|
6
|
+
|
5
7
|
def initialize(key: nil, value: nil)
|
6
8
|
@custom_arg = {}
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def custom_arg=(custom_arg)
|
11
|
-
@custom_arg = custom_arg
|
12
|
-
end
|
13
|
-
|
14
|
-
def custom_arg
|
15
|
-
@custom_arg
|
9
|
+
key.nil? || value.nil? ? @custom_arg = nil : @custom_arg[key.to_s] = value.to_s
|
16
10
|
end
|
17
11
|
|
18
12
|
def to_json(*)
|
19
13
|
{
|
20
|
-
'custom_arg' =>
|
14
|
+
'custom_arg' => custom_arg
|
21
15
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
22
16
|
end
|
23
17
|
end
|
@@ -2,10 +2,11 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class Email
|
5
|
-
|
6
5
|
attr_accessor :email, :name
|
7
6
|
|
8
|
-
|
7
|
+
# @param [String] email required e-mail address
|
8
|
+
# @param [String] name optionally personification
|
9
|
+
def initialize(email:, name: nil)
|
9
10
|
if name
|
10
11
|
@email = email
|
11
12
|
@name = name
|
@@ -16,13 +17,15 @@ module SendGrid
|
|
16
17
|
|
17
18
|
def split_email(email)
|
18
19
|
split = /(?:(?<address>.+)\s)?<?(?<email>.+@[^>]+)>?/.match(email)
|
19
|
-
|
20
|
+
raise ArgumentError, "email (#{email}) is invalid" unless split
|
21
|
+
|
22
|
+
[split[:email], split[:address]]
|
20
23
|
end
|
21
24
|
|
22
25
|
def to_json(*)
|
23
26
|
{
|
24
|
-
'email' =>
|
25
|
-
'name' =>
|
27
|
+
'email' => email,
|
28
|
+
'name' => name
|
26
29
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
27
30
|
end
|
28
31
|
end
|
@@ -2,41 +2,19 @@ require 'json'
|
|
2
2
|
|
3
3
|
module SendGrid
|
4
4
|
class Footer
|
5
|
-
|
6
|
-
@enable = enable
|
7
|
-
@text = text
|
8
|
-
@html = html
|
9
|
-
end
|
5
|
+
attr_accessor :enable, :text, :html
|
10
6
|
|
11
|
-
def
|
7
|
+
def initialize(enable: nil, text: nil, html: nil)
|
12
8
|
@enable = enable
|
13
|
-
end
|
14
|
-
|
15
|
-
def enable
|
16
|
-
@enable
|
17
|
-
end
|
18
|
-
|
19
|
-
def text=(text)
|
20
9
|
@text = text
|
21
|
-
end
|
22
|
-
|
23
|
-
def text
|
24
|
-
@text
|
25
|
-
end
|
26
|
-
|
27
|
-
def html=(html)
|
28
10
|
@html = html
|
29
11
|
end
|
30
12
|
|
31
|
-
def html
|
32
|
-
@html
|
33
|
-
end
|
34
|
-
|
35
13
|
def to_json(*)
|
36
14
|
{
|
37
|
-
'enable' =>
|
38
|
-
'text' =>
|
39
|
-
'html' =>
|
15
|
+
'enable' => enable,
|
16
|
+
'text' => text,
|
17
|
+
'html' => html
|
40
18
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
41
19
|
end
|
42
20
|
end
|