sendgrid4r 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sendgrid4r/rest/api.rb +7 -4
- data/lib/sendgrid4r/rest/blocks.rb +80 -0
- data/lib/sendgrid4r/rest/invalid_emails.rb +81 -0
- data/lib/sendgrid4r/rest/sm/global_unsubscribes.rb +75 -0
- data/lib/sendgrid4r/rest/{asm → sm}/groups.rb +12 -12
- data/lib/sendgrid4r/rest/{asm/asm.rb → sm/sm.rb} +2 -2
- data/lib/sendgrid4r/rest/{asm → sm}/suppressions.rb +9 -9
- data/lib/sendgrid4r/rest/spam_reports.rb +81 -0
- data/lib/sendgrid4r/version.rb +1 -1
- data/lib/sendgrid4r.rb +7 -4
- data/spec/client_spec.rb +26 -3
- data/spec/rest/blocks_spec.rb +162 -0
- data/spec/rest/invalid_emails_spec.rb +173 -0
- data/spec/rest/{asm/global_suppressions_spec.rb → sm/global_unsubscribes_spec.rb} +18 -3
- data/spec/rest/{asm → sm}/groups_spec.rb +10 -10
- data/spec/rest/{asm/asm_spec.rb → sm/sm_spec.rb} +5 -5
- data/spec/rest/{asm → sm}/suppressions_spec.rb +8 -8
- data/spec/rest/spam_reports_spec.rb +163 -0
- metadata +23 -14
- data/lib/sendgrid4r/rest/asm/global_suppressions.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4970f1d3bba5b4f0f5efe8267f7d8b339d50dba4
|
4
|
+
data.tar.gz: f3d6096eb69342dcb0b4d565e159263c588d5847
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4f68701e16a3531a93b5c61adf659ef0da529eeb9df397d3cf3542baf728511394d6aeb8c66e63b13d24ed37d7914277ada11d56717566ff19f8e282826fd34
|
7
|
+
data.tar.gz: 8e13f566ebc9b52bae2d664756ddf8f8eddb496e4b4294c95d9f1216673f067fae2f783b6166eca892127bc64ca4df676ce8c8978c65d1d4cfeccb6802fcf326
|
data/lib/sendgrid4r/rest/api.rb
CHANGED
@@ -8,10 +8,10 @@ module SendGrid4r
|
|
8
8
|
module API
|
9
9
|
include SendGrid4r::REST::Templates
|
10
10
|
include SendGrid4r::REST::Templates::Versions
|
11
|
-
include SendGrid4r::REST::
|
12
|
-
include SendGrid4r::REST::
|
13
|
-
include SendGrid4r::REST::
|
14
|
-
include SendGrid4r::REST::
|
11
|
+
include SendGrid4r::REST::Sm
|
12
|
+
include SendGrid4r::REST::Sm::Groups
|
13
|
+
include SendGrid4r::REST::Sm::Suppressions
|
14
|
+
include SendGrid4r::REST::Sm::GlobalUnsubscribes
|
15
15
|
include SendGrid4r::REST::Settings
|
16
16
|
include SendGrid4r::REST::Settings::EnforcedTls
|
17
17
|
include SendGrid4r::REST::Settings::Mail
|
@@ -41,6 +41,9 @@ module SendGrid4r
|
|
41
41
|
include SendGrid4r::REST::Whitelabel::Links
|
42
42
|
include SendGrid4r::REST::Users
|
43
43
|
include SendGrid4r::REST::Bounces
|
44
|
+
include SendGrid4r::REST::Blocks
|
45
|
+
include SendGrid4r::REST::InvalidEmails
|
46
|
+
include SendGrid4r::REST::SpamReports
|
44
47
|
include SendGrid4r::REST::CancelScheduledSends
|
45
48
|
include SendGrid4r::REST::Webhooks::Event
|
46
49
|
include SendGrid4r::REST::Webhooks::Parse
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
module SendGrid4r
|
4
|
+
module REST
|
5
|
+
#
|
6
|
+
# SendGrid Web API v3 Blocks
|
7
|
+
#
|
8
|
+
module Blocks
|
9
|
+
include SendGrid4r::REST::Request
|
10
|
+
|
11
|
+
Block = Struct.new(
|
12
|
+
:created, :email, :reason, :status
|
13
|
+
)
|
14
|
+
|
15
|
+
def self.url(email = nil)
|
16
|
+
url = "#{BASE_URL}/suppression/blocks"
|
17
|
+
url = "#{url}/#{email}" unless email.nil?
|
18
|
+
url
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.create_blocks(resp)
|
22
|
+
return resp if resp.nil?
|
23
|
+
blocks = []
|
24
|
+
resp.each do |block|
|
25
|
+
blocks.push(SendGrid4r::REST::Blocks.create_block(block))
|
26
|
+
end
|
27
|
+
blocks
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.create_block(resp)
|
31
|
+
return resp if resp.nil?
|
32
|
+
created = Time.at(resp['created']) unless resp['created'].nil?
|
33
|
+
Block.new(
|
34
|
+
created,
|
35
|
+
resp['email'],
|
36
|
+
resp['reason'],
|
37
|
+
resp['status']
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_blocks(
|
42
|
+
start_time: nil, end_time: nil, limit: nil, offset: nil, &block
|
43
|
+
)
|
44
|
+
params = {}
|
45
|
+
params['start_time'] = start_time.to_i unless start_time.nil?
|
46
|
+
params['end_time'] = end_time.to_i unless end_time.nil?
|
47
|
+
params['limit'] = limit.to_i unless limit.nil?
|
48
|
+
params['offset'] = offset.to_i unless offset.nil?
|
49
|
+
resp = get(@auth, SendGrid4r::REST::Blocks.url, params, &block)
|
50
|
+
SendGrid4r::REST::Blocks.create_blocks(resp)
|
51
|
+
end
|
52
|
+
|
53
|
+
def delete_blocks(delete_all: nil, emails: nil, &block)
|
54
|
+
endpoint = SendGrid4r::REST::Blocks.url
|
55
|
+
payload = {}
|
56
|
+
if delete_all == true
|
57
|
+
payload['delete_all'] = delete_all
|
58
|
+
else
|
59
|
+
payload['emails'] = emails
|
60
|
+
end
|
61
|
+
delete(@auth, endpoint, nil, payload, &block)
|
62
|
+
end
|
63
|
+
|
64
|
+
def get_block(email:, &block)
|
65
|
+
endpoint = SendGrid4r::REST::Blocks.url(email)
|
66
|
+
params = {}
|
67
|
+
params['email'] = email
|
68
|
+
resp = get(@auth, endpoint, params, &block)
|
69
|
+
SendGrid4r::REST::Blocks.create_blocks(resp)
|
70
|
+
end
|
71
|
+
|
72
|
+
def delete_block(email:, &block)
|
73
|
+
endpoint = SendGrid4r::REST::Blocks.url(email)
|
74
|
+
params = {}
|
75
|
+
params['email'] = email
|
76
|
+
delete(@auth, endpoint, params, &block)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
module SendGrid4r
|
4
|
+
module REST
|
5
|
+
#
|
6
|
+
# SendGrid Web API v3 InvalidEmails
|
7
|
+
#
|
8
|
+
module InvalidEmails
|
9
|
+
include SendGrid4r::REST::Request
|
10
|
+
|
11
|
+
InvalidEmail = Struct.new(
|
12
|
+
:created, :email, :reason
|
13
|
+
)
|
14
|
+
|
15
|
+
def self.url(email = nil)
|
16
|
+
url = "#{BASE_URL}/suppression/invalid_emails"
|
17
|
+
url = "#{url}/#{email}" unless email.nil?
|
18
|
+
url
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.create_invalid_emails(resp)
|
22
|
+
return resp if resp.nil?
|
23
|
+
invalid_emails = []
|
24
|
+
resp.each do |invalid_email|
|
25
|
+
invalid_emails.push(
|
26
|
+
SendGrid4r::REST::InvalidEmails.create_invalid_email(invalid_email)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
invalid_emails
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.create_invalid_email(resp)
|
33
|
+
return resp if resp.nil?
|
34
|
+
created = Time.at(resp['created']) unless resp['created'].nil?
|
35
|
+
InvalidEmail.new(
|
36
|
+
created,
|
37
|
+
resp['email'],
|
38
|
+
resp['reason']
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_invalid_emails(
|
43
|
+
start_time: nil, end_time: nil, limit: nil, offset: nil, &block
|
44
|
+
)
|
45
|
+
params = {}
|
46
|
+
params['start_time'] = start_time.to_i unless start_time.nil?
|
47
|
+
params['end_time'] = end_time.to_i unless end_time.nil?
|
48
|
+
params['limit'] = limit.to_i unless limit.nil?
|
49
|
+
params['offset'] = offset.to_i unless offset.nil?
|
50
|
+
resp = get(@auth, SendGrid4r::REST::InvalidEmails.url, params, &block)
|
51
|
+
SendGrid4r::REST::InvalidEmails.create_invalid_emails(resp)
|
52
|
+
end
|
53
|
+
|
54
|
+
def delete_invalid_emails(delete_all: nil, emails: nil, &block)
|
55
|
+
endpoint = SendGrid4r::REST::InvalidEmails.url
|
56
|
+
payload = {}
|
57
|
+
if delete_all == true
|
58
|
+
payload['delete_all'] = delete_all
|
59
|
+
else
|
60
|
+
payload['emails'] = emails
|
61
|
+
end
|
62
|
+
delete(@auth, endpoint, nil, payload, &block)
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_invalid_email(email:, &block)
|
66
|
+
endpoint = SendGrid4r::REST::InvalidEmails.url(email)
|
67
|
+
params = {}
|
68
|
+
params['email'] = email
|
69
|
+
resp = get(@auth, endpoint, params, &block)
|
70
|
+
SendGrid4r::REST::InvalidEmails.create_invalid_emails(resp)
|
71
|
+
end
|
72
|
+
|
73
|
+
def delete_invalid_email(email:, &block)
|
74
|
+
endpoint = SendGrid4r::REST::InvalidEmails.url(email)
|
75
|
+
params = {}
|
76
|
+
params['email'] = email
|
77
|
+
delete(@auth, endpoint, params, &block)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
module SendGrid4r
|
4
|
+
module REST
|
5
|
+
module Sm
|
6
|
+
#
|
7
|
+
# SendGrid Web API v3 Suppression Management - Global Unsubscribes
|
8
|
+
#
|
9
|
+
module GlobalUnsubscribes
|
10
|
+
include SendGrid4r::REST::Request
|
11
|
+
|
12
|
+
Unsubscribe = Struct.new(:created, :email)
|
13
|
+
|
14
|
+
def self.url(email_address = nil)
|
15
|
+
url = "#{BASE_URL}/asm/suppressions/global"
|
16
|
+
url = "#{url}/#{email_address}" unless email_address.nil?
|
17
|
+
url
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.url_unsubscribes
|
21
|
+
"#{BASE_URL}/suppression/unsubscribes"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.create_supressions(resp)
|
25
|
+
return resp if resp.nil?
|
26
|
+
suppressions = []
|
27
|
+
resp.each do |suppression|
|
28
|
+
created = Time.at(suppression['created'])
|
29
|
+
suppressions.push(Unsubscribe.new(created, suppression['email']))
|
30
|
+
end
|
31
|
+
suppressions
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_global_unsubscribes(
|
35
|
+
start_time: nil, end_time: nil, limit: nil, offset: nil, &block
|
36
|
+
)
|
37
|
+
params = {}
|
38
|
+
params['start_time'] = start_time.to_i unless start_time.nil?
|
39
|
+
params['end_time'] = end_time.to_i unless end_time.nil?
|
40
|
+
params['limit'] = limit.to_i unless limit.nil?
|
41
|
+
params['offset'] = offset.to_i unless offset.nil?
|
42
|
+
endpoint = SendGrid4r::REST::Sm::GlobalUnsubscribes.url_unsubscribes
|
43
|
+
resp = get(@auth, endpoint, params, &block)
|
44
|
+
SendGrid4r::REST::Sm::GlobalUnsubscribes.create_supressions(resp)
|
45
|
+
end
|
46
|
+
|
47
|
+
def post_global_suppressed_emails(recipient_emails:, &block)
|
48
|
+
params = { recipient_emails: recipient_emails }
|
49
|
+
endpoint = SendGrid4r::REST::Sm::GlobalUnsubscribes.url
|
50
|
+
resp = post(@auth, endpoint, params, &block)
|
51
|
+
SendGrid4r::REST::Sm.create_recipient_emails(resp)
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_global_suppressed_email(email_address:, &block)
|
55
|
+
endpoint =
|
56
|
+
SendGrid4r::REST::Sm::GlobalUnsubscribes.url(email_address)
|
57
|
+
resp = get(@auth, endpoint, &block)
|
58
|
+
SendGrid4r::REST::Sm.create_recipient_email(resp)
|
59
|
+
end
|
60
|
+
|
61
|
+
def delete_global_suppressed_email(email_address:, &block)
|
62
|
+
endpoint =
|
63
|
+
SendGrid4r::REST::Sm::GlobalUnsubscribes.url(email_address)
|
64
|
+
delete(@auth, endpoint, &block)
|
65
|
+
end
|
66
|
+
|
67
|
+
alias_method(:post_global_unsubscribes, :post_global_suppressed_emails)
|
68
|
+
alias_method(:get_global_unsubscribe, :get_global_suppressed_email)
|
69
|
+
alias_method(
|
70
|
+
:delete_global_unsubscribe, :delete_global_suppressed_email
|
71
|
+
)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module SendGrid4r
|
4
4
|
module REST
|
5
|
-
module
|
5
|
+
module Sm
|
6
6
|
#
|
7
|
-
# SendGrid Web API v3
|
7
|
+
# SendGrid Web API v3 Suppression Management - Groups
|
8
8
|
#
|
9
9
|
module Groups
|
10
10
|
include SendGrid4r::REST::Request
|
@@ -24,7 +24,7 @@ module SendGrid4r
|
|
24
24
|
return resp if resp.nil?
|
25
25
|
groups = []
|
26
26
|
resp.each do |group|
|
27
|
-
groups.push(SendGrid4r::REST::
|
27
|
+
groups.push(SendGrid4r::REST::Sm::Groups.create_group(group))
|
28
28
|
end
|
29
29
|
groups
|
30
30
|
end
|
@@ -44,28 +44,28 @@ module SendGrid4r
|
|
44
44
|
def post_group(name:, description:, is_default: nil, &block)
|
45
45
|
params = { name: name, description: description }
|
46
46
|
params['is_default'] = is_default unless is_default.nil?
|
47
|
-
resp = post(@auth, SendGrid4r::REST::
|
48
|
-
SendGrid4r::REST::
|
47
|
+
resp = post(@auth, SendGrid4r::REST::Sm::Groups.url, params, &block)
|
48
|
+
SendGrid4r::REST::Sm::Groups.create_group(resp)
|
49
49
|
end
|
50
50
|
|
51
51
|
def get_groups(&block)
|
52
|
-
resp = get(@auth, SendGrid4r::REST::
|
53
|
-
SendGrid4r::REST::
|
52
|
+
resp = get(@auth, SendGrid4r::REST::Sm::Groups.url, &block)
|
53
|
+
SendGrid4r::REST::Sm::Groups.create_groups(resp)
|
54
54
|
end
|
55
55
|
|
56
56
|
def get_group(group_id:, &block)
|
57
|
-
resp = get(@auth, SendGrid4r::REST::
|
58
|
-
SendGrid4r::REST::
|
57
|
+
resp = get(@auth, SendGrid4r::REST::Sm::Groups.url(group_id), &block)
|
58
|
+
SendGrid4r::REST::Sm::Groups.create_group(resp)
|
59
59
|
end
|
60
60
|
|
61
61
|
def patch_group(group_id:, group:, &block)
|
62
|
-
endpoint = SendGrid4r::REST::
|
62
|
+
endpoint = SendGrid4r::REST::Sm::Groups.url(group_id)
|
63
63
|
resp = patch(@auth, endpoint, group.to_h, &block)
|
64
|
-
SendGrid4r::REST::
|
64
|
+
SendGrid4r::REST::Sm::Groups.create_group(resp)
|
65
65
|
end
|
66
66
|
|
67
67
|
def delete_group(group_id:, &block)
|
68
|
-
delete(@auth, SendGrid4r::REST::
|
68
|
+
delete(@auth, SendGrid4r::REST::Sm::Groups.url(group_id), &block)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module SendGrid4r
|
4
4
|
module REST
|
5
|
-
module
|
5
|
+
module Sm
|
6
6
|
#
|
7
|
-
# SendGrid Web API v3
|
7
|
+
# SendGrid Web API v3 Suppression Management - Suppressions
|
8
8
|
#
|
9
9
|
module Suppressions
|
10
10
|
include SendGrid4r::REST::Request
|
@@ -23,7 +23,7 @@ module SendGrid4r
|
|
23
23
|
suppressions = []
|
24
24
|
resp['suppressions'].each do |suppression|
|
25
25
|
suppressions.push(
|
26
|
-
SendGrid4r::REST::
|
26
|
+
SendGrid4r::REST::Sm::Suppressions.create_suppression(
|
27
27
|
suppression
|
28
28
|
)
|
29
29
|
)
|
@@ -50,29 +50,29 @@ module SendGrid4r
|
|
50
50
|
def post_suppressed_emails(group_id:, recipient_emails:, &block)
|
51
51
|
resp = post(
|
52
52
|
@auth,
|
53
|
-
SendGrid4r::REST::
|
53
|
+
SendGrid4r::REST::Sm::Suppressions.url(group_id),
|
54
54
|
recipient_emails: recipient_emails,
|
55
55
|
&block
|
56
56
|
)
|
57
|
-
SendGrid4r::REST::
|
57
|
+
SendGrid4r::REST::Sm.create_recipient_emails(resp)
|
58
58
|
end
|
59
59
|
|
60
60
|
def get_suppressed_emails(group_id:, &block)
|
61
|
-
endpoint = SendGrid4r::REST::
|
61
|
+
endpoint = SendGrid4r::REST::Sm::Suppressions.url(group_id)
|
62
62
|
resp = get(@auth, endpoint, &block)
|
63
|
-
SendGrid4r::REST::
|
63
|
+
SendGrid4r::REST::Sm::Suppressions.create_emails(resp)
|
64
64
|
end
|
65
65
|
|
66
66
|
def get_suppressions(email_address:, &block)
|
67
67
|
endpoint = "#{BASE_URL}/asm/suppressions/#{email_address}"
|
68
68
|
resp = get(@auth, endpoint, &block)
|
69
|
-
SendGrid4r::REST::
|
69
|
+
SendGrid4r::REST::Sm::Suppressions.create_suppressions(resp)
|
70
70
|
end
|
71
71
|
|
72
72
|
def delete_suppressed_email(group_id:, email_address:, &block)
|
73
73
|
delete(
|
74
74
|
@auth,
|
75
|
-
SendGrid4r::REST::
|
75
|
+
SendGrid4r::REST::Sm::Suppressions.url(group_id, email_address),
|
76
76
|
&block
|
77
77
|
)
|
78
78
|
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
module SendGrid4r
|
4
|
+
module REST
|
5
|
+
#
|
6
|
+
# SendGrid Web API v3 SpamReports
|
7
|
+
#
|
8
|
+
module SpamReports
|
9
|
+
include SendGrid4r::REST::Request
|
10
|
+
|
11
|
+
SpamReport = Struct.new(
|
12
|
+
:created, :email, :ip
|
13
|
+
)
|
14
|
+
|
15
|
+
def self.url(email = nil)
|
16
|
+
url = "#{BASE_URL}/suppression/spam_reports"
|
17
|
+
url = "#{url}/#{email}" unless email.nil?
|
18
|
+
url
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.create_spam_reports(resp)
|
22
|
+
return resp if resp.nil?
|
23
|
+
spam_reports = []
|
24
|
+
resp.each do |spam_report|
|
25
|
+
spam_reports.push(
|
26
|
+
SendGrid4r::REST::SpamReports.create_spam_report(spam_report)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
spam_reports
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.create_spam_report(resp)
|
33
|
+
return resp if resp.nil?
|
34
|
+
created = Time.at(resp['created']) unless resp['created'].nil?
|
35
|
+
SpamReport.new(
|
36
|
+
created,
|
37
|
+
resp['email'],
|
38
|
+
resp['ip']
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_spam_reports(
|
43
|
+
start_time: nil, end_time: nil, limit: nil, offset: nil, &block
|
44
|
+
)
|
45
|
+
params = {}
|
46
|
+
params['start_time'] = start_time.to_i unless start_time.nil?
|
47
|
+
params['end_time'] = end_time.to_i unless end_time.nil?
|
48
|
+
params['limit'] = limit.to_i unless limit.nil?
|
49
|
+
params['offset'] = offset.to_i unless offset.nil?
|
50
|
+
resp = get(@auth, SendGrid4r::REST::SpamReports.url, params, &block)
|
51
|
+
SendGrid4r::REST::SpamReports.create_spam_reports(resp)
|
52
|
+
end
|
53
|
+
|
54
|
+
def delete_spam_reports(delete_all: nil, emails: nil, &block)
|
55
|
+
endpoint = SendGrid4r::REST::SpamReports.url
|
56
|
+
payload = {}
|
57
|
+
if delete_all == true
|
58
|
+
payload['delete_all'] = delete_all
|
59
|
+
else
|
60
|
+
payload['emails'] = emails
|
61
|
+
end
|
62
|
+
delete(@auth, endpoint, nil, payload, &block)
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_spam_report(email:, &block)
|
66
|
+
endpoint = SendGrid4r::REST::SpamReports.url(email)
|
67
|
+
params = {}
|
68
|
+
params['email'] = email
|
69
|
+
resp = get(@auth, endpoint, params, &block)
|
70
|
+
SendGrid4r::REST::SpamReports.create_spam_reports(resp)
|
71
|
+
end
|
72
|
+
|
73
|
+
def delete_spam_report(email:, &block)
|
74
|
+
endpoint = SendGrid4r::REST::SpamReports.url(email)
|
75
|
+
params = {}
|
76
|
+
params['email'] = email
|
77
|
+
delete(@auth, endpoint, params, &block)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/sendgrid4r/version.rb
CHANGED
data/lib/sendgrid4r.rb
CHANGED
@@ -12,12 +12,15 @@ require 'sendgrid4r/rest/templates/versions'
|
|
12
12
|
require 'sendgrid4r/rest/api_keys/api_keys'
|
13
13
|
require 'sendgrid4r/rest/api_keys/permissions'
|
14
14
|
|
15
|
-
require 'sendgrid4r/rest/
|
16
|
-
require 'sendgrid4r/rest/
|
17
|
-
require 'sendgrid4r/rest/
|
18
|
-
require 'sendgrid4r/rest/
|
15
|
+
require 'sendgrid4r/rest/sm/sm'
|
16
|
+
require 'sendgrid4r/rest/sm/global_unsubscribes'
|
17
|
+
require 'sendgrid4r/rest/sm/groups'
|
18
|
+
require 'sendgrid4r/rest/sm/suppressions'
|
19
19
|
|
20
20
|
require 'sendgrid4r/rest/bounces'
|
21
|
+
require 'sendgrid4r/rest/blocks'
|
22
|
+
require 'sendgrid4r/rest/invalid_emails'
|
23
|
+
require 'sendgrid4r/rest/spam_reports'
|
21
24
|
require 'sendgrid4r/rest/cancel_scheduled_sends'
|
22
25
|
|
23
26
|
require 'sendgrid4r/rest/campaigns/campaigns'
|
data/spec/client_spec.rb
CHANGED
@@ -45,7 +45,7 @@ describe SendGrid4r::Client do
|
|
45
45
|
expect(@client.respond_to?('post_api_key')).to eq(true)
|
46
46
|
expect(@client.respond_to?('delete_api_key')).to eq(true)
|
47
47
|
expect(@client.respond_to?('patch_api_key')).to eq(true)
|
48
|
-
#
|
48
|
+
# Suppression Management
|
49
49
|
# groups
|
50
50
|
expect(@client.respond_to?('get_groups')).to eq(true)
|
51
51
|
expect(@client.respond_to?('get_group')).to eq(true)
|
@@ -57,7 +57,12 @@ describe SendGrid4r::Client do
|
|
57
57
|
expect(@client.respond_to?('get_suppressions')).to eq(true)
|
58
58
|
expect(@client.respond_to?('get_suppressed_emails')).to eq(true)
|
59
59
|
expect(@client.respond_to?('delete_suppressed_email')).to eq(true)
|
60
|
-
# global
|
60
|
+
# global unsubscribes
|
61
|
+
expect(@client.respond_to?('get_global_unsubscribes')).to eq(true)
|
62
|
+
expect(@client.respond_to?('post_global_unsubscribes')).to eq(true)
|
63
|
+
expect(@client.respond_to?('get_global_unsubscribe')).to eq(true)
|
64
|
+
expect(@client.respond_to?('delete_global_unsubscribe')).to eq(true)
|
65
|
+
# deprecated
|
61
66
|
expect(@client.respond_to?('post_global_suppressed_emails')).to eq(true)
|
62
67
|
expect(@client.respond_to?('get_global_suppressed_email')).to eq(true)
|
63
68
|
expect(
|
@@ -259,6 +264,24 @@ describe SendGrid4r::Client do
|
|
259
264
|
expect(@client.respond_to?('get_bounce')).to eq(true)
|
260
265
|
expect(@client.respond_to?('delete_bounce')).to eq(true)
|
261
266
|
|
267
|
+
# Blocks API
|
268
|
+
expect(@client.respond_to?('get_blocks')).to eq(true)
|
269
|
+
expect(@client.respond_to?('delete_blocks')).to eq(true)
|
270
|
+
expect(@client.respond_to?('get_block')).to eq(true)
|
271
|
+
expect(@client.respond_to?('delete_block')).to eq(true)
|
272
|
+
|
273
|
+
# Invalid Emails API
|
274
|
+
expect(@client.respond_to?('get_invalid_emails')).to eq(true)
|
275
|
+
expect(@client.respond_to?('delete_invalid_emails')).to eq(true)
|
276
|
+
expect(@client.respond_to?('get_invalid_email')).to eq(true)
|
277
|
+
expect(@client.respond_to?('delete_invalid_email')).to eq(true)
|
278
|
+
|
279
|
+
# Spam Reports API
|
280
|
+
expect(@client.respond_to?('get_spam_reports')).to eq(true)
|
281
|
+
expect(@client.respond_to?('delete_spam_reports')).to eq(true)
|
282
|
+
expect(@client.respond_to?('get_spam_report')).to eq(true)
|
283
|
+
expect(@client.respond_to?('delete_spam_report')).to eq(true)
|
284
|
+
|
262
285
|
# Cancel Scheduled Sends Api
|
263
286
|
expect(@client.respond_to?('generate_batch_id')).to eq(true)
|
264
287
|
expect(@client.respond_to?('validate_batch_id')).to eq(true)
|
@@ -290,7 +313,7 @@ describe SendGrid4r::Client do
|
|
290
313
|
|
291
314
|
describe 'VERSION' do
|
292
315
|
it 'returns VERSION value' do
|
293
|
-
expect(SendGrid4r::VERSION).to eq('1.
|
316
|
+
expect(SendGrid4r::VERSION).to eq('1.7.0')
|
294
317
|
end
|
295
318
|
end
|
296
319
|
end
|