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
@@ -1,16 +1,16 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
3
3
|
|
4
|
-
|
5
|
-
describe
|
6
|
-
|
7
|
-
|
4
|
+
module SendGrid4r::REST::Whitelabel
|
5
|
+
describe Links 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
|
@subdomain_name = ENV['SUBDOMAIN_LINK']
|
11
11
|
@domain_name = ENV['DOMAIN']
|
12
12
|
@username = ENV['USERNAME']
|
13
|
-
@
|
13
|
+
@subuser = ENV['SUBUSER']
|
14
14
|
@email1 = ENV['MAIL']
|
15
15
|
@password1 = ENV['PASS']
|
16
16
|
@ip = @client.get_ips[0].ip
|
@@ -45,42 +45,30 @@ describe SendGrid4r::REST::Whitelabel::Links do
|
|
45
45
|
)
|
46
46
|
# create a subuser
|
47
47
|
subusers = @client.get_subusers
|
48
|
-
count = subusers.count { |subuser| subuser.username == @
|
49
|
-
@client.delete_subuser(username: @
|
48
|
+
count = subusers.count { |subuser| subuser.username == @subuser }
|
49
|
+
@client.delete_subuser(username: @subuser) if count == 1
|
50
50
|
@client.post_subuser(
|
51
|
-
username: @
|
51
|
+
username: @subuser,
|
52
52
|
email: @email1,
|
53
53
|
password: @password1,
|
54
54
|
ips: [@ip]
|
55
55
|
)
|
56
|
-
rescue RestClient::ExceptionWithResponse => e
|
57
|
-
puts e.inspect
|
58
|
-
raise e
|
59
56
|
end
|
60
|
-
end
|
61
57
|
|
62
|
-
|
63
|
-
|
64
|
-
begin
|
58
|
+
context 'without block call' do
|
59
|
+
it '#get_wl_links' do
|
65
60
|
links = @client.get_wl_links(
|
66
61
|
limit: 100, offset: 0,
|
67
62
|
exclude_subusers: true, username: 'somebody', domain: 'example.com'
|
68
63
|
)
|
69
64
|
expect(links).to be_a(Array)
|
70
65
|
links.each do |link|
|
71
|
-
expect(link).to be_a(
|
72
|
-
SendGrid4r::REST::Whitelabel::Links::Link
|
73
|
-
)
|
66
|
+
expect(link).to be_a(Links::Link)
|
74
67
|
end
|
75
|
-
rescue RestClient::ExceptionWithResponse => e
|
76
|
-
puts e.inspect
|
77
|
-
raise e
|
78
68
|
end
|
79
|
-
end
|
80
69
|
|
81
|
-
|
82
|
-
|
83
|
-
expect(@link2).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
|
70
|
+
it '#post_wl_link' do
|
71
|
+
expect(@link2).to be_a(Links::Link)
|
84
72
|
expect(@link2.domain).to eq(@domain_name)
|
85
73
|
expect(@link2.subdomain).to eq(@subdomain_name + '2')
|
86
74
|
expect(@link2.username).to eq(@username)
|
@@ -88,22 +76,13 @@ describe SendGrid4r::REST::Whitelabel::Links do
|
|
88
76
|
expect(@link2.default).to eq(false)
|
89
77
|
expect(@link2.valid).to eq(false)
|
90
78
|
expect(@link2.legacy).to eq(false)
|
91
|
-
expect(@link2.dns.domain_cname).to be_a(
|
92
|
-
|
93
|
-
)
|
94
|
-
expect(@link2.dns.owner_cname).to be_a(
|
95
|
-
SendGrid4r::REST::Whitelabel::Links::Record
|
96
|
-
)
|
97
|
-
rescue RestClient::ExceptionWithResponse => e
|
98
|
-
puts e.inspect
|
99
|
-
raise e
|
79
|
+
expect(@link2.dns.domain_cname).to be_a(Links::Record)
|
80
|
+
expect(@link2.dns.owner_cname).to be_a(Links::Record)
|
100
81
|
end
|
101
|
-
end
|
102
82
|
|
103
|
-
|
104
|
-
begin
|
83
|
+
it '#get_wl_link' do
|
105
84
|
link2 = @client.get_wl_link(id: @link2.id)
|
106
|
-
expect(link2).to be_a(
|
85
|
+
expect(link2).to be_a(Links::Link)
|
107
86
|
expect(link2.domain).to eq(@domain_name)
|
108
87
|
expect(link2.subdomain).to eq(@subdomain_name + '2')
|
109
88
|
expect(link2.username).to eq(@username)
|
@@ -111,22 +90,13 @@ describe SendGrid4r::REST::Whitelabel::Links do
|
|
111
90
|
expect(link2.default).to eq(false)
|
112
91
|
expect(link2.valid).to eq(false)
|
113
92
|
expect(link2.legacy).to eq(false)
|
114
|
-
expect(link2.dns.domain_cname).to be_a(
|
115
|
-
|
116
|
-
)
|
117
|
-
expect(link2.dns.owner_cname).to be_a(
|
118
|
-
SendGrid4r::REST::Whitelabel::Links::Record
|
119
|
-
)
|
120
|
-
rescue RestClient::ExceptionWithResponse => e
|
121
|
-
puts e.inspect
|
122
|
-
raise e
|
93
|
+
expect(link2.dns.domain_cname).to be_a(Links::Record)
|
94
|
+
expect(link2.dns.owner_cname).to be_a(Links::Record)
|
123
95
|
end
|
124
|
-
end
|
125
96
|
|
126
|
-
|
127
|
-
begin
|
97
|
+
it '#patch_wl_link' do
|
128
98
|
link2 = @client.patch_wl_link(id: @link2.id, default: true)
|
129
|
-
expect(link2).to be_a(
|
99
|
+
expect(link2).to be_a(Links::Link)
|
130
100
|
expect(link2.domain).to eq(@domain_name)
|
131
101
|
expect(link2.subdomain).to eq(@subdomain_name + '2')
|
132
102
|
expect(link2.username).to eq(@username)
|
@@ -134,257 +104,203 @@ describe SendGrid4r::REST::Whitelabel::Links do
|
|
134
104
|
expect(link2.default).to eq(true)
|
135
105
|
expect(link2.valid).to eq(false)
|
136
106
|
expect(link2.legacy).to eq(false)
|
137
|
-
expect(link2.dns.domain_cname).to be_a(
|
138
|
-
|
139
|
-
)
|
140
|
-
expect(link2.dns.owner_cname).to be_a(
|
141
|
-
SendGrid4r::REST::Whitelabel::Links::Record
|
142
|
-
)
|
143
|
-
rescue RestClient::ExceptionWithResponse => e
|
144
|
-
puts e.inspect
|
145
|
-
raise e
|
107
|
+
expect(link2.dns.domain_cname).to be_a(Links::Record)
|
108
|
+
expect(link2.dns.owner_cname).to be_a(Links::Record)
|
146
109
|
end
|
147
|
-
end
|
148
110
|
|
149
|
-
|
150
|
-
begin
|
111
|
+
it '#delete_wl_link' do
|
151
112
|
@client.delete_wl_link(id: @link2.id)
|
152
|
-
rescue RestClient::ExceptionWithResponse => e
|
153
|
-
puts e.inspect
|
154
|
-
raise e
|
155
113
|
end
|
156
|
-
end
|
157
114
|
|
158
|
-
|
159
|
-
begin
|
115
|
+
it '#get_default_wl_link' do
|
160
116
|
link = @client.get_default_wl_link
|
161
|
-
expect(link).to be_a(
|
162
|
-
rescue RestClient::ExceptionWithResponse => e
|
163
|
-
puts e.inspect
|
164
|
-
raise e
|
117
|
+
expect(link).to be_a(Links::Link)
|
165
118
|
end
|
166
|
-
end
|
167
119
|
|
168
|
-
|
169
|
-
begin
|
120
|
+
it '#validate_wl_link' do
|
170
121
|
result1 = @client.validate_wl_link(id: @id1)
|
171
|
-
expect(result1).to be_a(
|
172
|
-
SendGrid4r::REST::Whitelabel::Links::Result
|
173
|
-
)
|
122
|
+
expect(result1).to be_a(Links::Result)
|
174
123
|
expect(result1.valid).to be(false)
|
175
|
-
expect(result1.validation_results.domain_cname.valid).to be(
|
176
|
-
|
177
|
-
)
|
178
|
-
expect(result1.validation_results.owner_cname.valid).to be(
|
179
|
-
false
|
180
|
-
)
|
181
|
-
rescue RestClient::ExceptionWithResponse => e
|
182
|
-
puts e.inspect
|
183
|
-
raise e
|
124
|
+
expect(result1.validation_results.domain_cname.valid).to be(false)
|
125
|
+
expect(result1.validation_results.owner_cname.valid).to be(false)
|
184
126
|
end
|
185
|
-
end
|
186
127
|
|
187
|
-
|
188
|
-
|
189
|
-
link1
|
190
|
-
expect(link1).to be_a(
|
191
|
-
SendGrid4r::REST::Whitelabel::Links::Link
|
192
|
-
)
|
193
|
-
rescue RestClient::ExceptionWithResponse => e
|
194
|
-
puts e.inspect
|
195
|
-
raise e
|
128
|
+
it '#get_associated_wl_link' do
|
129
|
+
link1 = @client.get_associated_wl_link(username: @subuser)
|
130
|
+
expect(link1).to be_a(Links::Link)
|
196
131
|
end
|
197
|
-
end
|
198
132
|
|
199
|
-
|
200
|
-
|
201
|
-
@client.associate_wl_link(
|
202
|
-
id: @id1, username: @subuser1
|
203
|
-
)
|
204
|
-
rescue RestClient::ExceptionWithResponse => e
|
205
|
-
puts e.inspect
|
206
|
-
raise e
|
133
|
+
it '#associate_wl_link' do
|
134
|
+
@client.associate_wl_link(id: @id1, username: @subuser)
|
207
135
|
end
|
208
|
-
end
|
209
136
|
|
210
|
-
|
211
|
-
|
212
|
-
@client.
|
213
|
-
id: @id1, username: @subuser1
|
214
|
-
)
|
215
|
-
@client.disassociate_wl_link(username: @subuser1)
|
216
|
-
rescue RestClient::ExceptionWithResponse => e
|
217
|
-
puts e.inspect
|
218
|
-
raise e
|
137
|
+
it '#disassociate_wl_link' do
|
138
|
+
@client.associate_wl_link(id: @id1, username: @subuser)
|
139
|
+
@client.disassociate_wl_link(username: @subuser)
|
219
140
|
end
|
220
141
|
end
|
221
142
|
end
|
222
|
-
end
|
223
143
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
144
|
+
describe 'unit test', :ut do
|
145
|
+
let(:client) do
|
146
|
+
SendGrid4r::Client.new(api_key: '')
|
147
|
+
end
|
228
148
|
|
229
|
-
|
230
|
-
|
231
|
-
|
149
|
+
let(:links) do
|
150
|
+
JSON.parse('[]')
|
151
|
+
end
|
232
152
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
153
|
+
let(:link) do
|
154
|
+
JSON.parse(
|
155
|
+
'{'\
|
156
|
+
'"id": 1,'\
|
157
|
+
'"domain": "example.com",'\
|
158
|
+
'"subdomain": "mail",'\
|
159
|
+
'"username": "john@example.com",'\
|
160
|
+
'"user_id": 7,'\
|
161
|
+
'"default": false,'\
|
162
|
+
'"valid": true,'\
|
163
|
+
'"legacy": false,'\
|
164
|
+
'"dns": {'\
|
165
|
+
'"domain_cname": {'\
|
166
|
+
'"valid": true,'\
|
167
|
+
'"type": "cname",'\
|
168
|
+
'"host": "mail.example.com",'\
|
169
|
+
'"data": "sendgrid.net"'\
|
170
|
+
'},'\
|
171
|
+
'"owner_cname": {'\
|
172
|
+
'"valid": true,'\
|
173
|
+
'"type": "cname",'\
|
174
|
+
'"host": "7.example.com",'\
|
175
|
+
'"data": "sendgrid.net"'\
|
176
|
+
'}'\
|
256
177
|
'}'\
|
257
|
-
'}'
|
258
|
-
|
259
|
-
|
260
|
-
end
|
178
|
+
'}'
|
179
|
+
)
|
180
|
+
end
|
261
181
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
'"
|
275
|
-
|
182
|
+
let(:result) do
|
183
|
+
JSON.parse(
|
184
|
+
'{'\
|
185
|
+
'"id": 1,'\
|
186
|
+
'"valid": true,'\
|
187
|
+
'"validation_results": {'\
|
188
|
+
'"domain_cname": {'\
|
189
|
+
'"valid": false,'\
|
190
|
+
'"reason": "Expected CNAME to match '\
|
191
|
+
'\"sendgrid.net.\" but found'\
|
192
|
+
' \"example.com.\"."'\
|
193
|
+
'},'\
|
194
|
+
'"owner_cname": {'\
|
195
|
+
'"valid": true,'\
|
196
|
+
'"reason": null'\
|
197
|
+
'}'\
|
276
198
|
'}'\
|
277
|
-
'}'
|
278
|
-
|
279
|
-
|
280
|
-
end
|
199
|
+
'}'
|
200
|
+
)
|
201
|
+
end
|
281
202
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
203
|
+
it '#get_wl_links' do
|
204
|
+
allow(client).to receive(:execute).and_return(links)
|
205
|
+
actual = client.get_wl_links
|
206
|
+
expect(actual).to be_a(Array)
|
207
|
+
end
|
287
208
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
209
|
+
it '#post_wl_link' do
|
210
|
+
allow(client).to receive(:execute).and_return(link)
|
211
|
+
actual = client.post_wl_link(domain: '', subdomain: '')
|
212
|
+
expect(actual).to be_a(Links::Link)
|
213
|
+
end
|
293
214
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
215
|
+
it '#get_wl_link' do
|
216
|
+
allow(client).to receive(:execute).and_return(link)
|
217
|
+
actual = client.get_wl_link(id: '')
|
218
|
+
expect(actual).to be_a(Links::Link)
|
219
|
+
end
|
299
220
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
221
|
+
it '#patch_wl_link' do
|
222
|
+
allow(client).to receive(:execute).and_return(link)
|
223
|
+
actual = client.patch_wl_link(id: '', default: true)
|
224
|
+
expect(actual).to be_a(Links::Link)
|
225
|
+
end
|
305
226
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
227
|
+
it '#delete_wl_link' do
|
228
|
+
allow(client).to receive(:execute).and_return('')
|
229
|
+
actual = client.delete_wl_link(id: '')
|
230
|
+
expect(actual).to eq('')
|
231
|
+
end
|
311
232
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
233
|
+
it '#get_default_wl_link' do
|
234
|
+
allow(client).to receive(:execute).and_return(link)
|
235
|
+
actual = client.get_default_wl_link(domain: '')
|
236
|
+
expect(actual).to be_a(Links::Link)
|
237
|
+
end
|
317
238
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
239
|
+
it '#validate_link' do
|
240
|
+
allow(client).to receive(:execute).and_return(result)
|
241
|
+
actual = client.validate_wl_link(id: '')
|
242
|
+
expect(actual).to be_a(Links::Result)
|
243
|
+
end
|
323
244
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
245
|
+
it '#get_associated_wl_link' do
|
246
|
+
allow(client).to receive(:execute).and_return(link)
|
247
|
+
actual = client.get_associated_wl_link(username: '')
|
248
|
+
expect(actual).to be_a(Links::Link)
|
249
|
+
end
|
329
250
|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
251
|
+
it '#disassociate_wl_link' do
|
252
|
+
allow(client).to receive(:execute).and_return('')
|
253
|
+
actual = client.disassociate_wl_link(username: '')
|
254
|
+
expect(actual).to eq('')
|
255
|
+
end
|
335
256
|
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
257
|
+
it '#associate_wl_link' do
|
258
|
+
allow(client).to receive(:execute).and_return(link)
|
259
|
+
actual = client.associate_wl_link(id: '', username: '')
|
260
|
+
expect(actual).to be_a(Links::Link)
|
261
|
+
end
|
341
262
|
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
expect(actual.dns.owner_cname.type).to eq('cname')
|
366
|
-
expect(actual.dns.owner_cname.data).to eq('sendgrid.net')
|
367
|
-
expect(actual.dns.owner_cname.valid).to eq(true)
|
368
|
-
end
|
263
|
+
it 'creates link instance' do
|
264
|
+
actual = Links.create_link(link)
|
265
|
+
expect(actual).to be_a(Links::Link)
|
266
|
+
expect(actual.id).to eq(1)
|
267
|
+
expect(actual.domain).to eq('example.com')
|
268
|
+
expect(actual.subdomain).to eq('mail')
|
269
|
+
expect(actual.username).to eq('john@example.com')
|
270
|
+
expect(actual.user_id).to eq(7)
|
271
|
+
expect(actual.default).to eq(false)
|
272
|
+
expect(actual.valid).to eq(true)
|
273
|
+
expect(actual.legacy).to eq(false)
|
274
|
+
expect(actual.dns).to be_a(Links::Dns)
|
275
|
+
expect(actual.dns.domain_cname).to be_a(Links::Record)
|
276
|
+
expect(actual.dns.domain_cname.host).to eq('mail.example.com')
|
277
|
+
expect(actual.dns.domain_cname.type).to eq('cname')
|
278
|
+
expect(actual.dns.domain_cname.data).to eq('sendgrid.net')
|
279
|
+
expect(actual.dns.domain_cname.valid).to eq(true)
|
280
|
+
expect(actual.dns.owner_cname).to be_a(Links::Record)
|
281
|
+
expect(actual.dns.owner_cname.host).to eq('7.example.com')
|
282
|
+
expect(actual.dns.owner_cname.type).to eq('cname')
|
283
|
+
expect(actual.dns.owner_cname.data).to eq('sendgrid.net')
|
284
|
+
expect(actual.dns.owner_cname.valid).to eq(true)
|
285
|
+
end
|
369
286
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
expect(actual.validation_results.owner_cname.reason).to be(nil)
|
287
|
+
it 'creates result instance' do
|
288
|
+
actual = Links.create_result(result)
|
289
|
+
expect(actual).to be_a(Links::Result)
|
290
|
+
expect(actual.id).to eq(1)
|
291
|
+
expect(actual.valid).to eq(true)
|
292
|
+
expect(actual.validation_results).to be_a(Links::ValidationResults)
|
293
|
+
expect(actual.validation_results.domain_cname).to be_a(
|
294
|
+
Links::ValidationResult
|
295
|
+
)
|
296
|
+
expect(actual.validation_results.domain_cname.valid).to be(false)
|
297
|
+
expect(actual.validation_results.domain_cname.reason).to be_a(String)
|
298
|
+
expect(actual.validation_results.owner_cname).to be_a(
|
299
|
+
Links::ValidationResult
|
300
|
+
)
|
301
|
+
expect(actual.validation_results.owner_cname.valid).to be(true)
|
302
|
+
expect(actual.validation_results.owner_cname.reason).to be(nil)
|
303
|
+
end
|
388
304
|
end
|
389
305
|
end
|
390
306
|
end
|