sendgrid4r 0.5.0 → 1.0.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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.env.example +6 -8
  3. data/.rubocop.yml +1 -1
  4. data/README.md +0 -2
  5. data/lib/sendgrid4r/rest/api.rb +6 -0
  6. data/lib/sendgrid4r/rest/api_keys/api_keys.rb +5 -5
  7. data/lib/sendgrid4r/rest/asm/global_suppressions.rb +3 -3
  8. data/lib/sendgrid4r/rest/asm/groups.rb +4 -4
  9. data/lib/sendgrid4r/rest/asm/suppressions.rb +4 -4
  10. data/lib/sendgrid4r/rest/categories/categories.rb +1 -1
  11. data/lib/sendgrid4r/rest/contacts/custom_fields.rb +3 -3
  12. data/lib/sendgrid4r/rest/contacts/lists.rb +10 -10
  13. data/lib/sendgrid4r/rest/contacts/recipients.rb +10 -10
  14. data/lib/sendgrid4r/rest/contacts/segments.rb +5 -5
  15. data/lib/sendgrid4r/rest/ips/addresses.rb +3 -3
  16. data/lib/sendgrid4r/rest/ips/pools.rb +4 -4
  17. data/lib/sendgrid4r/rest/ips/warmup.rb +6 -6
  18. data/lib/sendgrid4r/rest/request.rb +2 -2
  19. data/lib/sendgrid4r/rest/subusers/subusers.rb +63 -3
  20. data/lib/sendgrid4r/rest/templates/templates.rb +14 -9
  21. data/lib/sendgrid4r/rest/templates/versions.rb +12 -10
  22. data/lib/sendgrid4r/rest/whitelabel/domains.rb +257 -0
  23. data/lib/sendgrid4r/rest/whitelabel/ips.rb +140 -0
  24. data/lib/sendgrid4r/rest/whitelabel/links.rb +185 -0
  25. data/lib/sendgrid4r/version.rb +1 -1
  26. data/sendgrid4r.gemspec +1 -1
  27. data/spec/client_spec.rb +93 -1
  28. data/spec/rest/api_keys/api_keys_spec.rb +23 -55
  29. data/spec/rest/asm/global_suppressions_spec.rb +40 -68
  30. data/spec/rest/asm/groups_spec.rb +31 -82
  31. data/spec/rest/asm/suppressions_spec.rb +33 -76
  32. data/spec/rest/categories/categories_spec.rb +8 -27
  33. data/spec/rest/contacts/custom_fields_spec.rb +18 -71
  34. data/spec/rest/contacts/lists_spec.rb +64 -187
  35. data/spec/rest/contacts/recipients_spec.rb +41 -196
  36. data/spec/rest/contacts/reserved_fields_spec.rb +2 -20
  37. data/spec/rest/contacts/segments_spec.rb +47 -33
  38. data/spec/rest/email_activity/email_activity_spec.rb +8 -21
  39. data/spec/rest/ips/addresses_spec.rb +18 -77
  40. data/spec/rest/ips/pools_spec.rb +21 -80
  41. data/spec/rest/ips/warmup_spec.rb +11 -58
  42. data/spec/rest/settings/enforced_tls_spec.rb +3 -40
  43. data/spec/rest/settings/mail_spec.rb +21 -294
  44. data/spec/rest/settings/partner_spec.rb +6 -79
  45. data/spec/rest/settings/tracking_spec.rb +10 -147
  46. data/spec/rest/stats/advanced_spec.rb +13 -135
  47. data/spec/rest/stats/category_spec.rb +5 -48
  48. data/spec/rest/stats/global_spec.rb +3 -5
  49. data/spec/rest/stats/parse_spec.rb +1 -24
  50. data/spec/rest/stats/subuser_spec.rb +6 -49
  51. data/spec/rest/subusers/subusers_spec.rb +156 -81
  52. data/spec/rest/templates/templates_spec.rb +32 -81
  53. data/spec/rest/templates/versions_spec.rb +50 -28
  54. data/spec/rest/whitelabel/domains_spec.rb +637 -0
  55. data/spec/rest/whitelabel/ips_spec.rb +231 -0
  56. data/spec/rest/whitelabel/links_spec.rb +359 -0
  57. metadata +22 -8
@@ -0,0 +1,231 @@
1
+ # encoding: utf-8
2
+ require File.dirname(__FILE__) + '/../../spec_helper'
3
+
4
+ describe SendGrid4r::REST::Whitelabel::Ips 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
+ @subdomain_name = ENV['SUBDOMAIN_IP']
11
+ @domain_name = ENV['DOMAIN']
12
+ @username = ENV['USERNAME']
13
+ @ip = ENV['IP']
14
+
15
+ # celan up test env(lists)
16
+ ips = @client.get_wl_ips
17
+ ips.each do |ip|
18
+ @client.delete_wl_ip(
19
+ id: ip.id
20
+ ) if ip.subdomain == @subdomain_name && ip.domain == @domain_name
21
+ end
22
+
23
+ @ipw = @client.post_wl_ip(
24
+ ip: @ip, subdomain: @subdomain_name, domain: @domain_name
25
+ )
26
+
27
+ rescue RestClient::ExceptionWithResponse => e
28
+ puts e.inspect
29
+ raise e
30
+ end
31
+ end
32
+
33
+ context 'without block call' do
34
+ it '#get_wl_ips' do
35
+ begin
36
+ ips = @client.get_wl_ips
37
+ expect(ips).to be_a(Array)
38
+ ips.each do |ip|
39
+ expect(ip).to be_a(SendGrid4r::REST::Whitelabel::Ips::Ip)
40
+ end
41
+ rescue RestClient::ExceptionWithResponse => e
42
+ puts e.inspect
43
+ raise e
44
+ end
45
+ end
46
+
47
+ it '#post_wl_ip' do
48
+ begin
49
+ expect(@ipw).to be_a(SendGrid4r::REST::Whitelabel::Ips::Ip)
50
+ expect(@ipw.id).to be_a(Numeric)
51
+ expect(@ipw.ip).to eq(@ip)
52
+ expect(@ipw.rdns).to be_a(String)
53
+ expect(@ipw.users).to be_a(Array)
54
+ expect(@ipw.subdomain).to eq(@subdomain_name)
55
+ expect(@ipw.domain).to eq(@domain_name)
56
+ expect(@ipw.valid).to eq(false)
57
+ expect(@ipw.legacy).to eq(false)
58
+ expect(@ipw.a_record).to be_a(
59
+ SendGrid4r::REST::Whitelabel::Ips::ARecord
60
+ )
61
+ expect(@ipw.a_record.valid).to eq(false)
62
+ expect(@ipw.a_record.type).to eq('a')
63
+ expect(@ipw.a_record.host).to be_a(String)
64
+ expect(@ipw.a_record.data).to eq(@ip)
65
+ rescue RestClient::ExceptionWithResponse => e
66
+ puts e.inspect
67
+ raise e
68
+ end
69
+ end
70
+
71
+ it '#get_wl_ip' do
72
+ begin
73
+ ip = @client.get_wl_ip(id: @ipw.id)
74
+ expect(ip).to be_a(SendGrid4r::REST::Whitelabel::Ips::Ip)
75
+ expect(ip.ip).to eq(@ip)
76
+ expect(ip.users).to be_a(Array)
77
+ expect(ip.subdomain).to eq(@subdomain_name)
78
+ expect(ip.domain).to eq(@domain_name)
79
+ expect(ip.valid).to eq(false)
80
+ expect(ip.legacy).to eq(false)
81
+ expect(ip.a_record).to be_a(
82
+ SendGrid4r::REST::Whitelabel::Ips::ARecord
83
+ )
84
+ expect(ip.a_record.valid).to eq(false)
85
+ expect(ip.a_record.type).to eq('a')
86
+ expect(ip.a_record.host).to be_a(String)
87
+ expect(ip.a_record.data).to eq(@ip)
88
+ rescue RestClient::ExceptionWithResponse => e
89
+ puts e.inspect
90
+ raise e
91
+ end
92
+ end
93
+
94
+ it '#delete_wl_ip' do
95
+ begin
96
+ @client.delete_wl_ip(id: @ipw.id)
97
+ rescue RestClient::ExceptionWithResponse => e
98
+ puts e.inspect
99
+ raise e
100
+ end
101
+ end
102
+
103
+ it '#validate_wl_ip' do
104
+ begin
105
+ result = @client.validate_wl_ip(id: @ipw.id)
106
+ expect(result).to be_a(
107
+ SendGrid4r::REST::Whitelabel::Ips::Result
108
+ )
109
+ expect(result.valid).to be(false)
110
+ expect(result.validation_results.a_record.valid).to be(false)
111
+ expect(result.validation_results.a_record.reason).to be_a(String)
112
+ rescue RestClient::ExceptionWithResponse => e
113
+ puts e.inspect
114
+ raise e
115
+ end
116
+ end
117
+ end
118
+ end
119
+
120
+ describe 'unit test', :ut do
121
+ let(:client) do
122
+ SendGrid4r::Client.new(api_key: '')
123
+ end
124
+
125
+ let(:ips) do
126
+ JSON.parse('[]')
127
+ end
128
+
129
+ let(:ip) do
130
+ JSON.parse(
131
+ '{'\
132
+ '"id": 123,'\
133
+ '"ip": "192.168.1.2",'\
134
+ '"rdns": "o1.email.example.com",'\
135
+ '"users": ['\
136
+ '],'\
137
+ '"subdomain": "email",'\
138
+ '"domain": "example.com",'\
139
+ '"valid": true,'\
140
+ '"legacy": false,'\
141
+ '"a_record": {'\
142
+ '"valid": true,'\
143
+ '"type": "a",'\
144
+ '"host": "o1.email.example.com",'\
145
+ '"data": "192.168.1.2"'\
146
+ '}'\
147
+ '}'
148
+ )
149
+ end
150
+
151
+ let(:result) do
152
+ JSON.parse(
153
+ '{'\
154
+ '"id": 1,'\
155
+ '"valid": true,'\
156
+ '"validation_results": {'\
157
+ '"a_record": {'\
158
+ '"valid": true,'\
159
+ '"reason": null'\
160
+ '}'\
161
+ '}'\
162
+ '}'
163
+ )
164
+ end
165
+
166
+ it '#get_wl_ips' do
167
+ allow(client).to receive(:execute).and_return(ips)
168
+ actual = client.get_wl_ips
169
+ expect(actual).to be_a(Array)
170
+ end
171
+
172
+ it '#post_wl_ip' do
173
+ allow(client).to receive(:execute).and_return(ip)
174
+ actual = client.post_wl_ip(ip: '', subdomain: '', domain: '')
175
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Ips::Ip)
176
+ end
177
+
178
+ it '#get_wl_ip' do
179
+ allow(client).to receive(:execute).and_return(ip)
180
+ actual = client.get_wl_ip(id: '')
181
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Ips::Ip)
182
+ end
183
+
184
+ it '#delete_wl_ip' do
185
+ allow(client).to receive(:execute).and_return('')
186
+ actual = client.delete_wl_ip(id: '')
187
+ expect(actual).to eq('')
188
+ end
189
+
190
+ it '#validate_wl_ip' do
191
+ allow(client).to receive(:execute).and_return(result)
192
+ actual = client.validate_wl_ip(id: '')
193
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Ips::Result)
194
+ end
195
+
196
+ it 'creates ip instance' do
197
+ actual = SendGrid4r::REST::Whitelabel::Ips.create_ip(ip)
198
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Ips::Ip)
199
+ expect(actual.id).to eq(123)
200
+ expect(actual.ip).to eq('192.168.1.2')
201
+ expect(actual.rdns).to eq('o1.email.example.com')
202
+ expect(actual.users).to eq([])
203
+ expect(actual.subdomain).to eq('email')
204
+ expect(actual.domain).to eq('example.com')
205
+ expect(actual.valid).to eq(true)
206
+ expect(actual.legacy).to eq(false)
207
+ expect(actual.a_record).to be_a(
208
+ SendGrid4r::REST::Whitelabel::Ips::ARecord
209
+ )
210
+ expect(actual.a_record.valid).to eq(true)
211
+ expect(actual.a_record.type).to eq('a')
212
+ expect(actual.a_record.host).to eq('o1.email.example.com')
213
+ expect(actual.a_record.data).to eq('192.168.1.2')
214
+ end
215
+
216
+ it 'creates result instance' do
217
+ actual = SendGrid4r::REST::Whitelabel::Ips.create_result(result)
218
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Ips::Result)
219
+ expect(actual.id).to eq(1)
220
+ expect(actual.valid).to eq(true)
221
+ expect(actual.validation_results).to be_a(
222
+ SendGrid4r::REST::Whitelabel::Ips::ValidationResults
223
+ )
224
+ expect(actual.validation_results.a_record).to be_a(
225
+ SendGrid4r::REST::Whitelabel::Ips::ValidationResult
226
+ )
227
+ expect(actual.validation_results.a_record.valid).to be(true)
228
+ expect(actual.validation_results.a_record.reason).to be(nil)
229
+ end
230
+ end
231
+ end
@@ -0,0 +1,359 @@
1
+ # encoding: utf-8
2
+ require File.dirname(__FILE__) + '/../../spec_helper'
3
+
4
+ describe SendGrid4r::REST::Whitelabel::Links 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
+ @subdomain_name = ENV['SUBDOMAIN_LINK']
11
+ @domain_name = ENV['DOMAIN']
12
+ @username = ENV['USERNAME']
13
+ @subuser1 = ENV['SUBUSER1']
14
+
15
+ # celan up test env(lists)
16
+ links = @client.get_wl_links
17
+ links.each do |link|
18
+ if link.subdomain == "#{@subdomain_name}1" &&
19
+ link.domain == @domain_name
20
+ @client.delete_wl_link(id: link.id)
21
+ end
22
+ end
23
+
24
+ # post link
25
+ @link1 = @client.post_wl_link(
26
+ subdomain: @subdomain_name + '1', domain: @domain_name, default: false
27
+ )
28
+ rescue RestClient::ExceptionWithResponse => e
29
+ puts e.inspect
30
+ raise e
31
+ end
32
+ end
33
+
34
+ context 'without block call' do
35
+ it '#get_wl_links' do
36
+ begin
37
+ links = @client.get_wl_links
38
+ expect(links).to be_a(Array)
39
+ links.each do |link|
40
+ expect(link).to be_a(
41
+ SendGrid4r::REST::Whitelabel::Links::Link
42
+ )
43
+ end
44
+ rescue RestClient::ExceptionWithResponse => e
45
+ puts e.inspect
46
+ raise e
47
+ end
48
+ end
49
+
50
+ it '#post_wl_link' do
51
+ begin
52
+ expect(@link1).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
53
+ expect(@link1.domain).to eq(@domain_name)
54
+ expect(@link1.subdomain).to eq(@subdomain_name + '1')
55
+ expect(@link1.username).to eq(@username)
56
+ expect(@link1.user_id).to be_a(Numeric)
57
+ expect(@link1.default).to eq(false)
58
+ expect(@link1.valid).to eq(false)
59
+ expect(@link1.legacy).to eq(false)
60
+ expect(@link1.dns.domain_cname).to be_a(
61
+ SendGrid4r::REST::Whitelabel::Links::Record
62
+ )
63
+ expect(@link1.dns.owner_cname).to be_a(
64
+ SendGrid4r::REST::Whitelabel::Links::Record
65
+ )
66
+ rescue RestClient::ExceptionWithResponse => e
67
+ puts e.inspect
68
+ raise e
69
+ end
70
+ end
71
+
72
+ it '#get_wl_link' do
73
+ begin
74
+ link1 = @client.get_wl_link(id: @link1.id)
75
+ expect(link1).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
76
+ expect(link1.domain).to eq(@domain_name)
77
+ expect(link1.subdomain).to eq(@subdomain_name + '1')
78
+ expect(link1.username).to eq(@username)
79
+ expect(link1.user_id).to be_a(Numeric)
80
+ expect(link1.default).to eq(false)
81
+ expect(link1.valid).to eq(false)
82
+ expect(link1.legacy).to eq(false)
83
+ expect(link1.dns.domain_cname).to be_a(
84
+ SendGrid4r::REST::Whitelabel::Links::Record
85
+ )
86
+ expect(link1.dns.owner_cname).to be_a(
87
+ SendGrid4r::REST::Whitelabel::Links::Record
88
+ )
89
+ rescue RestClient::ExceptionWithResponse => e
90
+ puts e.inspect
91
+ raise e
92
+ end
93
+ end
94
+
95
+ it '#patch_wl_link' do
96
+ begin
97
+ link1 = @client.patch_wl_link(id: @link1.id, default: false)
98
+ expect(link1).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
99
+ expect(link1.domain).to eq(@domain_name)
100
+ expect(link1.subdomain).to eq(@subdomain_name + '1')
101
+ expect(link1.username).to eq(@username)
102
+ expect(link1.user_id).to be_a(Numeric)
103
+ expect(link1.default).to eq(false)
104
+ expect(link1.valid).to eq(false)
105
+ expect(link1.legacy).to eq(false)
106
+ expect(link1.dns.domain_cname).to be_a(
107
+ SendGrid4r::REST::Whitelabel::Links::Record
108
+ )
109
+ expect(link1.dns.owner_cname).to be_a(
110
+ SendGrid4r::REST::Whitelabel::Links::Record
111
+ )
112
+ rescue RestClient::ExceptionWithResponse => e
113
+ puts e.inspect
114
+ raise e
115
+ end
116
+ end
117
+
118
+ it '#delete_wl_link' do
119
+ begin
120
+ @client.delete_wl_link(id: @link1.id)
121
+ rescue RestClient::ExceptionWithResponse => e
122
+ puts e.inspect
123
+ raise e
124
+ end
125
+ end
126
+
127
+ it '#get_default_wl_link' do
128
+ begin
129
+ link = @client.get_default_wl_link
130
+ expect(link).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
131
+ rescue RestClient::ExceptionWithResponse => e
132
+ puts e.inspect
133
+ raise e
134
+ end
135
+ end
136
+
137
+ it '#validate_wl_link' do
138
+ begin
139
+ result1 = @client.validate_wl_link(id: @link1.id)
140
+ expect(result1).to be_a(
141
+ SendGrid4r::REST::Whitelabel::Links::Result
142
+ )
143
+ expect(result1.valid).to be(false)
144
+ expect(result1.validation_results.domain_cname.valid).to be(
145
+ false
146
+ )
147
+ expect(result1.validation_results.owner_cname.valid).to be(
148
+ false
149
+ )
150
+ rescue RestClient::ExceptionWithResponse => e
151
+ puts e.inspect
152
+ raise e
153
+ end
154
+ end
155
+
156
+ it '#get_associated_wl_link' do
157
+ begin
158
+ link1 = @client.get_associated_wl_link(username: @subuser1)
159
+ expect(link1).to be_a(
160
+ SendGrid4r::REST::Whitelabel::Links::Link
161
+ )
162
+ rescue RestClient::ExceptionWithResponse => e
163
+ puts e.inspect
164
+ raise e
165
+ end
166
+ end
167
+
168
+ it '#associate_wl_link' do
169
+ begin
170
+ @client.associate_wl_link(
171
+ id: @link1.id, username: @subuser1
172
+ )
173
+ rescue RestClient::ExceptionWithResponse => e
174
+ puts e.inspect
175
+ raise e
176
+ end
177
+ end
178
+
179
+ it '#disassociate_wl_link' do
180
+ begin
181
+ @client.associate_wl_link(
182
+ id: @link1.id, username: @subuser1
183
+ )
184
+ @client.disassociate_wl_link(username: @subuser1)
185
+ rescue RestClient::ExceptionWithResponse => e
186
+ puts e.inspect
187
+ raise e
188
+ end
189
+ end
190
+ end
191
+ end
192
+
193
+ describe 'unit test', :ut do
194
+ let(:client) do
195
+ SendGrid4r::Client.new(api_key: '')
196
+ end
197
+
198
+ let(:links) do
199
+ JSON.parse('[]')
200
+ end
201
+
202
+ let(:link) do
203
+ JSON.parse(
204
+ '{'\
205
+ '"id": 1,'\
206
+ '"domain": "example.com",'\
207
+ '"subdomain": "mail",'\
208
+ '"username": "john@example.com",'\
209
+ '"user_id": 7,'\
210
+ '"default": false,'\
211
+ '"valid": true,'\
212
+ '"legacy": false,'\
213
+ '"dns": {'\
214
+ '"domain_cname": {'\
215
+ '"valid": true,'\
216
+ '"type": "cname",'\
217
+ '"host": "mail.example.com",'\
218
+ '"data": "sendgrid.net"'\
219
+ '},'\
220
+ '"owner_cname": {'\
221
+ '"valid": true,'\
222
+ '"type": "cname",'\
223
+ '"host": "7.example.com",'\
224
+ '"data": "sendgrid.net"'\
225
+ '}'\
226
+ '}'\
227
+ '}'
228
+ )
229
+ end
230
+
231
+ let(:result) do
232
+ JSON.parse(
233
+ '{'\
234
+ '"id": 1,'\
235
+ '"valid": true,'\
236
+ '"validation_results": {'\
237
+ '"domain_cname": {'\
238
+ '"valid": false,'\
239
+ '"reason": "Expected CNAME to match \"sendgrid.net.\" but found'\
240
+ ' \"example.com.\"."'\
241
+ '},'\
242
+ '"owner_cname": {'\
243
+ '"valid": true,'\
244
+ '"reason": null'\
245
+ '}'\
246
+ '}'\
247
+ '}'
248
+ )
249
+ end
250
+
251
+ it '#get_wl_links' do
252
+ allow(client).to receive(:execute).and_return(links)
253
+ actual = client.get_wl_links
254
+ expect(actual).to be_a(Array)
255
+ end
256
+
257
+ it '#post_wl_link' do
258
+ allow(client).to receive(:execute).and_return(link)
259
+ actual = client.post_wl_link(domain: '', subdomain: '')
260
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
261
+ end
262
+
263
+ it '#get_wl_link' do
264
+ allow(client).to receive(:execute).and_return(link)
265
+ actual = client.get_wl_link(id: '')
266
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
267
+ end
268
+
269
+ it '#patch_wl_link' do
270
+ allow(client).to receive(:execute).and_return(link)
271
+ actual = client.patch_wl_link(id: '', default: true)
272
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
273
+ end
274
+
275
+ it '#delete_wl_link' do
276
+ allow(client).to receive(:execute).and_return('')
277
+ actual = client.delete_wl_link(id: '')
278
+ expect(actual).to eq('')
279
+ end
280
+
281
+ it '#get_default_wl_link' do
282
+ allow(client).to receive(:execute).and_return(link)
283
+ actual = client.get_default_wl_link(domain: '')
284
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
285
+ end
286
+
287
+ it '#validate_link' do
288
+ allow(client).to receive(:execute).and_return(result)
289
+ actual = client.validate_wl_link(id: '')
290
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Result)
291
+ end
292
+
293
+ it '#get_associated_wl_link' do
294
+ allow(client).to receive(:execute).and_return(link)
295
+ actual = client.get_associated_wl_link(username: '')
296
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
297
+ end
298
+
299
+ it '#disassociate_wl_link' do
300
+ allow(client).to receive(:execute).and_return('')
301
+ actual = client.disassociate_wl_link(username: '')
302
+ expect(actual).to eq('')
303
+ end
304
+
305
+ it '#associate_wl_link' do
306
+ allow(client).to receive(:execute).and_return(link)
307
+ actual = client.associate_wl_link(id: '', username: '')
308
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
309
+ end
310
+
311
+ it 'creates link instance' do
312
+ actual = SendGrid4r::REST::Whitelabel::Links.create_link(link)
313
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Link)
314
+ expect(actual.id).to eq(1)
315
+ expect(actual.domain).to eq('example.com')
316
+ expect(actual.subdomain).to eq('mail')
317
+ expect(actual.username).to eq('john@example.com')
318
+ expect(actual.user_id).to eq(7)
319
+ expect(actual.default).to eq(false)
320
+ expect(actual.valid).to eq(true)
321
+ expect(actual.legacy).to eq(false)
322
+ expect(actual.dns).to be_a(SendGrid4r::REST::Whitelabel::Links::Dns)
323
+ expect(actual.dns.domain_cname).to be_a(
324
+ SendGrid4r::REST::Whitelabel::Links::Record
325
+ )
326
+ expect(actual.dns.domain_cname.host).to eq('mail.example.com')
327
+ expect(actual.dns.domain_cname.type).to eq('cname')
328
+ expect(actual.dns.domain_cname.data).to eq('sendgrid.net')
329
+ expect(actual.dns.domain_cname.valid).to eq(true)
330
+ expect(actual.dns.owner_cname).to be_a(
331
+ SendGrid4r::REST::Whitelabel::Links::Record
332
+ )
333
+ expect(actual.dns.owner_cname.host).to eq('7.example.com')
334
+ expect(actual.dns.owner_cname.type).to eq('cname')
335
+ expect(actual.dns.owner_cname.data).to eq('sendgrid.net')
336
+ expect(actual.dns.owner_cname.valid).to eq(true)
337
+ end
338
+
339
+ it 'creates result instance' do
340
+ actual = SendGrid4r::REST::Whitelabel::Links.create_result(result)
341
+ expect(actual).to be_a(SendGrid4r::REST::Whitelabel::Links::Result)
342
+ expect(actual.id).to eq(1)
343
+ expect(actual.valid).to eq(true)
344
+ expect(actual.validation_results).to be_a(
345
+ SendGrid4r::REST::Whitelabel::Links::ValidationResults
346
+ )
347
+ expect(actual.validation_results.domain_cname).to be_a(
348
+ SendGrid4r::REST::Whitelabel::Links::ValidationResult
349
+ )
350
+ expect(actual.validation_results.domain_cname.valid).to be(false)
351
+ expect(actual.validation_results.domain_cname.reason).to be_a(String)
352
+ expect(actual.validation_results.owner_cname).to be_a(
353
+ SendGrid4r::REST::Whitelabel::Links::ValidationResult
354
+ )
355
+ expect(actual.validation_results.owner_cname.valid).to be(true)
356
+ expect(actual.validation_results.owner_cname.reason).to be(nil)
357
+ end
358
+ end
359
+ end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - awwa500@gmail.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-05 00:00:00.000000000 Z
11
+ date: 2015-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.8.0
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 1.7.2
22
+ version: 1.9.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - '='
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.8.0
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 1.7.2
32
+ version: 1.9.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rubocop
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +156,9 @@ files:
150
156
  - lib/sendgrid4r/rest/subusers/subusers.rb
151
157
  - lib/sendgrid4r/rest/templates/templates.rb
152
158
  - lib/sendgrid4r/rest/templates/versions.rb
159
+ - lib/sendgrid4r/rest/whitelabel/domains.rb
160
+ - lib/sendgrid4r/rest/whitelabel/ips.rb
161
+ - lib/sendgrid4r/rest/whitelabel/links.rb
153
162
  - lib/sendgrid4r/version.rb
154
163
  - sendgrid4r.gemspec
155
164
  - spec/client_spec.rb
@@ -185,6 +194,9 @@ files:
185
194
  - spec/rest/subusers/subusers_spec.rb
186
195
  - spec/rest/templates/templates_spec.rb
187
196
  - spec/rest/templates/versions_spec.rb
197
+ - spec/rest/whitelabel/domains_spec.rb
198
+ - spec/rest/whitelabel/ips_spec.rb
199
+ - spec/rest/whitelabel/links_spec.rb
188
200
  - spec/spec_helper.rb
189
201
  homepage: ''
190
202
  licenses:
@@ -206,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
218
  version: '0'
207
219
  requirements: []
208
220
  rubyforge_project:
209
- rubygems_version: 2.4.2
221
+ rubygems_version: 2.2.2
210
222
  signing_key:
211
223
  specification_version: 4
212
224
  summary: SendGrid Web API v3 module
@@ -244,5 +256,7 @@ test_files:
244
256
  - spec/rest/subusers/subusers_spec.rb
245
257
  - spec/rest/templates/templates_spec.rb
246
258
  - spec/rest/templates/versions_spec.rb
259
+ - spec/rest/whitelabel/domains_spec.rb
260
+ - spec/rest/whitelabel/ips_spec.rb
261
+ - spec/rest/whitelabel/links_spec.rb
247
262
  - spec/spec_helper.rb
248
- has_rdoc: