sendgrid4r 1.8.1 → 1.10.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/.rubocop.yml +6 -2
- data/README.md +1 -0
- data/lib/sendgrid4r/factory/campaign_factory.rb +18 -5
- data/lib/sendgrid4r/factory/condition_factory.rb +1 -1
- data/lib/sendgrid4r/factory/mail_factory.rb +57 -0
- data/lib/sendgrid4r/factory/segment_factory.rb +2 -5
- data/lib/sendgrid4r/factory/version_factory.rb +1 -1
- data/lib/sendgrid4r/rest/api.rb +48 -49
- data/lib/sendgrid4r/rest/api_keys_management/api_keys.rb +75 -0
- data/lib/sendgrid4r/rest/api_keys_management/permissions.rb +31 -0
- data/lib/sendgrid4r/rest/blocks.rb +49 -68
- data/lib/sendgrid4r/rest/bounces.rb +45 -64
- data/lib/sendgrid4r/rest/cancel_scheduled_sends.rb +53 -72
- data/lib/sendgrid4r/rest/categories.rb +31 -0
- data/lib/sendgrid4r/rest/email_activity.rb +72 -0
- data/lib/sendgrid4r/rest/invalid_emails.rb +50 -68
- data/lib/sendgrid4r/rest/ip_access_management.rb +86 -111
- data/lib/sendgrid4r/rest/ips/addresses.rb +50 -59
- data/lib/sendgrid4r/rest/ips/pools.rb +42 -53
- data/lib/sendgrid4r/rest/ips/warmup.rb +46 -55
- data/lib/sendgrid4r/rest/mail/address.rb +14 -0
- data/lib/sendgrid4r/rest/mail/attachment.rb +22 -0
- data/lib/sendgrid4r/rest/mail/content.rb +10 -0
- data/lib/sendgrid4r/rest/mail/mail.rb +28 -0
- data/lib/sendgrid4r/rest/mail/mail_settings.rb +62 -0
- data/lib/sendgrid4r/rest/mail/params.rb +64 -0
- data/lib/sendgrid4r/rest/mail/personalization.rb +33 -0
- data/lib/sendgrid4r/rest/mail/tracking_settings.rb +74 -0
- data/lib/sendgrid4r/rest/{contacts → marketing_campaigns/contacts}/custom_fields.rb +12 -27
- data/lib/sendgrid4r/rest/{contacts → marketing_campaigns/contacts}/lists.rb +20 -34
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/recipients.rb +134 -0
- data/lib/sendgrid4r/rest/{contacts → marketing_campaigns/contacts}/reserved_fields.rb +6 -9
- data/lib/sendgrid4r/rest/marketing_campaigns/contacts/segments.rb +86 -0
- data/lib/sendgrid4r/rest/marketing_campaigns/marketing_campaigns.rb +119 -0
- data/lib/sendgrid4r/rest/marketing_campaigns/senders.rb +101 -0
- data/lib/sendgrid4r/rest/request.rb +61 -63
- data/lib/sendgrid4r/rest/settings/enforced_tls.rb +23 -26
- data/lib/sendgrid4r/rest/settings/mail.rb +167 -183
- data/lib/sendgrid4r/rest/settings/partner.rb +33 -36
- data/lib/sendgrid4r/rest/settings/settings.rb +17 -22
- data/lib/sendgrid4r/rest/settings/tracking.rb +97 -107
- data/lib/sendgrid4r/rest/sm/global_unsubscribes.rb +52 -60
- data/lib/sendgrid4r/rest/sm/groups.rb +52 -58
- data/lib/sendgrid4r/rest/sm/sm.rb +15 -17
- data/lib/sendgrid4r/rest/sm/suppressions.rb +50 -67
- data/lib/sendgrid4r/rest/spam_reports.rb +49 -69
- data/lib/sendgrid4r/rest/stats/advanced.rb +100 -102
- data/lib/sendgrid4r/rest/stats/category.rb +31 -33
- data/lib/sendgrid4r/rest/stats/global.rb +17 -19
- data/lib/sendgrid4r/rest/stats/parse.rb +18 -20
- data/lib/sendgrid4r/rest/stats/stats.rb +59 -69
- data/lib/sendgrid4r/rest/stats/subuser.rb +70 -32
- data/lib/sendgrid4r/rest/subusers.rb +106 -134
- data/lib/sendgrid4r/rest/transactional_templates/templates.rb +63 -0
- data/lib/sendgrid4r/rest/transactional_templates/versions.rb +90 -0
- data/lib/sendgrid4r/rest/users.rb +125 -57
- data/lib/sendgrid4r/rest/webhooks/event.rb +36 -42
- data/lib/sendgrid4r/rest/webhooks/parse.rb +28 -37
- data/lib/sendgrid4r/rest/whitelabel/domains.rb +176 -222
- data/lib/sendgrid4r/rest/whitelabel/ips.rb +107 -128
- data/lib/sendgrid4r/rest/whitelabel/links.rb +131 -167
- data/lib/sendgrid4r/version.rb +1 -1
- data/lib/sendgrid4r.rb +23 -13
- data/sendgrid4r.gemspec +1 -1
- data/spec/client_spec.rb +12 -1
- data/spec/factory/campaign_factory_spec.rb +75 -35
- data/spec/factory/condition_factory_spec.rb +19 -18
- data/spec/factory/segment_factory_spec.rb +28 -21
- data/spec/factory/version_factory_spec.rb +28 -27
- data/spec/photo.jpg +0 -0
- data/spec/rest/api_keys_management/api_keys_spec.rb +174 -0
- data/spec/rest/api_keys_management/permissions_spec.rb +54 -0
- data/spec/rest/blocks_spec.rb +78 -106
- data/spec/rest/bounces_spec.rb +91 -118
- data/spec/rest/cancel_scheduled_sends_spec.rb +94 -149
- data/spec/rest/categories_spec.rb +77 -0
- data/spec/rest/email_activity_spec.rb +151 -0
- data/spec/rest/invalid_emails_spec.rb +85 -119
- data/spec/rest/ip_access_management_spec.rb +157 -195
- data/spec/rest/ips/addresses_spec.rb +94 -122
- data/spec/rest/ips/pools_spec.rb +84 -112
- data/spec/rest/ips/warmup_spec.rb +63 -71
- data/spec/rest/mail/address_spec.rb +28 -0
- data/spec/rest/mail/attachment_spec.rb +48 -0
- data/spec/rest/mail/content_spec.rb +32 -0
- data/spec/rest/mail/mail_settings_spec.rb +51 -0
- data/spec/rest/mail/mail_spec.rb +136 -0
- data/spec/rest/mail/params_spec.rb +152 -0
- data/spec/rest/mail/personalization_spec.rb +66 -0
- data/spec/rest/mail/tracking_settings_spec.rb +63 -0
- data/spec/rest/marketing_campaigns/contacts/custom_fields_spec.rb +146 -0
- data/spec/rest/marketing_campaigns/contacts/lists_spec.rb +307 -0
- data/spec/rest/marketing_campaigns/contacts/recipients_spec.rb +331 -0
- data/spec/rest/marketing_campaigns/contacts/reserved_fields_spec.rb +119 -0
- data/spec/rest/marketing_campaigns/contacts/segments_spec.rb +268 -0
- data/spec/rest/marketing_campaigns/marketing_campaigns_spec.rb +427 -0
- data/spec/rest/marketing_campaigns/senders_spec.rb +230 -0
- data/spec/rest/settings/enforced_tls_spec.rb +38 -54
- data/spec/rest/settings/mail_spec.rb +227 -330
- data/spec/rest/settings/partner_spec.rb +40 -59
- data/spec/rest/settings/settings_spec.rb +44 -42
- data/spec/rest/settings/tracking_spec.rb +130 -189
- data/spec/rest/sm/global_unsubscribes_spec.rb +47 -72
- data/spec/rest/sm/groups_spec.rb +88 -123
- data/spec/rest/sm/sm_spec.rb +32 -30
- data/spec/rest/sm/suppressions_spec.rb +105 -140
- data/spec/rest/spam_reports_spec.rb +81 -109
- data/spec/rest/stats/advanced_spec.rb +67 -125
- data/spec/rest/stats/category_spec.rb +27 -45
- data/spec/rest/stats/global_spec.rb +34 -42
- data/spec/rest/stats/parse_spec.rb +32 -30
- data/spec/rest/stats/stats_spec.rb +174 -172
- data/spec/rest/stats/subuser_spec.rb +97 -57
- data/spec/rest/subusers_spec.rb +156 -209
- data/spec/rest/transactional_templates/templates_spec.rb +199 -0
- data/spec/rest/transactional_templates/versions_spec.rb +228 -0
- data/spec/rest/users_spec.rb +176 -91
- data/spec/rest/webhooks/event_spec.rb +59 -85
- data/spec/rest/webhooks/parse_spec.rb +51 -71
- data/spec/rest/whitelabel/domains_spec.rb +333 -513
- data/spec/rest/whitelabel/ips_spec.rb +109 -147
- data/spec/rest/whitelabel/links_spec.rb +181 -265
- metadata +70 -40
- data/lib/sendgrid4r/rest/api_keys/api_keys.rb +0 -80
- data/lib/sendgrid4r/rest/api_keys/permissions.rb +0 -33
- data/lib/sendgrid4r/rest/campaigns/campaigns.rb +0 -126
- data/lib/sendgrid4r/rest/categories/categories.rb +0 -43
- data/lib/sendgrid4r/rest/contacts/recipients.rb +0 -150
- data/lib/sendgrid4r/rest/contacts/segments.rb +0 -97
- data/lib/sendgrid4r/rest/email_activity/email_activity.rb +0 -81
- data/lib/sendgrid4r/rest/templates/templates.rb +0 -69
- data/lib/sendgrid4r/rest/templates/versions.rb +0 -95
- data/spec/rest/api_keys/api_keys_spec.rb +0 -210
- data/spec/rest/api_keys/permissions_spec.rb +0 -65
- data/spec/rest/campaigns/campaigns_spec.rb +0 -492
- data/spec/rest/categories/categories_spec.rb +0 -96
- data/spec/rest/contacts/custom_fields_spec.rb +0 -174
- data/spec/rest/contacts/lists_spec.rb +0 -372
- data/spec/rest/contacts/recipients_spec.rb +0 -343
- data/spec/rest/contacts/reserved_fields_spec.rb +0 -146
- data/spec/rest/contacts/segments_spec.rb +0 -307
- data/spec/rest/email_activity/email_activity_spec.rb +0 -179
- data/spec/rest/templates/templates_spec.rb +0 -222
- data/spec/rest/templates/versions_spec.rb +0 -252
data/spec/rest/blocks_spec.rb
CHANGED
@@ -1,22 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require File.dirname(__FILE__) + '/../spec_helper'
|
3
3
|
|
4
|
-
|
5
|
-
describe
|
6
|
-
|
7
|
-
|
4
|
+
module SendGrid4r::REST
|
5
|
+
describe Blocks do
|
6
|
+
describe 'integration test', :it do
|
7
|
+
before do
|
8
8
|
Dotenv.load
|
9
9
|
@client = SendGrid4r::Client.new(api_key: ENV['SILVER_API_KEY'])
|
10
10
|
@emails = ['a1@block.com', 'a2@block.com', 'a3@block.com']
|
11
|
-
rescue RestClient::ExceptionWithResponse => e
|
12
|
-
puts e.inspect
|
13
|
-
raise e
|
14
11
|
end
|
15
|
-
end
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
begin
|
13
|
+
context 'without block call' do
|
14
|
+
it '#get_blocks' do
|
20
15
|
start_time = Time.now - 60 * 60 * 24 * 365
|
21
16
|
end_time = Time.now
|
22
17
|
blocks = @client.get_blocks(
|
@@ -24,63 +19,52 @@ describe SendGrid4r::REST::Blocks do
|
|
24
19
|
)
|
25
20
|
expect(blocks).to be_a(Array)
|
26
21
|
blocks.each do |block|
|
27
|
-
expect(block).to be_a(
|
22
|
+
expect(block).to be_a(Blocks::Block)
|
28
23
|
end
|
29
|
-
rescue RestClient::ExceptionWithResponse => e
|
30
|
-
puts e.inspect
|
31
|
-
raise e
|
32
24
|
end
|
33
|
-
end
|
34
25
|
|
35
|
-
|
36
|
-
begin
|
26
|
+
it '#delete_blocks(delete_all: true)' do
|
37
27
|
@client.delete_blocks(delete_all: true)
|
38
|
-
rescue RestClient::ExceptionWithResponse => e
|
39
|
-
puts e.inspect
|
40
|
-
raise e
|
41
28
|
end
|
42
|
-
end
|
43
29
|
|
44
|
-
|
45
|
-
begin
|
30
|
+
it '#delete_blocks(emails: [])' do
|
46
31
|
@client.delete_blocks(emails: @emails)
|
47
|
-
rescue RestClient::ExceptionWithResponse => e
|
48
|
-
puts e.inspect
|
49
|
-
raise e
|
50
32
|
end
|
51
|
-
end
|
52
33
|
|
53
|
-
|
54
|
-
begin
|
34
|
+
it '#get_block' do
|
55
35
|
block = @client.get_block(email: @email)
|
56
36
|
expect(block).to be_a(Array)
|
57
|
-
rescue RestClient::ExceptionWithResponse => e
|
58
|
-
puts e.inspect
|
59
|
-
raise e
|
60
37
|
end
|
61
|
-
end
|
62
38
|
|
63
|
-
|
64
|
-
begin
|
39
|
+
it '#delete_block' do
|
65
40
|
expect do
|
66
41
|
@client.delete_block(email: 'a1@block.com')
|
67
42
|
end.to raise_error(RestClient::ResourceNotFound)
|
68
|
-
rescue RestClient::ExceptionWithResponse => e
|
69
|
-
puts e.inspect
|
70
|
-
raise e
|
71
43
|
end
|
72
44
|
end
|
73
45
|
end
|
74
|
-
end
|
75
46
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
47
|
+
describe 'unit test', :ut do
|
48
|
+
let(:client) do
|
49
|
+
SendGrid4r::Client.new(api_key: '')
|
50
|
+
end
|
51
|
+
|
52
|
+
let(:blocks) do
|
53
|
+
JSON.parse(
|
54
|
+
'['\
|
55
|
+
'{'\
|
56
|
+
'"created": 1443651154,'\
|
57
|
+
'"email": "user1@example.com",'\
|
58
|
+
'"reason": "error dialing remote address: dial tcp '\
|
59
|
+
'10.57.152.165:25: no route to host",'\
|
60
|
+
'"status": "4.0.0"'\
|
61
|
+
'}'\
|
62
|
+
']'
|
63
|
+
)
|
64
|
+
end
|
80
65
|
|
81
|
-
|
82
|
-
|
83
|
-
'['\
|
66
|
+
let(:block) do
|
67
|
+
JSON.parse(
|
84
68
|
'{'\
|
85
69
|
'"created": 1443651154,'\
|
86
70
|
'"email": "user1@example.com",'\
|
@@ -88,75 +72,63 @@ describe SendGrid4r::REST::Blocks do
|
|
88
72
|
'10.57.152.165:25: no route to host",'\
|
89
73
|
'"status": "4.0.0"'\
|
90
74
|
'}'\
|
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
|
75
|
+
)
|
76
|
+
end
|
106
77
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
78
|
+
it '#get_blocks' do
|
79
|
+
allow(client).to receive(:execute).and_return(blocks)
|
80
|
+
actual = client.get_blocks
|
81
|
+
expect(actual).to be_a(Array)
|
82
|
+
actual.each do |block|
|
83
|
+
expect(block).to be_a(Blocks::Block)
|
84
|
+
end
|
113
85
|
end
|
114
|
-
end
|
115
86
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
87
|
+
it '#delete_blocks(delete_all: true)' do
|
88
|
+
allow(client).to receive(:execute).and_return('')
|
89
|
+
client.delete_blocks(delete_all: true)
|
90
|
+
end
|
120
91
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
92
|
+
it '#delete_blocks(emails: [])' do
|
93
|
+
allow(client).to receive(:execute).and_return('')
|
94
|
+
actual = client.delete_blocks(emails: [])
|
95
|
+
expect(actual).to eq('')
|
96
|
+
end
|
126
97
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
98
|
+
it '#get_block' do
|
99
|
+
allow(client).to receive(:execute).and_return(blocks)
|
100
|
+
actual = client.get_block(email: '')
|
101
|
+
expect(actual).to be_a(Array)
|
102
|
+
actual.each do |block|
|
103
|
+
expect(block).to be_a(Blocks::Block)
|
104
|
+
end
|
133
105
|
end
|
134
|
-
end
|
135
106
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
107
|
+
it '#delete_block' do
|
108
|
+
allow(client).to receive(:execute).and_return('')
|
109
|
+
actual = client.delete_block(email: '')
|
110
|
+
expect(actual).to eq('')
|
111
|
+
end
|
141
112
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
113
|
+
it 'creates blocks instance' do
|
114
|
+
actual = Blocks.create_blocks(blocks)
|
115
|
+
expect(actual).to be_a(Array)
|
116
|
+
actual.each do |subuser|
|
117
|
+
expect(subuser).to be_a(Blocks::Block)
|
118
|
+
end
|
147
119
|
end
|
148
|
-
end
|
149
120
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
121
|
+
it 'creates block instance' do
|
122
|
+
actual = Blocks.create_block(block)
|
123
|
+
expect(actual).to be_a(Blocks::Block)
|
124
|
+
expect(actual.created).to eq(Time.at(1443651154))
|
125
|
+
expect(actual.email).to eq('user1@example.com')
|
126
|
+
expect(actual.reason).to eq(
|
127
|
+
'error dialing remote address: dial tcp '\
|
128
|
+
'10.57.152.165:25: no route to host'
|
129
|
+
)
|
130
|
+
expect(actual.status).to eq('4.0.0')
|
131
|
+
end
|
160
132
|
end
|
161
133
|
end
|
162
134
|
end
|
data/spec/rest/bounces_spec.rb
CHANGED
@@ -1,22 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require File.dirname(__FILE__) + '/../spec_helper'
|
3
3
|
|
4
|
-
|
5
|
-
describe
|
6
|
-
|
7
|
-
|
4
|
+
module SendGrid4r::REST
|
5
|
+
describe Bounces do
|
6
|
+
describe 'integration test', :it do
|
7
|
+
before do
|
8
8
|
Dotenv.load
|
9
9
|
@client = SendGrid4r::Client.new(api_key: ENV['SILVER_API_KEY'])
|
10
10
|
@emails = ['a1@bounce.com', 'a2@bounce.com', 'a3@bounce.com']
|
11
|
-
rescue RestClient::ExceptionWithResponse => e
|
12
|
-
puts e.inspect
|
13
|
-
raise e
|
14
11
|
end
|
15
|
-
end
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
begin
|
13
|
+
context 'without block call' do
|
14
|
+
it '#get_bounces' do
|
20
15
|
start_time = Time.now - 60 * 60 * 24 * 365
|
21
16
|
end_time = Time.now
|
22
17
|
bounces = @client.get_bounces(
|
@@ -24,150 +19,128 @@ describe SendGrid4r::REST::Bounces do
|
|
24
19
|
)
|
25
20
|
expect(bounces).to be_a(Array)
|
26
21
|
bounces.each do |bounce|
|
27
|
-
expect(bounce).to be_a(
|
22
|
+
expect(bounce).to be_a(Bounces::Bounce)
|
28
23
|
end
|
29
|
-
rescue RestClient::ExceptionWithResponse => e
|
30
|
-
puts e.inspect
|
31
|
-
raise e
|
32
24
|
end
|
33
|
-
end
|
34
25
|
|
35
|
-
|
36
|
-
begin
|
26
|
+
it '#delete_bounces(delete_all: true)' do
|
37
27
|
@client.delete_bounces(delete_all: true)
|
38
|
-
rescue RestClient::ExceptionWithResponse => e
|
39
|
-
puts e.inspect
|
40
|
-
raise e
|
41
28
|
end
|
42
|
-
end
|
43
29
|
|
44
|
-
|
45
|
-
begin
|
30
|
+
it '#delete_bounces(emails: [])' do
|
46
31
|
@client.delete_bounces(emails: @emails)
|
47
|
-
rescue RestClient::ExceptionWithResponse => e
|
48
|
-
puts e.inspect
|
49
|
-
raise e
|
50
32
|
end
|
51
|
-
end
|
52
33
|
|
53
|
-
|
54
|
-
begin
|
34
|
+
it '#get_bounce' do
|
55
35
|
bounce = @client.get_bounce(email: @email)
|
56
36
|
expect(bounce).to be_a(Array)
|
57
|
-
rescue RestClient::ExceptionWithResponse => e
|
58
|
-
puts e.inspect
|
59
|
-
raise e
|
60
37
|
end
|
61
|
-
end
|
62
38
|
|
63
|
-
|
64
|
-
begin
|
39
|
+
it '#delete_bounce' do
|
65
40
|
expect do
|
66
41
|
@client.delete_bounce(email: 'a1@bounce.com')
|
67
42
|
end.to raise_error(RestClient::ResourceNotFound)
|
68
|
-
rescue RestClient::ExceptionWithResponse => e
|
69
|
-
puts e.inspect
|
70
|
-
raise e
|
71
43
|
end
|
72
44
|
end
|
73
45
|
end
|
74
|
-
end
|
75
46
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
47
|
+
describe 'unit test', :ut do
|
48
|
+
let(:client) do
|
49
|
+
SendGrid4r::Client.new(api_key: '')
|
50
|
+
end
|
80
51
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
52
|
+
let(:bounces) do
|
53
|
+
JSON.parse(
|
54
|
+
'['\
|
55
|
+
'{'\
|
56
|
+
'"created": 1443651125,'\
|
57
|
+
'"email": "testemail1@test.com",'\
|
58
|
+
'"reason": "550 5.1.1 The email account that you tried to reach '\
|
59
|
+
'does not exist.'\
|
60
|
+
'Please try double-checking the recipient\'s email address for '\
|
61
|
+
'typos or unnecessary spaces. Learn more at '\
|
62
|
+
'https://support.google.com/mail/answer/6596'\
|
63
|
+
'o186si2389584ioe.63 - gsmtp ",'\
|
64
|
+
'"status": "5.1.1"'\
|
65
|
+
'},'\
|
66
|
+
'{'\
|
67
|
+
'"created": 1433800303,'\
|
68
|
+
'"email": "testemail2@testing.com",'\
|
69
|
+
'"reason": "550 5.1.1 <testemail2@testing.com>: '\
|
70
|
+
'Recipient address '\
|
71
|
+
'rejected: User unknown in virtual alias table ",'\
|
72
|
+
'"status": "5.1.1"'\
|
73
|
+
'}'\
|
74
|
+
']'
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
let(:bounce) do
|
79
|
+
JSON.parse(
|
95
80
|
'{'\
|
96
81
|
'"created": 1433800303,'\
|
97
82
|
'"email": "testemail2@testing.com",'\
|
98
83
|
'"reason": "550 5.1.1 <testemail2@testing.com>: Recipient address '\
|
99
84
|
'rejected: User unknown in virtual alias table ",'\
|
100
85
|
'"status": "5.1.1"'\
|
101
|
-
'}'
|
102
|
-
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
let(:bounce) do
|
107
|
-
JSON.parse(
|
108
|
-
'{'\
|
109
|
-
'"created": 1433800303,'\
|
110
|
-
'"email": "testemail2@testing.com",'\
|
111
|
-
'"reason": "550 5.1.1 <testemail2@testing.com>: Recipient address '\
|
112
|
-
'rejected: User unknown in virtual alias table ",'\
|
113
|
-
'"status": "5.1.1"'\
|
114
|
-
'}'
|
115
|
-
)
|
116
|
-
end
|
86
|
+
'}'
|
87
|
+
)
|
88
|
+
end
|
117
89
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
90
|
+
it '#get_bounces' do
|
91
|
+
allow(client).to receive(:execute).and_return(bounces)
|
92
|
+
actual = client.get_bounces
|
93
|
+
expect(actual).to be_a(Array)
|
94
|
+
actual.each do |bounce|
|
95
|
+
expect(bounce).to be_a(Bounces::Bounce)
|
96
|
+
end
|
124
97
|
end
|
125
|
-
end
|
126
98
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
99
|
+
it '#delete_bounces(delete_all: true)' do
|
100
|
+
allow(client).to receive(:execute).and_return('')
|
101
|
+
client.delete_bounces(delete_all: true)
|
102
|
+
end
|
131
103
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
104
|
+
it '#delete_bounces(emails: [])' do
|
105
|
+
allow(client).to receive(:execute).and_return('')
|
106
|
+
actual = client.delete_bounces(emails: [])
|
107
|
+
expect(actual).to eq('')
|
108
|
+
end
|
137
109
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
110
|
+
it '#get_bounce' do
|
111
|
+
allow(client).to receive(:execute).and_return(bounces)
|
112
|
+
actual = client.get_bounce(email: '')
|
113
|
+
expect(actual).to be_a(Array)
|
114
|
+
actual.each do |bounce|
|
115
|
+
expect(bounce).to be_a(Bounces::Bounce)
|
116
|
+
end
|
144
117
|
end
|
145
|
-
end
|
146
118
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
119
|
+
it '#delete_bounce' do
|
120
|
+
allow(client).to receive(:execute).and_return('')
|
121
|
+
actual = client.delete_bounce(email: '')
|
122
|
+
expect(actual).to eq('')
|
123
|
+
end
|
152
124
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
125
|
+
it 'creates bounces instance' do
|
126
|
+
actual = Bounces.create_bounces(bounces)
|
127
|
+
expect(actual).to be_a(Array)
|
128
|
+
actual.each do |subuser|
|
129
|
+
expect(subuser).to be_a(Bounces::Bounce)
|
130
|
+
end
|
158
131
|
end
|
159
|
-
end
|
160
132
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
133
|
+
it 'creates bounce instance' do
|
134
|
+
actual = Bounces.create_bounce(bounce)
|
135
|
+
expect(actual).to be_a(Bounces::Bounce)
|
136
|
+
expect(actual.created).to eq(Time.at(1433800303))
|
137
|
+
expect(actual.email).to eq('testemail2@testing.com')
|
138
|
+
expect(actual.reason).to eq(
|
139
|
+
'550 5.1.1 <testemail2@testing.com>: '\
|
140
|
+
'Recipient address rejected: User unknown in virtual alias table '
|
141
|
+
)
|
142
|
+
expect(actual.status).to eq('5.1.1')
|
143
|
+
end
|
171
144
|
end
|
172
145
|
end
|
173
146
|
end
|