sendgrid4r 1.6.0 → 1.7.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 +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
@@ -0,0 +1,162 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
|
4
|
+
describe SendGrid4r::REST::Blocks do
|
5
|
+
describe 'integration test', :it do
|
6
|
+
before do
|
7
|
+
begin
|
8
|
+
Dotenv.load
|
9
|
+
@client = SendGrid4r::Client.new(api_key: ENV['SILVER_API_KEY'])
|
10
|
+
@emails = ['a1@block.com', 'a2@block.com', 'a3@block.com']
|
11
|
+
rescue RestClient::ExceptionWithResponse => e
|
12
|
+
puts e.inspect
|
13
|
+
raise e
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'without block call' do
|
18
|
+
it '#get_blocks' do
|
19
|
+
begin
|
20
|
+
start_time = Time.now - 60 * 60 * 24 * 365
|
21
|
+
end_time = Time.now
|
22
|
+
blocks = @client.get_blocks(
|
23
|
+
start_time: start_time, end_time: end_time
|
24
|
+
)
|
25
|
+
expect(blocks).to be_a(Array)
|
26
|
+
blocks.each do |block|
|
27
|
+
expect(block).to be_a(SendGrid4r::REST::Blocks::Block)
|
28
|
+
end
|
29
|
+
rescue RestClient::ExceptionWithResponse => e
|
30
|
+
puts e.inspect
|
31
|
+
raise e
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it '#delete_blocks(delete_all: true)' do
|
36
|
+
begin
|
37
|
+
@client.delete_blocks(delete_all: true)
|
38
|
+
rescue RestClient::ExceptionWithResponse => e
|
39
|
+
puts e.inspect
|
40
|
+
raise e
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it '#delete_blocks(emails: [])' do
|
45
|
+
begin
|
46
|
+
@client.delete_blocks(emails: @emails)
|
47
|
+
rescue RestClient::ExceptionWithResponse => e
|
48
|
+
puts e.inspect
|
49
|
+
raise e
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it '#get_block' do
|
54
|
+
begin
|
55
|
+
block = @client.get_block(email: @email)
|
56
|
+
expect(block).to be_a(Array)
|
57
|
+
rescue RestClient::ExceptionWithResponse => e
|
58
|
+
puts e.inspect
|
59
|
+
raise e
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it '#delete_block' do
|
64
|
+
begin
|
65
|
+
expect do
|
66
|
+
@client.delete_block(email: 'a1@block.com')
|
67
|
+
end.to raise_error(RestClient::ResourceNotFound)
|
68
|
+
rescue RestClient::ExceptionWithResponse => e
|
69
|
+
puts e.inspect
|
70
|
+
raise e
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'unit test', :ut do
|
77
|
+
let(:client) do
|
78
|
+
SendGrid4r::Client.new(api_key: '')
|
79
|
+
end
|
80
|
+
|
81
|
+
let(:blocks) do
|
82
|
+
JSON.parse(
|
83
|
+
'['\
|
84
|
+
'{'\
|
85
|
+
'"created": 1443651154,'\
|
86
|
+
'"email": "user1@example.com",'\
|
87
|
+
'"reason": "error dialing remote address: dial tcp '\
|
88
|
+
'10.57.152.165:25: no route to host",'\
|
89
|
+
'"status": "4.0.0"'\
|
90
|
+
'}'\
|
91
|
+
']'
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
let(:block) do
|
96
|
+
JSON.parse(
|
97
|
+
'{'\
|
98
|
+
'"created": 1443651154,'\
|
99
|
+
'"email": "user1@example.com",'\
|
100
|
+
'"reason": "error dialing remote address: dial tcp '\
|
101
|
+
'10.57.152.165:25: no route to host",'\
|
102
|
+
'"status": "4.0.0"'\
|
103
|
+
'}'\
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
it '#get_blocks' do
|
108
|
+
allow(client).to receive(:execute).and_return(blocks)
|
109
|
+
actual = client.get_blocks
|
110
|
+
expect(actual).to be_a(Array)
|
111
|
+
actual.each do |block|
|
112
|
+
expect(block).to be_a(SendGrid4r::REST::Blocks::Block)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
it '#delete_blocks(delete_all: true)' do
|
117
|
+
allow(client).to receive(:execute).and_return('')
|
118
|
+
client.delete_blocks(delete_all: true)
|
119
|
+
end
|
120
|
+
|
121
|
+
it '#delete_blocks(emails: [])' do
|
122
|
+
allow(client).to receive(:execute).and_return('')
|
123
|
+
actual = client.delete_blocks(emails: [])
|
124
|
+
expect(actual).to eq('')
|
125
|
+
end
|
126
|
+
|
127
|
+
it '#get_block' do
|
128
|
+
allow(client).to receive(:execute).and_return(blocks)
|
129
|
+
actual = client.get_block(email: '')
|
130
|
+
expect(actual).to be_a(Array)
|
131
|
+
actual.each do |block|
|
132
|
+
expect(block).to be_a(SendGrid4r::REST::Blocks::Block)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
it '#delete_block' do
|
137
|
+
allow(client).to receive(:execute).and_return('')
|
138
|
+
actual = client.delete_block(email: '')
|
139
|
+
expect(actual).to eq('')
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'creates blocks instance' do
|
143
|
+
actual = SendGrid4r::REST::Blocks.create_blocks(blocks)
|
144
|
+
expect(actual).to be_a(Array)
|
145
|
+
actual.each do |subuser|
|
146
|
+
expect(subuser).to be_a(SendGrid4r::REST::Blocks::Block)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'creates block instance' do
|
151
|
+
actual = SendGrid4r::REST::Blocks.create_block(block)
|
152
|
+
expect(actual).to be_a(SendGrid4r::REST::Blocks::Block)
|
153
|
+
expect(actual.created).to eq(Time.at(1443651154))
|
154
|
+
expect(actual.email).to eq('user1@example.com')
|
155
|
+
expect(actual.reason).to eq(
|
156
|
+
'error dialing remote address: dial tcp '\
|
157
|
+
'10.57.152.165:25: no route to host'
|
158
|
+
)
|
159
|
+
expect(actual.status).to eq('4.0.0')
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
|
4
|
+
describe SendGrid4r::REST::InvalidEmails do
|
5
|
+
describe 'integration test', :it do
|
6
|
+
before do
|
7
|
+
begin
|
8
|
+
Dotenv.load
|
9
|
+
@client = SendGrid4r::Client.new(api_key: ENV['SILVER_API_KEY'])
|
10
|
+
@emails = [
|
11
|
+
'a1@invalid_email.com', 'a2@invalid_email.com', 'a3@invalid_email.com'
|
12
|
+
]
|
13
|
+
rescue RestClient::ExceptionWithResponse => e
|
14
|
+
puts e.inspect
|
15
|
+
raise e
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'without block call' do
|
20
|
+
it '#get_invalid_emails' do
|
21
|
+
begin
|
22
|
+
start_time = Time.now - 60 * 60 * 24 * 365
|
23
|
+
end_time = Time.now
|
24
|
+
invalid_emails = @client.get_invalid_emails(
|
25
|
+
start_time: start_time, end_time: end_time
|
26
|
+
)
|
27
|
+
expect(invalid_emails).to be_a(Array)
|
28
|
+
invalid_emails.each do |invalid_email|
|
29
|
+
expect(invalid_email).to be_a(
|
30
|
+
SendGrid4r::REST::InvalidEmails::InvalidEmail
|
31
|
+
)
|
32
|
+
end
|
33
|
+
rescue RestClient::ExceptionWithResponse => e
|
34
|
+
puts e.inspect
|
35
|
+
raise e
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it '#delete_invalid_emails(delete_all: true)' do
|
40
|
+
begin
|
41
|
+
@client.delete_invalid_emails(delete_all: true)
|
42
|
+
rescue RestClient::ExceptionWithResponse => e
|
43
|
+
puts e.inspect
|
44
|
+
raise e
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it '#delete_invalid_emails(emails: [])' do
|
49
|
+
begin
|
50
|
+
@client.delete_invalid_emails(emails: @emails)
|
51
|
+
rescue RestClient::ExceptionWithResponse => e
|
52
|
+
puts e.inspect
|
53
|
+
raise e
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it '#get_invalid_email' do
|
58
|
+
begin
|
59
|
+
invalid_email = @client.get_invalid_email(email: @email)
|
60
|
+
expect(invalid_email).to be_a(Array)
|
61
|
+
rescue RestClient::ExceptionWithResponse => e
|
62
|
+
puts e.inspect
|
63
|
+
raise e
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it '#delete_invalid_email' do
|
68
|
+
begin
|
69
|
+
expect do
|
70
|
+
@client.delete_invalid_email(email: 'a1@invalid_email.com')
|
71
|
+
end.to raise_error(RestClient::ResourceNotFound)
|
72
|
+
rescue RestClient::ExceptionWithResponse => e
|
73
|
+
puts e.inspect
|
74
|
+
raise e
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe 'unit test', :ut do
|
81
|
+
let(:client) do
|
82
|
+
SendGrid4r::Client.new(api_key: '')
|
83
|
+
end
|
84
|
+
|
85
|
+
let(:invalid_emails) do
|
86
|
+
JSON.parse(
|
87
|
+
'['\
|
88
|
+
'{'\
|
89
|
+
'"created": 1449953655,'\
|
90
|
+
'"email": "user1@example.com",'\
|
91
|
+
'"reason": "Mail domain mentioned in email address is unknown"'\
|
92
|
+
'},'\
|
93
|
+
'{'\
|
94
|
+
'"created": 1449939373,'\
|
95
|
+
'"email": "user1@example.com",'\
|
96
|
+
'"reason": "Mail domain mentioned in email address is unknown"'\
|
97
|
+
'}'\
|
98
|
+
']'
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
let(:invalid_email) do
|
103
|
+
JSON.parse(
|
104
|
+
'{'\
|
105
|
+
'"created": 1454433146,'\
|
106
|
+
'"email": "test1@example.com",'\
|
107
|
+
'"reason": "Mail domain mentioned in email address is unknown"'\
|
108
|
+
'}'\
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
112
|
+
it '#get_invalid_emails' do
|
113
|
+
allow(client).to receive(:execute).and_return(invalid_emails)
|
114
|
+
actual = client.get_invalid_emails
|
115
|
+
expect(actual).to be_a(Array)
|
116
|
+
actual.each do |invalid_email|
|
117
|
+
expect(invalid_email).to be_a(
|
118
|
+
SendGrid4r::REST::InvalidEmails::InvalidEmail
|
119
|
+
)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
it '#delete_invalid_emails(delete_all: true)' do
|
124
|
+
allow(client).to receive(:execute).and_return('')
|
125
|
+
client.delete_invalid_emails(delete_all: true)
|
126
|
+
end
|
127
|
+
|
128
|
+
it '#delete_invalid_emails(emails: [])' do
|
129
|
+
allow(client).to receive(:execute).and_return('')
|
130
|
+
actual = client.delete_invalid_emails(emails: [])
|
131
|
+
expect(actual).to eq('')
|
132
|
+
end
|
133
|
+
|
134
|
+
it '#get_invalid_email' do
|
135
|
+
allow(client).to receive(:execute).and_return(invalid_emails)
|
136
|
+
actual = client.get_invalid_email(email: '')
|
137
|
+
expect(actual).to be_a(Array)
|
138
|
+
actual.each do |invalid_email|
|
139
|
+
expect(invalid_email).to be_a(
|
140
|
+
SendGrid4r::REST::InvalidEmails::InvalidEmail
|
141
|
+
)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
it '#delete_invalid_email' do
|
146
|
+
allow(client).to receive(:execute).and_return('')
|
147
|
+
actual = client.delete_invalid_email(email: '')
|
148
|
+
expect(actual).to eq('')
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'creates invalid_emails instance' do
|
152
|
+
actual = SendGrid4r::REST::InvalidEmails.create_invalid_emails(
|
153
|
+
invalid_emails
|
154
|
+
)
|
155
|
+
expect(actual).to be_a(Array)
|
156
|
+
actual.each do |subuser|
|
157
|
+
expect(subuser).to be_a(SendGrid4r::REST::InvalidEmails::InvalidEmail)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'creates invalid_email instance' do
|
162
|
+
actual = SendGrid4r::REST::InvalidEmails.create_invalid_email(
|
163
|
+
invalid_email
|
164
|
+
)
|
165
|
+
expect(actual).to be_a(SendGrid4r::REST::InvalidEmails::InvalidEmail)
|
166
|
+
expect(actual.created).to eq(Time.at(1454433146))
|
167
|
+
expect(actual.email).to eq('test1@example.com')
|
168
|
+
expect(actual.reason).to eq(
|
169
|
+
'Mail domain mentioned in email address is unknown'
|
170
|
+
)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
3
3
|
|
4
|
-
describe SendGrid4r::REST::
|
4
|
+
describe SendGrid4r::REST::Sm::GlobalUnsubscribes do
|
5
5
|
describe 'integration test', :it do
|
6
6
|
before do
|
7
7
|
begin
|
@@ -39,6 +39,21 @@ describe SendGrid4r::REST::Asm::GlobalSuppressions do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'without block call' do
|
42
|
+
it '#get_global_unsubscribes' do
|
43
|
+
begin
|
44
|
+
global_unsubscribes = @client.get_global_unsubscribes
|
45
|
+
expect(global_unsubscribes).to be_a(Array)
|
46
|
+
global_unsubscribes.each do |global_unsubscribe|
|
47
|
+
expect(global_unsubscribe).to be_a(
|
48
|
+
SendGrid4r::REST::Sm::GlobalUnsubscribes::Unsubscribe
|
49
|
+
)
|
50
|
+
end
|
51
|
+
rescue RestClient::ExceptionWithResponse => e
|
52
|
+
puts e.inspect
|
53
|
+
raise e
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
42
57
|
it '#post_global_suppressed_emails' do
|
43
58
|
begin
|
44
59
|
emails = @client.post_global_suppressed_emails(
|
@@ -115,13 +130,13 @@ describe SendGrid4r::REST::Asm::GlobalSuppressions do
|
|
115
130
|
it '#post_global_suppressed_emails' do
|
116
131
|
allow(client).to receive(:execute).and_return(recipient_emails)
|
117
132
|
emails = client.post_global_suppressed_emails(recipient_emails: [])
|
118
|
-
expect(emails).to be_a(SendGrid4r::REST::
|
133
|
+
expect(emails).to be_a(SendGrid4r::REST::Sm::RecipientEmails)
|
119
134
|
end
|
120
135
|
|
121
136
|
it '#get_global_suppressed_email' do
|
122
137
|
allow(client).to receive(:execute).and_return(recipient_email)
|
123
138
|
actual = client.get_global_suppressed_email(email_address: '')
|
124
|
-
expect(actual).to be_a(SendGrid4r::REST::
|
139
|
+
expect(actual).to be_a(SendGrid4r::REST::Sm::RecipientEmail)
|
125
140
|
end
|
126
141
|
|
127
142
|
it '#delete_global_suppressed_email' do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
3
3
|
|
4
|
-
describe SendGrid4r::REST::
|
4
|
+
describe SendGrid4r::REST::Sm::Groups do
|
5
5
|
describe 'integration test', :it do
|
6
6
|
before do
|
7
7
|
begin
|
@@ -69,7 +69,7 @@ describe SendGrid4r::REST::Asm::Groups do
|
|
69
69
|
groups = @client.get_groups
|
70
70
|
expect(groups).to be_a(Array)
|
71
71
|
groups.each do |group|
|
72
|
-
expect(group).to be_a(SendGrid4r::REST::
|
72
|
+
expect(group).to be_a(SendGrid4r::REST::Sm::Groups::Group)
|
73
73
|
end
|
74
74
|
rescue RestClient::ExceptionWithResponse => e
|
75
75
|
puts e.inspect
|
@@ -162,13 +162,13 @@ describe SendGrid4r::REST::Asm::Groups do
|
|
162
162
|
it '#post_group' do
|
163
163
|
allow(client).to receive(:execute).and_return(group)
|
164
164
|
actual = client.post_group(name: '', description: '')
|
165
|
-
expect(actual).to be_a(SendGrid4r::REST::
|
165
|
+
expect(actual).to be_a(SendGrid4r::REST::Sm::Groups::Group)
|
166
166
|
end
|
167
167
|
|
168
168
|
it '#patch_group' do
|
169
169
|
allow(client).to receive(:execute).and_return(group)
|
170
170
|
actual = client.patch_group(group_id: 0, group: nil)
|
171
|
-
expect(actual).to be_a(SendGrid4r::REST::
|
171
|
+
expect(actual).to be_a(SendGrid4r::REST::Sm::Groups::Group)
|
172
172
|
end
|
173
173
|
|
174
174
|
it '#get_groups' do
|
@@ -176,14 +176,14 @@ describe SendGrid4r::REST::Asm::Groups do
|
|
176
176
|
actual = client.get_groups
|
177
177
|
expect(actual).to be_a(Array)
|
178
178
|
actual.each do |group|
|
179
|
-
expect(group).to be_a(SendGrid4r::REST::
|
179
|
+
expect(group).to be_a(SendGrid4r::REST::Sm::Groups::Group)
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
183
|
it '#get_group' do
|
184
184
|
allow(client).to receive(:execute).and_return(group)
|
185
185
|
actual = client.get_group(group_id: 0)
|
186
|
-
expect(actual).to be_a(SendGrid4r::REST::
|
186
|
+
expect(actual).to be_a(SendGrid4r::REST::Sm::Groups::Group)
|
187
187
|
end
|
188
188
|
|
189
189
|
it '#delete_group' do
|
@@ -193,9 +193,9 @@ describe SendGrid4r::REST::Asm::Groups do
|
|
193
193
|
end
|
194
194
|
|
195
195
|
it 'creates group instance' do
|
196
|
-
actual = SendGrid4r::REST::
|
196
|
+
actual = SendGrid4r::REST::Sm::Groups.create_group(group)
|
197
197
|
expect(actual).to be_a(
|
198
|
-
SendGrid4r::REST::
|
198
|
+
SendGrid4r::REST::Sm::Groups::Group
|
199
199
|
)
|
200
200
|
expect(actual.id).to eq(100)
|
201
201
|
expect(actual.name).to eq('Newsletters')
|
@@ -206,10 +206,10 @@ describe SendGrid4r::REST::Asm::Groups do
|
|
206
206
|
end
|
207
207
|
|
208
208
|
it 'creates groups instance' do
|
209
|
-
actual = SendGrid4r::REST::
|
209
|
+
actual = SendGrid4r::REST::Sm::Groups.create_groups(groups)
|
210
210
|
expect(actual).to be_a(Array)
|
211
211
|
actual.each do |group|
|
212
|
-
expect(group).to be_a(SendGrid4r::REST::
|
212
|
+
expect(group).to be_a(SendGrid4r::REST::Sm::Groups::Group)
|
213
213
|
end
|
214
214
|
end
|
215
215
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
3
3
|
|
4
|
-
describe SendGrid4r::REST::
|
4
|
+
describe SendGrid4r::REST::Sm do
|
5
5
|
let(:recipient_email) do
|
6
6
|
JSON.parse(
|
7
7
|
'{'\
|
@@ -23,16 +23,16 @@ describe SendGrid4r::REST::Asm do
|
|
23
23
|
|
24
24
|
describe 'unit test', :ut do
|
25
25
|
it 'creates recipient_emails instance' do
|
26
|
-
actual = SendGrid4r::REST::
|
27
|
-
expect(actual).to be_a(SendGrid4r::REST::
|
26
|
+
actual = SendGrid4r::REST::Sm.create_recipient_emails(recipient_emails)
|
27
|
+
expect(actual).to be_a(SendGrid4r::REST::Sm::RecipientEmails)
|
28
28
|
expect(actual.recipient_emails).to be_a(Array)
|
29
29
|
expect(actual.recipient_emails).to include('test1@example.com')
|
30
30
|
expect(actual.recipient_emails).to include('test2@example.com')
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'creates recipient_email instance' do
|
34
|
-
actual = SendGrid4r::REST::
|
35
|
-
expect(actual).to be_a(SendGrid4r::REST::
|
34
|
+
actual = SendGrid4r::REST::Sm.create_recipient_email(recipient_email)
|
35
|
+
expect(actual).to be_a(SendGrid4r::REST::Sm::RecipientEmail)
|
36
36
|
expect(actual.recipient_email).to eq('test1@example.com')
|
37
37
|
end
|
38
38
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
3
3
|
|
4
|
-
describe SendGrid4r::REST::
|
4
|
+
describe SendGrid4r::REST::Sm::Suppressions do
|
5
5
|
describe 'integration test', :it do
|
6
6
|
before do
|
7
7
|
begin
|
@@ -165,7 +165,7 @@ describe SendGrid4r::REST::Asm::Suppressions do
|
|
165
165
|
actual = client.post_suppressed_emails(
|
166
166
|
group_id: 0, recipient_emails: ['', '']
|
167
167
|
)
|
168
|
-
expect(actual).to be_a(SendGrid4r::REST::
|
168
|
+
expect(actual).to be_a(SendGrid4r::REST::Sm::RecipientEmails)
|
169
169
|
end
|
170
170
|
|
171
171
|
it '#get_suppressed_emails' do
|
@@ -180,7 +180,7 @@ describe SendGrid4r::REST::Asm::Suppressions do
|
|
180
180
|
expect(actual.suppressions).to be_a(Array)
|
181
181
|
actual.suppressions.each do |suppression|
|
182
182
|
expect(suppression).to be_a(
|
183
|
-
SendGrid4r::REST::
|
183
|
+
SendGrid4r::REST::Sm::Suppressions::Suppression
|
184
184
|
)
|
185
185
|
end
|
186
186
|
end
|
@@ -192,11 +192,11 @@ describe SendGrid4r::REST::Asm::Suppressions do
|
|
192
192
|
end
|
193
193
|
|
194
194
|
it 'creates suppression instance' do
|
195
|
-
actual = SendGrid4r::REST::
|
195
|
+
actual = SendGrid4r::REST::Sm::Suppressions.create_suppression(
|
196
196
|
suppression
|
197
197
|
)
|
198
198
|
expect(actual).to be_a(
|
199
|
-
SendGrid4r::REST::
|
199
|
+
SendGrid4r::REST::Sm::Suppressions::Suppression
|
200
200
|
)
|
201
201
|
expect(actual.id).to eq(4)
|
202
202
|
expect(actual.name).to eq('Special Offers')
|
@@ -205,16 +205,16 @@ describe SendGrid4r::REST::Asm::Suppressions do
|
|
205
205
|
end
|
206
206
|
|
207
207
|
it 'creates suppressions instance' do
|
208
|
-
actual = SendGrid4r::REST::
|
208
|
+
actual = SendGrid4r::REST::Sm::Suppressions.create_suppressions(
|
209
209
|
suppressions
|
210
210
|
)
|
211
211
|
expect(actual).to be_a(
|
212
|
-
SendGrid4r::REST::
|
212
|
+
SendGrid4r::REST::Sm::Suppressions::Suppressions
|
213
213
|
)
|
214
214
|
expect(actual.suppressions).to be_a(Array)
|
215
215
|
actual.suppressions.each do |suppression|
|
216
216
|
expect(suppression).to be_a(
|
217
|
-
SendGrid4r::REST::
|
217
|
+
SendGrid4r::REST::Sm::Suppressions::Suppression
|
218
218
|
)
|
219
219
|
end
|
220
220
|
end
|