sendgrid-ruby 6.3.3 → 6.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -5
- data/.rubocop_todo.yml +109 -0
- data/.travis.yml +2 -3
- data/CHANGELOG.md +54 -9
- data/CONTRIBUTING.md +8 -11
- data/FIRST_TIMERS.md +79 -0
- data/ISSUE_TEMPLATE.md +5 -1
- data/{LICENSE.md → LICENSE} +0 -0
- data/Makefile +2 -1
- data/PULL_REQUEST_TEMPLATE.md +5 -5
- data/README.md +24 -28
- data/Rakefile +2 -3
- data/TROUBLESHOOTING.md +5 -5
- 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 +4 -4
- 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 +5 -2
- data/lib/sendgrid/base_interface.rb +2 -1
- data/lib/sendgrid/helpers/eventwebhook/eventwebhook.rb +4 -6
- 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 +6 -18
- data/lib/sendgrid/helpers/mail/attachment.rb +12 -42
- data/lib/sendgrid/helpers/mail/bcc_settings.rb +6 -18
- data/lib/sendgrid/helpers/mail/bypass_list_management.rb +8 -18
- data/lib/sendgrid/helpers/mail/category.rb +2 -2
- data/lib/sendgrid/helpers/mail/click_tracking.rb +6 -18
- data/lib/sendgrid/helpers/mail/content.rb +4 -3
- data/lib/sendgrid/helpers/mail/custom_arg.rb +6 -10
- data/lib/sendgrid/helpers/mail/email.rb +5 -4
- data/lib/sendgrid/helpers/mail/footer.rb +7 -27
- data/lib/sendgrid/helpers/mail/ganalytics.rb +10 -54
- data/lib/sendgrid/helpers/mail/header.rb +6 -10
- data/lib/sendgrid/helpers/mail/mail.rb +32 -48
- data/lib/sendgrid/helpers/mail/mail_settings.rb +9 -25
- data/lib/sendgrid/helpers/mail/open_tracking.rb +6 -18
- data/lib/sendgrid/helpers/mail/personalization.rb +34 -27
- data/lib/sendgrid/helpers/mail/section.rb +6 -10
- data/lib/sendgrid/helpers/mail/spam_check.rb +7 -27
- data/lib/sendgrid/helpers/mail/subscription_tracking.rb +8 -36
- data/lib/sendgrid/helpers/mail/substitution.rb +6 -10
- data/lib/sendgrid/helpers/mail/tracking_settings.rb +8 -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 -5
- data/lib/sendgrid/sendgrid.rb +1 -1
- data/lib/sendgrid/twilio_email.rb +1 -1
- data/lib/sendgrid/version.rb +1 -1
- data/mail_helper_v3.md +12 -12
- data/sendgrid-ruby.gemspec +8 -9
- data/spec/fixtures/event_webhook.rb +17 -11
- data/spec/rack/sendgrid_webhook_verification_spec.rb +30 -4
- data/spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb +38 -36
- 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/spec_helper.rb +1 -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 +9 -11
- data/test/sendgrid/helpers/mail/test_mail.rb +101 -102
- data/test/sendgrid/helpers/mail/test_personalizations.rb +106 -93
- data/test/sendgrid/permissions/test_scopes.rb +1 -3
- data/test/sendgrid/test_sendgrid-ruby.rb +1947 -1948
- data/twilio_sendgrid_logo.png +0 -0
- data/use-cases/domain-authentication.md +1 -1
- data/use-cases/email-statistics.md +1 -1
- data/use-cases/legacy-templates.md +1 -1
- data/use-cases/transactional-templates.md +1 -1
- metadata +42 -36
|
@@ -1,21 +1,17 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
1
3
|
module SendGrid
|
|
2
4
|
class Header
|
|
5
|
+
attr_accessor :header
|
|
6
|
+
|
|
3
7
|
def initialize(key: nil, value: nil)
|
|
4
8
|
@header = {}
|
|
5
|
-
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def header=(header)
|
|
9
|
-
@header = header
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def header
|
|
13
|
-
@header
|
|
9
|
+
key.nil? || value.nil? ? @header = nil : @header[key] = value
|
|
14
10
|
end
|
|
15
11
|
|
|
16
12
|
def to_json(*)
|
|
17
13
|
{
|
|
18
|
-
'header' =>
|
|
14
|
+
'header' => header
|
|
19
15
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
|
20
16
|
end
|
|
21
17
|
end
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
# Build the request body for the v3/mail/send endpoint
|
|
2
2
|
# Please see the examples/helpers/mail/example.rb for a demonstration of usage
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
3
5
|
module SendGrid
|
|
4
6
|
class Mail
|
|
5
|
-
|
|
6
7
|
attr_accessor :subject, :ip_pool_name, :template_id, :send_at, :batch_id
|
|
7
8
|
attr_reader :personalizations, :contents, :attachments, :categories, :sections, :headers, :custom_args
|
|
9
|
+
attr_writer :from, :asm, :mail_settings, :tracking_settings, :reply_to
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
# We allow for all nil values here to create uninitialized Mail objects
|
|
12
|
+
# (e.g. <project-root>/use-cases/transactional-templates.md)
|
|
13
|
+
def initialize(from_email = nil, subj = nil, to_email = nil, cont = nil) # rubocop:disable Metrics/ParameterLists
|
|
10
14
|
@from = nil
|
|
11
15
|
@subject = nil
|
|
12
16
|
@personalizations = []
|
|
@@ -25,18 +29,14 @@ module SendGrid
|
|
|
25
29
|
@tracking_settings = nil
|
|
26
30
|
@reply_to = nil
|
|
27
31
|
|
|
28
|
-
if
|
|
29
|
-
self.from = from_email
|
|
30
|
-
self.subject = subj
|
|
31
|
-
personalization = Personalization.new
|
|
32
|
-
personalization.add_to(to_email)
|
|
33
|
-
self.add_personalization(personalization)
|
|
34
|
-
self.add_content(cont)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
32
|
+
return if from_email.nil? && subj.nil? && to_email.nil? && cont.nil?
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
self.from = from_email
|
|
35
|
+
self.subject = subj
|
|
36
|
+
personalization = Personalization.new
|
|
37
|
+
personalization.add_to(to_email)
|
|
38
|
+
add_personalization(personalization)
|
|
39
|
+
add_content(cont)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def from
|
|
@@ -54,7 +54,7 @@ module SendGrid
|
|
|
54
54
|
def check_for_secrets(patterns)
|
|
55
55
|
contents = @contents.map { |content| content['value'] }.join(' ')
|
|
56
56
|
patterns.each do |pattern|
|
|
57
|
-
raise SecurityError
|
|
57
|
+
raise SecurityError, 'Content contains sensitive information.' if contents.match(pattern)
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -81,58 +81,42 @@ module SendGrid
|
|
|
81
81
|
@custom_args = @custom_args.merge(custom_arg['custom_arg'])
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
def asm=(asm)
|
|
85
|
-
@asm = asm
|
|
86
|
-
end
|
|
87
|
-
|
|
88
84
|
def asm
|
|
89
85
|
@asm.nil? ? nil : @asm.to_json
|
|
90
86
|
end
|
|
91
87
|
|
|
92
|
-
def mail_settings=(mail_settings)
|
|
93
|
-
@mail_settings = mail_settings
|
|
94
|
-
end
|
|
95
|
-
|
|
96
88
|
def mail_settings
|
|
97
89
|
@mail_settings.nil? ? nil : @mail_settings.to_json
|
|
98
90
|
end
|
|
99
91
|
|
|
100
|
-
def tracking_settings=(tracking_settings)
|
|
101
|
-
@tracking_settings = tracking_settings
|
|
102
|
-
end
|
|
103
|
-
|
|
104
92
|
def tracking_settings
|
|
105
93
|
@tracking_settings.nil? ? nil : @tracking_settings.to_json
|
|
106
94
|
end
|
|
107
95
|
|
|
108
|
-
def reply_to=(reply_to)
|
|
109
|
-
@reply_to = reply_to
|
|
110
|
-
end
|
|
111
|
-
|
|
112
96
|
def reply_to
|
|
113
97
|
@reply_to.nil? ? nil : @reply_to.to_json
|
|
114
98
|
end
|
|
115
99
|
|
|
116
100
|
def to_json(*)
|
|
117
101
|
{
|
|
118
|
-
'from' =>
|
|
119
|
-
'subject' =>
|
|
120
|
-
'personalizations' =>
|
|
121
|
-
'content' =>
|
|
122
|
-
'attachments' =>
|
|
123
|
-
'template_id' =>
|
|
124
|
-
'sections' =>
|
|
125
|
-
'headers' =>
|
|
126
|
-
'categories' =>
|
|
127
|
-
'custom_args' =>
|
|
128
|
-
'send_at' =>
|
|
129
|
-
'batch_id' =>
|
|
130
|
-
'asm' =>
|
|
131
|
-
'ip_pool_name' =>
|
|
132
|
-
'mail_settings' =>
|
|
133
|
-
'tracking_settings' =>
|
|
134
|
-
'reply_to' =>
|
|
135
|
-
}.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
|
|
102
|
+
'from' => from,
|
|
103
|
+
'subject' => subject,
|
|
104
|
+
'personalizations' => personalizations,
|
|
105
|
+
'content' => contents,
|
|
106
|
+
'attachments' => attachments,
|
|
107
|
+
'template_id' => template_id,
|
|
108
|
+
'sections' => sections,
|
|
109
|
+
'headers' => headers,
|
|
110
|
+
'categories' => categories,
|
|
111
|
+
'custom_args' => custom_args,
|
|
112
|
+
'send_at' => send_at,
|
|
113
|
+
'batch_id' => batch_id,
|
|
114
|
+
'asm' => asm,
|
|
115
|
+
'ip_pool_name' => ip_pool_name,
|
|
116
|
+
'mail_settings' => mail_settings,
|
|
117
|
+
'tracking_settings' => tracking_settings,
|
|
118
|
+
'reply_to' => reply_to
|
|
119
|
+
}.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} }
|
|
136
120
|
end
|
|
137
121
|
end
|
|
138
122
|
end
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
1
3
|
module SendGrid
|
|
2
4
|
class MailSettings
|
|
5
|
+
attr_writer :sandbox_mode, :footer, :bcc, :spam_check, :bypass_list_management
|
|
6
|
+
|
|
3
7
|
def initialize
|
|
4
8
|
@bcc = nil
|
|
5
9
|
@bypass_list_management = nil
|
|
@@ -8,53 +12,33 @@ module SendGrid
|
|
|
8
12
|
@spam_check = nil
|
|
9
13
|
end
|
|
10
14
|
|
|
11
|
-
def sandbox_mode=(sandbox_mode)
|
|
12
|
-
@sandbox_mode = sandbox_mode
|
|
13
|
-
end
|
|
14
|
-
|
|
15
15
|
def sandbox_mode
|
|
16
16
|
@sandbox_mode.nil? ? nil : @sandbox_mode.to_json
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def bypass_list_management=(bypass_list_management)
|
|
20
|
-
@bypass_list_management = bypass_list_management
|
|
21
|
-
end
|
|
22
|
-
|
|
23
19
|
def bypass_list_management
|
|
24
20
|
@bypass_list_management.nil? ? nil : @bypass_list_management.to_json
|
|
25
21
|
end
|
|
26
22
|
|
|
27
|
-
def footer=(footer)
|
|
28
|
-
@footer = footer
|
|
29
|
-
end
|
|
30
|
-
|
|
31
23
|
def footer
|
|
32
24
|
@footer.nil? ? nil : @footer.to_json
|
|
33
25
|
end
|
|
34
26
|
|
|
35
|
-
def bcc=(bcc)
|
|
36
|
-
@bcc = bcc
|
|
37
|
-
end
|
|
38
|
-
|
|
39
27
|
def bcc
|
|
40
28
|
@bcc.nil? ? nil : @bcc.to_json
|
|
41
29
|
end
|
|
42
30
|
|
|
43
|
-
def spam_check=(spam_check)
|
|
44
|
-
@spam_check = spam_check
|
|
45
|
-
end
|
|
46
|
-
|
|
47
31
|
def spam_check
|
|
48
32
|
@spam_check.nil? ? nil : @spam_check.to_json
|
|
49
33
|
end
|
|
50
34
|
|
|
51
35
|
def to_json(*)
|
|
52
36
|
{
|
|
53
|
-
'bcc' =>
|
|
54
|
-
'bypass_list_management' =>
|
|
55
|
-
'footer' =>
|
|
56
|
-
'sandbox_mode' =>
|
|
57
|
-
'spam_check' =>
|
|
37
|
+
'bcc' => bcc,
|
|
38
|
+
'bypass_list_management' => bypass_list_management,
|
|
39
|
+
'footer' => footer,
|
|
40
|
+
'sandbox_mode' => sandbox_mode,
|
|
41
|
+
'spam_check' => spam_check
|
|
58
42
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
|
59
43
|
end
|
|
60
44
|
end
|
|
@@ -1,30 +1,18 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
1
3
|
module SendGrid
|
|
2
4
|
class OpenTracking
|
|
3
|
-
|
|
4
|
-
@enable = enable
|
|
5
|
-
@substitution_tag = substitution_tag
|
|
6
|
-
end
|
|
5
|
+
attr_accessor :enable, :substitution_tag
|
|
7
6
|
|
|
8
|
-
def
|
|
7
|
+
def initialize(enable: nil, substitution_tag: nil)
|
|
9
8
|
@enable = enable
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def enable
|
|
13
|
-
@enable
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def substitution_tag=(substitution_tag)
|
|
17
9
|
@substitution_tag = substitution_tag
|
|
18
10
|
end
|
|
19
11
|
|
|
20
|
-
def substitution_tag
|
|
21
|
-
@substitution_tag
|
|
22
|
-
end
|
|
23
|
-
|
|
24
12
|
def to_json(*)
|
|
25
13
|
{
|
|
26
|
-
'enable' =>
|
|
27
|
-
'substitution_tag' =>
|
|
14
|
+
'enable' => enable,
|
|
15
|
+
'substitution_tag' => substitution_tag
|
|
28
16
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
|
29
17
|
end
|
|
30
18
|
end
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
1
3
|
module SendGrid
|
|
2
4
|
class Personalization
|
|
3
|
-
|
|
4
5
|
attr_reader :tos, :ccs, :bccs, :headers, :substitutions, :custom_args,
|
|
5
|
-
|
|
6
|
+
:dynamic_template_data
|
|
7
|
+
|
|
8
|
+
attr_accessor :send_at, :subject
|
|
6
9
|
|
|
7
10
|
def initialize
|
|
8
11
|
@tos = []
|
|
@@ -17,23 +20,21 @@ module SendGrid
|
|
|
17
20
|
end
|
|
18
21
|
|
|
19
22
|
def add_to(to)
|
|
23
|
+
raise DuplicatePersonalizationError if duplicate?(to)
|
|
24
|
+
|
|
20
25
|
@tos << to.to_json
|
|
21
26
|
end
|
|
22
27
|
|
|
23
28
|
def add_cc(cc)
|
|
29
|
+
raise DuplicatePersonalizationError if duplicate?(cc)
|
|
30
|
+
|
|
24
31
|
@ccs << cc.to_json
|
|
25
32
|
end
|
|
26
33
|
|
|
27
34
|
def add_bcc(bcc)
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def subject=(subject)
|
|
32
|
-
@subject = subject
|
|
33
|
-
end
|
|
35
|
+
raise DuplicatePersonalizationError if duplicate?(bcc)
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
@subject
|
|
37
|
+
@bccs << bcc.to_json
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def add_header(header)
|
|
@@ -55,26 +56,32 @@ module SendGrid
|
|
|
55
56
|
@dynamic_template_data.merge!(dynamic_template_data)
|
|
56
57
|
end
|
|
57
58
|
|
|
58
|
-
def
|
|
59
|
-
|
|
59
|
+
def to_json(*)
|
|
60
|
+
{
|
|
61
|
+
'to' => tos,
|
|
62
|
+
'cc' => ccs,
|
|
63
|
+
'bcc' => bccs,
|
|
64
|
+
'subject' => subject,
|
|
65
|
+
'headers' => headers,
|
|
66
|
+
'substitutions' => substitutions,
|
|
67
|
+
'custom_args' => custom_args,
|
|
68
|
+
'dynamic_template_data' => dynamic_template_data,
|
|
69
|
+
'send_at' => send_at
|
|
70
|
+
}.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} }
|
|
60
71
|
end
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
@send_at
|
|
64
|
-
end
|
|
73
|
+
private
|
|
65
74
|
|
|
66
|
-
def
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
'
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
'custom_args' => self.custom_args,
|
|
75
|
-
'dynamic_template_data' => self.dynamic_template_data,
|
|
76
|
-
'send_at' => self.send_at
|
|
77
|
-
}.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
|
|
75
|
+
def duplicate?(addition)
|
|
76
|
+
additional_email = addition.email.downcase
|
|
77
|
+
|
|
78
|
+
[@tos, @ccs, @bccs].flatten.each do |elm|
|
|
79
|
+
return true if elm&.dig('email') == additional_email
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
false
|
|
78
83
|
end
|
|
79
84
|
end
|
|
85
|
+
|
|
86
|
+
class DuplicatePersonalizationError < StandardError; end
|
|
80
87
|
end
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
1
3
|
module SendGrid
|
|
2
4
|
class Section
|
|
5
|
+
attr_accessor :section
|
|
6
|
+
|
|
3
7
|
def initialize(key: nil, value: nil)
|
|
4
8
|
@section = {}
|
|
5
|
-
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def section=(section)
|
|
9
|
-
@section = section
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def section
|
|
13
|
-
@section
|
|
9
|
+
key.nil? || value.nil? ? @section = nil : @section[key] = value
|
|
14
10
|
end
|
|
15
11
|
|
|
16
12
|
def to_json(*)
|
|
17
13
|
{
|
|
18
|
-
'section' =>
|
|
14
|
+
'section' => section
|
|
19
15
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
|
20
16
|
end
|
|
21
17
|
end
|
|
@@ -1,40 +1,20 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
1
3
|
module SendGrid
|
|
2
4
|
class SpamCheck
|
|
5
|
+
attr_accessor :enable, :threshold, :post_to_url
|
|
6
|
+
|
|
3
7
|
def initialize(enable: nil, threshold: nil, post_to_url: nil)
|
|
4
8
|
@enable = enable
|
|
5
9
|
@threshold = threshold
|
|
6
10
|
@post_to_url = post_to_url
|
|
7
11
|
end
|
|
8
12
|
|
|
9
|
-
def enable=(enable)
|
|
10
|
-
@enable = enable
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def enable
|
|
14
|
-
@enable
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def threshold=(threshold)
|
|
18
|
-
@threshold = threshold
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def threshold
|
|
22
|
-
@threshold
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def post_to_url=(post_to_url)
|
|
26
|
-
@post_to_url = post_to_url
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def post_to_url
|
|
30
|
-
@post_to_url
|
|
31
|
-
end
|
|
32
|
-
|
|
33
13
|
def to_json(*)
|
|
34
14
|
{
|
|
35
|
-
'enable' =>
|
|
36
|
-
'threshold' =>
|
|
37
|
-
'post_to_url' =>
|
|
15
|
+
'enable' => enable,
|
|
16
|
+
'threshold' => threshold,
|
|
17
|
+
'post_to_url' => post_to_url
|
|
38
18
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
|
39
19
|
end
|
|
40
20
|
end
|
|
@@ -1,50 +1,22 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
1
3
|
module SendGrid
|
|
2
4
|
class SubscriptionTracking
|
|
3
|
-
|
|
4
|
-
@enable = enable
|
|
5
|
-
@text = text
|
|
6
|
-
@html = html
|
|
7
|
-
@substitution_tag = substitution_tag
|
|
8
|
-
end
|
|
5
|
+
attr_accessor :enable, :text, :html, :substitution_tag
|
|
9
6
|
|
|
10
|
-
def
|
|
7
|
+
def initialize(enable: nil, text: nil, html: nil, substitution_tag: nil)
|
|
11
8
|
@enable = enable
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def enable
|
|
15
|
-
@enable
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def text=(text)
|
|
19
9
|
@text = text
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def text
|
|
23
|
-
@text
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def html=(html)
|
|
27
10
|
@html = html
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def html
|
|
31
|
-
@html
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def substitution_tag=(substitution_tag)
|
|
35
11
|
@substitution_tag = substitution_tag
|
|
36
12
|
end
|
|
37
13
|
|
|
38
|
-
def substitution_tag
|
|
39
|
-
@substitution_tag
|
|
40
|
-
end
|
|
41
|
-
|
|
42
14
|
def to_json(*)
|
|
43
15
|
{
|
|
44
|
-
'enable' =>
|
|
45
|
-
'text' =>
|
|
46
|
-
'html' =>
|
|
47
|
-
'substitution_tag' =>
|
|
16
|
+
'enable' => enable,
|
|
17
|
+
'text' => text,
|
|
18
|
+
'html' => html,
|
|
19
|
+
'substitution_tag' => substitution_tag
|
|
48
20
|
}.delete_if { |_, value| value.to_s.strip == '' }
|
|
49
21
|
end
|
|
50
22
|
end
|