sendgrid4r 0.4.0 → 0.5.0
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/lib/sendgrid4r/rest/api.rb +8 -0
- data/lib/sendgrid4r/rest/settings/enforced_tls.rb +1 -1
- data/lib/sendgrid4r/rest/settings/mail.rb +231 -0
- data/lib/sendgrid4r/rest/settings/partner.rb +62 -0
- data/lib/sendgrid4r/rest/settings/settings.rb +32 -0
- data/lib/sendgrid4r/rest/settings/tracking.rb +123 -0
- data/lib/sendgrid4r/version.rb +1 -1
- data/spec/client_spec.rb +1 -1
- data/spec/rest/email_activity/email_activity_spec.rb +2 -2
- data/spec/rest/settings/enforced_tls_spec.rb +3 -3
- data/spec/rest/settings/mail_spec.rb +869 -0
- data/spec/rest/settings/partner_spec.rb +197 -0
- data/spec/rest/settings/settings_spec.rb +53 -0
- data/spec/rest/settings/tracking_spec.rb +410 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 564f7a655ea8602232bee0429bb54c57b9ddbc75
|
4
|
+
data.tar.gz: 6ff6101f1f35683236bd613632ad0c0733dc725a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca1835713c3a05441b889827e5bc7bf9f1467369bed32fffd596d273f4a064cb583d99cb573dffbc7ac2d526cbc2473b63be6ab430db428b1781119b457e03a8
|
7
|
+
data.tar.gz: 7b7537d0800a842fb0b2ca1a1eb7eb11e7fd3c91b1ae883f4226f762b55e643f079e98c52a4d9e83054bdf22b84c95de9dfc9d275a7d5c3899c355970779a3bc
|
data/lib/sendgrid4r/rest/api.rb
CHANGED
@@ -7,7 +7,11 @@ require 'sendgrid4r/rest/asm/asm'
|
|
7
7
|
require 'sendgrid4r/rest/asm/groups'
|
8
8
|
require 'sendgrid4r/rest/asm/suppressions'
|
9
9
|
require 'sendgrid4r/rest/asm/global_suppressions'
|
10
|
+
require 'sendgrid4r/rest/settings/settings'
|
10
11
|
require 'sendgrid4r/rest/settings/enforced_tls'
|
12
|
+
require 'sendgrid4r/rest/settings/mail'
|
13
|
+
require 'sendgrid4r/rest/settings/partner'
|
14
|
+
require 'sendgrid4r/rest/settings/tracking'
|
11
15
|
require 'sendgrid4r/rest/ips/addresses'
|
12
16
|
require 'sendgrid4r/rest/ips/pools'
|
13
17
|
require 'sendgrid4r/rest/ips/warmup'
|
@@ -39,7 +43,11 @@ module SendGrid4r
|
|
39
43
|
include SendGrid4r::REST::Asm::Groups
|
40
44
|
include SendGrid4r::REST::Asm::Suppressions
|
41
45
|
include SendGrid4r::REST::Asm::GlobalSuppressions
|
46
|
+
include SendGrid4r::REST::Settings
|
42
47
|
include SendGrid4r::REST::Settings::EnforcedTls
|
48
|
+
include SendGrid4r::REST::Settings::Mail
|
49
|
+
include SendGrid4r::REST::Settings::Partner
|
50
|
+
include SendGrid4r::REST::Settings::Tracking
|
43
51
|
include SendGrid4r::REST::Ips::Addresses
|
44
52
|
include SendGrid4r::REST::Ips::Warmup
|
45
53
|
include SendGrid4r::REST::Ips::Pools
|
@@ -28,7 +28,7 @@ module SendGrid4r
|
|
28
28
|
SendGrid4r::REST::Settings::EnforcedTls.create_enforced_tls(resp)
|
29
29
|
end
|
30
30
|
|
31
|
-
def patch_enforced_tls(params
|
31
|
+
def patch_enforced_tls(params:, &block)
|
32
32
|
endpoint = SendGrid4r::REST::Settings::EnforcedTls.url
|
33
33
|
resp = patch(@auth, endpoint, params.to_h, &block)
|
34
34
|
SendGrid4r::REST::Settings::EnforcedTls.create_enforced_tls(resp)
|
@@ -0,0 +1,231 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'sendgrid4r/rest/request'
|
5
|
+
|
6
|
+
module SendGrid4r
|
7
|
+
module REST
|
8
|
+
module Settings
|
9
|
+
#
|
10
|
+
# SendGrid Web API v3 Settings - Mail
|
11
|
+
#
|
12
|
+
module Mail
|
13
|
+
include SendGrid4r::REST::Request
|
14
|
+
|
15
|
+
AddressWhitelist = Struct.new(:enabled, :list)
|
16
|
+
|
17
|
+
def self.create_address_whitelist(resp)
|
18
|
+
return resp if resp.nil?
|
19
|
+
list = []
|
20
|
+
resp['list'].each do |address|
|
21
|
+
list.push(address)
|
22
|
+
end
|
23
|
+
AddressWhitelist.new(resp['enabled'], list)
|
24
|
+
end
|
25
|
+
|
26
|
+
Bcc = Struct.new(:enabled, :email)
|
27
|
+
|
28
|
+
def self.create_bcc(resp)
|
29
|
+
return resp if resp.nil?
|
30
|
+
Bcc.new(resp['enabled'], resp['email'])
|
31
|
+
end
|
32
|
+
|
33
|
+
BouncePurge = Struct.new(:enabled, :hard_bounces, :soft_bounces)
|
34
|
+
|
35
|
+
def self.create_bounce_purge(resp)
|
36
|
+
return resp if resp.nil?
|
37
|
+
BouncePurge.new(
|
38
|
+
resp['enabled'], resp['hard_bounces'], resp['soft_bounces']
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
EventNotification = Struct.new(
|
43
|
+
:enabled, :url, :group_resubscribe, :delivered, :group_unsubscribe,
|
44
|
+
:spam_report, :bounce, :deferred, :unsubscribe, :processed, :open,
|
45
|
+
:click, :dropped
|
46
|
+
)
|
47
|
+
|
48
|
+
def self.create_event_notification(resp)
|
49
|
+
return resp if resp.nil?
|
50
|
+
EventNotification.new(
|
51
|
+
resp['enabled'], resp['url'], resp['group_resubscribe'],
|
52
|
+
resp['delivered'], resp['group_unsubscribe'], resp['spam_report'],
|
53
|
+
resp['bounce'], resp['deferred'], resp['unsubscribe'],
|
54
|
+
resp['processed'], resp['open'], resp['click'], resp['dropped']
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
Footer = Struct.new(:enabled, :html_content, :plain_content)
|
59
|
+
|
60
|
+
def self.create_footer(resp)
|
61
|
+
return resp if resp.nil?
|
62
|
+
Footer.new(
|
63
|
+
resp['enabled'], resp['html_content'], resp['plain_content']
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
ForwardBounce = Struct.new(:enabled, :email)
|
68
|
+
|
69
|
+
def self.create_forward_bounce(resp)
|
70
|
+
return resp if resp.nil?
|
71
|
+
ForwardBounce.new(resp['enabled'], resp['email'])
|
72
|
+
end
|
73
|
+
|
74
|
+
ForwardSpam = Struct.new(:enabled, :email)
|
75
|
+
|
76
|
+
def self.create_forward_spam(resp)
|
77
|
+
return resp if resp.nil?
|
78
|
+
ForwardSpam.new(resp['enabled'], resp['email'])
|
79
|
+
end
|
80
|
+
|
81
|
+
Template = Struct.new(:enabled, :html_content)
|
82
|
+
|
83
|
+
def self.create_template(resp)
|
84
|
+
return resp if resp.nil?
|
85
|
+
Template.new(resp['enabled'], resp['html_content'])
|
86
|
+
end
|
87
|
+
|
88
|
+
PlainContent = Struct.new(:enabled)
|
89
|
+
|
90
|
+
def self.create_plain_content(resp)
|
91
|
+
return resp if resp.nil?
|
92
|
+
PlainContent.new(resp['enabled'])
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.url(name = nil)
|
96
|
+
url = "#{BASE_URL}/mail_settings"
|
97
|
+
url = "#{url}/#{name}" unless name.nil?
|
98
|
+
url
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.url_event(path)
|
102
|
+
"#{BASE_URL}/user/webhooks/event/#{path}"
|
103
|
+
end
|
104
|
+
|
105
|
+
def get_mail_settings(limit: nil, offset: nil, &block)
|
106
|
+
params = {}
|
107
|
+
params['limit'] = limit unless limit.nil?
|
108
|
+
params['offset'] = offset unless offset.nil?
|
109
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url
|
110
|
+
resp = get(@auth, endpoint, params, &block)
|
111
|
+
SendGrid4r::REST::Settings.create_results(resp)
|
112
|
+
end
|
113
|
+
|
114
|
+
def get_settings_address_whitelist(&block)
|
115
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('address_whitelist')
|
116
|
+
resp = get(@auth, endpoint, &block)
|
117
|
+
SendGrid4r::REST::Settings::Mail.create_address_whitelist(resp)
|
118
|
+
end
|
119
|
+
|
120
|
+
def patch_settings_address_whitelist(params:, &block)
|
121
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('address_whitelist')
|
122
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
123
|
+
SendGrid4r::REST::Settings::Mail.create_address_whitelist(resp)
|
124
|
+
end
|
125
|
+
|
126
|
+
def get_settings_bcc(&block)
|
127
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('bcc')
|
128
|
+
resp = get(@auth, endpoint, &block)
|
129
|
+
SendGrid4r::REST::Settings::Mail.create_bcc(resp)
|
130
|
+
end
|
131
|
+
|
132
|
+
def patch_settings_bcc(params:, &block)
|
133
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('bcc')
|
134
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
135
|
+
SendGrid4r::REST::Settings::Mail.create_bcc(resp)
|
136
|
+
end
|
137
|
+
|
138
|
+
def get_settings_bounce_purge(&block)
|
139
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('bounce_purge')
|
140
|
+
resp = get(@auth, endpoint, &block)
|
141
|
+
SendGrid4r::REST::Settings::Mail.create_bounce_purge(resp)
|
142
|
+
end
|
143
|
+
|
144
|
+
def patch_settings_bounce_purge(params:, &block)
|
145
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('bounce_purge')
|
146
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
147
|
+
SendGrid4r::REST::Settings::Mail.create_bounce_purge(resp)
|
148
|
+
end
|
149
|
+
|
150
|
+
def get_settings_event_notification(&block)
|
151
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url_event('settings')
|
152
|
+
resp = get(@auth, endpoint, &block)
|
153
|
+
SendGrid4r::REST::Settings::Mail.create_event_notification(resp)
|
154
|
+
end
|
155
|
+
|
156
|
+
def patch_settings_event_notification(params:, &block)
|
157
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url_event('settings')
|
158
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
159
|
+
SendGrid4r::REST::Settings::Mail.create_event_notification(resp)
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_settings_event_notification(url:, &block)
|
163
|
+
params = {}
|
164
|
+
params['url'] = url
|
165
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url_event('test')
|
166
|
+
post(@auth, endpoint, params, &block)
|
167
|
+
end
|
168
|
+
|
169
|
+
def get_settings_footer(&block)
|
170
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('footer')
|
171
|
+
resp = get(@auth, endpoint, &block)
|
172
|
+
SendGrid4r::REST::Settings::Mail.create_footer(resp)
|
173
|
+
end
|
174
|
+
|
175
|
+
def patch_settings_footer(params:, &block)
|
176
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('footer')
|
177
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
178
|
+
SendGrid4r::REST::Settings::Mail.create_footer(resp)
|
179
|
+
end
|
180
|
+
|
181
|
+
def get_settings_forward_bounce(&block)
|
182
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('forward_bounce')
|
183
|
+
resp = get(@auth, endpoint, &block)
|
184
|
+
SendGrid4r::REST::Settings::Mail.create_forward_bounce(resp)
|
185
|
+
end
|
186
|
+
|
187
|
+
def patch_settings_forward_bounce(params:, &block)
|
188
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('forward_bounce')
|
189
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
190
|
+
SendGrid4r::REST::Settings::Mail.create_forward_bounce(resp)
|
191
|
+
end
|
192
|
+
|
193
|
+
def get_settings_forward_spam(&block)
|
194
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('forward_spam')
|
195
|
+
resp = get(@auth, endpoint, &block)
|
196
|
+
SendGrid4r::REST::Settings::Mail.create_forward_spam(resp)
|
197
|
+
end
|
198
|
+
|
199
|
+
def patch_settings_forward_spam(params:, &block)
|
200
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('forward_spam')
|
201
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
202
|
+
SendGrid4r::REST::Settings::Mail.create_forward_spam(resp)
|
203
|
+
end
|
204
|
+
|
205
|
+
def get_settings_template(&block)
|
206
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('template')
|
207
|
+
resp = get(@auth, endpoint, &block)
|
208
|
+
SendGrid4r::REST::Settings::Mail.create_template(resp)
|
209
|
+
end
|
210
|
+
|
211
|
+
def patch_settings_template(params:, &block)
|
212
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('template')
|
213
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
214
|
+
SendGrid4r::REST::Settings::Mail.create_template(resp)
|
215
|
+
end
|
216
|
+
|
217
|
+
def get_settings_plain_content(&block)
|
218
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('plain_content')
|
219
|
+
resp = get(@auth, endpoint, &block)
|
220
|
+
SendGrid4r::REST::Settings::Mail.create_plain_content(resp)
|
221
|
+
end
|
222
|
+
|
223
|
+
def patch_settings_plain_content(params:, &block)
|
224
|
+
endpoint = SendGrid4r::REST::Settings::Mail.url('plain_content')
|
225
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
226
|
+
SendGrid4r::REST::Settings::Mail.create_plain_content(resp)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'sendgrid4r/rest/request'
|
5
|
+
|
6
|
+
module SendGrid4r
|
7
|
+
module REST
|
8
|
+
module Settings
|
9
|
+
#
|
10
|
+
# SendGrid Web API v3 Settings - Partner
|
11
|
+
#
|
12
|
+
module Partner
|
13
|
+
include SendGrid4r::REST::Request
|
14
|
+
Partner = Struct.new(:enabled, :license_key)
|
15
|
+
|
16
|
+
def self.create_partner(resp)
|
17
|
+
return resp if resp.nil?
|
18
|
+
Partner.new(resp['enabled'], resp['license_key'])
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.url(name = nil)
|
22
|
+
url = "#{BASE_URL}/partner_settings"
|
23
|
+
url = "#{url}/#{name}" unless name.nil?
|
24
|
+
url
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_partner_settings(limit: nil, offset: nil, &block)
|
28
|
+
params = {}
|
29
|
+
params['limit'] = limit unless limit.nil?
|
30
|
+
params['offset'] = offset unless offset.nil?
|
31
|
+
endpoint = SendGrid4r::REST::Settings::Partner.url
|
32
|
+
resp = get(@auth, endpoint, params, &block)
|
33
|
+
SendGrid4r::REST::Settings.create_results(resp)
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_settings_new_relic(&block)
|
37
|
+
endpoint = SendGrid4r::REST::Settings::Partner.url('new_relic')
|
38
|
+
resp = get(@auth, endpoint, &block)
|
39
|
+
SendGrid4r::REST::Settings::Partner.create_partner(resp)
|
40
|
+
end
|
41
|
+
|
42
|
+
def patch_settings_new_relic(params:, &block)
|
43
|
+
endpoint = SendGrid4r::REST::Settings::Partner.url('new_relic')
|
44
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
45
|
+
SendGrid4r::REST::Settings::Partner.create_partner(resp)
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_settings_sendwithus(&block)
|
49
|
+
endpoint = SendGrid4r::REST::Settings::Partner.url('sendwithus')
|
50
|
+
resp = get(@auth, endpoint, &block)
|
51
|
+
SendGrid4r::REST::Settings::Partner.create_partner(resp)
|
52
|
+
end
|
53
|
+
|
54
|
+
def patch_settings_sendwithus(params:, &block)
|
55
|
+
endpoint = SendGrid4r::REST::Settings::Partner.url('sendwithus')
|
56
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
57
|
+
SendGrid4r::REST::Settings::Partner.create_partner(resp)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'sendgrid4r/rest/request'
|
5
|
+
|
6
|
+
module SendGrid4r
|
7
|
+
module REST
|
8
|
+
#
|
9
|
+
# SendGrid Web API v3 Settings
|
10
|
+
#
|
11
|
+
module Settings
|
12
|
+
Results = Struct.new(:result)
|
13
|
+
Result = Struct.new(:name, :title, :description, :enabled)
|
14
|
+
|
15
|
+
def self.create_results(resp)
|
16
|
+
return resp if resp.nil?
|
17
|
+
results = []
|
18
|
+
resp['result'].each do |result|
|
19
|
+
results.push(SendGrid4r::REST::Settings.create_result(result))
|
20
|
+
end
|
21
|
+
Results.new(results)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.create_result(resp)
|
25
|
+
return resp if resp.nil?
|
26
|
+
Result.new(
|
27
|
+
resp['name'], resp['title'], resp['description'], resp['enabled']
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'sendgrid4r/rest/request'
|
5
|
+
|
6
|
+
module SendGrid4r
|
7
|
+
module REST
|
8
|
+
module Settings
|
9
|
+
#
|
10
|
+
# SendGrid Web API v3 Settings - Tracking
|
11
|
+
#
|
12
|
+
module Tracking
|
13
|
+
include SendGrid4r::REST::Request
|
14
|
+
|
15
|
+
Click = Struct.new(:enabled)
|
16
|
+
|
17
|
+
def self.create_click(resp)
|
18
|
+
return resp if resp.nil?
|
19
|
+
Click.new(resp['enabled'])
|
20
|
+
end
|
21
|
+
|
22
|
+
GoogleAnalytics = Struct.new(
|
23
|
+
:enabled, :utm_source, :utm_medium, :utm_term, :utm_content,
|
24
|
+
:utm_campaign
|
25
|
+
)
|
26
|
+
|
27
|
+
def self.create_google_analytics(resp)
|
28
|
+
return resp if resp.nil?
|
29
|
+
GoogleAnalytics.new(
|
30
|
+
resp['enabled'], resp['utm_source'], resp['utm_medium'],
|
31
|
+
resp['utm_term'], resp['utm_content'], resp['utm_campaign']
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
Open = Struct.new(:enabled)
|
36
|
+
|
37
|
+
def self.create_open(resp)
|
38
|
+
return resp if resp.nil?
|
39
|
+
Open.new(resp['enabled'])
|
40
|
+
end
|
41
|
+
|
42
|
+
Subscription = Struct.new(
|
43
|
+
:enabled, :landing, :url, :replace, :html_content, :plain_content
|
44
|
+
)
|
45
|
+
|
46
|
+
def self.create_subscription(resp)
|
47
|
+
return resp if resp.nil?
|
48
|
+
Subscription.new(
|
49
|
+
resp['enabled'], resp['landing'], resp['url'], resp['replace'],
|
50
|
+
resp['html_content'], resp['plain_content']
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.url(name = nil)
|
55
|
+
url = "#{BASE_URL}/tracking_settings"
|
56
|
+
url = "#{url}/#{name}" unless name.nil?
|
57
|
+
url
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_tracking_settings(limit: nil, offset: nil, &block)
|
61
|
+
params = {}
|
62
|
+
params['limit'] = limit unless limit.nil?
|
63
|
+
params['offset'] = offset unless offset.nil?
|
64
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url
|
65
|
+
resp = get(@auth, endpoint, params, &block)
|
66
|
+
SendGrid4r::REST::Settings.create_results(resp)
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_settings_click(&block)
|
70
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url('click')
|
71
|
+
resp = get(@auth, endpoint, &block)
|
72
|
+
SendGrid4r::REST::Settings::Tracking.create_click(resp)
|
73
|
+
end
|
74
|
+
|
75
|
+
def patch_settings_click(params:, &block)
|
76
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url('click')
|
77
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
78
|
+
SendGrid4r::REST::Settings::Tracking.create_click(resp)
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_settings_google_analytics(&block)
|
82
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url(
|
83
|
+
'google_analytics'
|
84
|
+
)
|
85
|
+
resp = get(@auth, endpoint, &block)
|
86
|
+
SendGrid4r::REST::Settings::Tracking.create_google_analytics(resp)
|
87
|
+
end
|
88
|
+
|
89
|
+
def patch_settings_google_analytics(params:, &block)
|
90
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url(
|
91
|
+
'google_analytics'
|
92
|
+
)
|
93
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
94
|
+
SendGrid4r::REST::Settings::Tracking.create_google_analytics(resp)
|
95
|
+
end
|
96
|
+
|
97
|
+
def get_settings_open(&block)
|
98
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url('open')
|
99
|
+
resp = get(@auth, endpoint, &block)
|
100
|
+
SendGrid4r::REST::Settings::Tracking.create_open(resp)
|
101
|
+
end
|
102
|
+
|
103
|
+
def patch_settings_open(params:, &block)
|
104
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url('open')
|
105
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
106
|
+
SendGrid4r::REST::Settings::Tracking.create_open(resp)
|
107
|
+
end
|
108
|
+
|
109
|
+
def get_settings_subscription(&block)
|
110
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url('subscription')
|
111
|
+
resp = get(@auth, endpoint, &block)
|
112
|
+
SendGrid4r::REST::Settings::Tracking.create_subscription(resp)
|
113
|
+
end
|
114
|
+
|
115
|
+
def patch_settings_subscription(params:, &block)
|
116
|
+
endpoint = SendGrid4r::REST::Settings::Tracking.url('subscription')
|
117
|
+
resp = patch(@auth, endpoint, params.to_h, &block)
|
118
|
+
SendGrid4r::REST::Settings::Tracking.create_subscription(resp)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
data/lib/sendgrid4r/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -45,7 +45,7 @@ describe SendGrid4r::REST::EmailActivity do
|
|
45
45
|
activities = @client.get_email_activities(
|
46
46
|
events: [SendGrid4r::Client::Event::DROPS]
|
47
47
|
)
|
48
|
-
expect(activities.length).to be
|
48
|
+
expect(activities.length).to be >= 0
|
49
49
|
activities.each do |activity|
|
50
50
|
expect(activity).to be_a(SendGrid4r::REST::EmailActivity::Activity)
|
51
51
|
expect(activity.event).to eq('drop')
|
@@ -74,7 +74,7 @@ describe SendGrid4r::REST::EmailActivity do
|
|
74
74
|
events.push(SendGrid4r::Client::Event::SPAM_REPORTS)
|
75
75
|
events.push(SendGrid4r::Client::Event::UNSUBSCRIBE)
|
76
76
|
activities = @client.get_email_activities(events: events)
|
77
|
-
expect(activities.length).to be
|
77
|
+
expect(activities.length).to be >= 0
|
78
78
|
activities.each do |activity|
|
79
79
|
expect(activity).to be_a(SendGrid4r::REST::EmailActivity::Activity)
|
80
80
|
end
|
@@ -30,7 +30,7 @@ describe SendGrid4r::REST::Settings::EnforcedTls do
|
|
30
30
|
# patch both value
|
31
31
|
actual.require_tls = false
|
32
32
|
actual.require_valid_cert = false
|
33
|
-
edit = @client.patch_enforced_tls(actual)
|
33
|
+
edit = @client.patch_enforced_tls(params: actual)
|
34
34
|
expect(actual.require_tls).to eq(edit.require_tls)
|
35
35
|
expect(actual.require_valid_cert).to eq(edit.require_valid_cert)
|
36
36
|
rescue => e
|
@@ -61,7 +61,7 @@ describe SendGrid4r::REST::Settings::EnforcedTls do
|
|
61
61
|
# patch both value
|
62
62
|
actual.require_tls = false
|
63
63
|
actual.require_valid_cert = false
|
64
|
-
@client.patch_enforced_tls(actual) do |resp, req, res|
|
64
|
+
@client.patch_enforced_tls(params: actual) do |resp, req, res|
|
65
65
|
resp =
|
66
66
|
SendGrid4r::REST::Settings::EnforcedTls.create_enforced_tls(
|
67
67
|
JSON.parse(resp)
|
@@ -100,7 +100,7 @@ describe SendGrid4r::REST::Settings::EnforcedTls do
|
|
100
100
|
|
101
101
|
it '#patch_enforced_tls' do
|
102
102
|
allow(client).to receive(:execute).and_return(enforced_tls)
|
103
|
-
actual = client.patch_enforced_tls(nil)
|
103
|
+
actual = client.patch_enforced_tls(params: nil)
|
104
104
|
expect(actual).to be_a(
|
105
105
|
SendGrid4r::REST::Settings::EnforcedTls::EnforcedTls
|
106
106
|
)
|