sendgrid_webapi 0.2.0 → 0.2.1

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 (26) hide show
  1. checksums.yaml +4 -4
  2. data/.tekton/templates/pipelinerun.yaml +1 -1
  3. data/README.rdoc +0 -2
  4. data/lib/version.rb +1 -1
  5. data/lib/web_api/address_whitelist.rb +24 -0
  6. data/lib/web_api/modules.rb +5 -1
  7. data/spec/cassettes/client/_modules/_address_whitelist/should_add_email_to_whitelist.yml +36 -0
  8. data/spec/cassettes/client/_modules/_address_whitelist/should_delete_email_from_whitelist.yml +36 -0
  9. data/spec/cassettes/client/_modules/_address_whitelist/should_get_address_whitelist.yml +36 -0
  10. data/spec/cassettes/client/_modules/_block/should_get_block_emails.yml +33 -33
  11. data/spec/cassettes/client/_modules/_block/should_get_totals_blocks.yml +33 -33
  12. data/spec/cassettes/client/_modules/_block/should_try_delete_not_existing_block_email.yml +33 -33
  13. data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails.yml +33 -33
  14. data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails_using_params.yml +33 -33
  15. data/spec/cassettes/client/_modules/_bounce/should_try_delete_not_existing_bounce_email.yml +33 -33
  16. data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails.yml +33 -33
  17. data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails_using_params.yml +33 -33
  18. data/spec/cassettes/client/_modules/_invalid_email/should_try_delete_not_existing_invalid_emails.yml +33 -33
  19. data/spec/cassettes/client/_modules/_spam/should_get_spam_emails.yml +33 -33
  20. data/spec/cassettes/client/_modules/_spam/should_try_delete_not_existing_spam_emails.yml +33 -33
  21. data/spec/cassettes/client/_modules/_unsubscribe/should_add_unsubscribe_emails.yml +33 -33
  22. data/spec/cassettes/client/_modules/_unsubscribe/should_delete_unsubscribe_email.yml +33 -33
  23. data/spec/cassettes/client/_modules/_unsubscribe/should_get_unsubscribe_emails.yml +33 -33
  24. data/spec/cassettes/client/_modules/_unsubscribe/should_try_delete_not_existing_unsubscribe_emails.yml +33 -33
  25. data/spec/client_spec.rb +17 -0
  26. metadata +6 -2
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.sendgrid.com/v3/suppression/invalid_emails
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:39:56 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '[]'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:39:57 GMT
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/invalid_emails
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:39:56 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "[]"
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:39:57 GMT
36
36
  recorded_with: VCR 2.8.0
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.sendgrid.com/v3/suppression/invalid_emails?limit=3&offset=2
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:39:56 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '["test@example.com", "test2@example.com", "test3@example.com"]'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:39:57 GMT
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/invalid_emails?limit=3&offset=2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:39:56 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '["test@example.com", "test2@example.com", "test3@example.com"]'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:39:57 GMT
36
36
  recorded_with: VCR 2.8.0
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: delete
5
- uri: https://api.sendgrid.com/v3/suppression/invalid_emails/test@example.com
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:39:58 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '{"message": "Email does not exist"}'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:39:58 GMT
3
+ - request:
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/suppression/invalid_emails/test@example.com
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:39:58 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"message": "Email does not exist"}'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:39:58 GMT
36
36
  recorded_with: VCR 2.8.0
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.sendgrid.com/v3/suppression/spam_reports
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:48:27 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '[]'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:48:27 GMT
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/spam_reports
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:48:27 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "[]"
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:48:27 GMT
36
36
  recorded_with: VCR 2.8.0
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: delete
5
- uri: https://api.sendgrid.com/v3/suppression/spam_reports/test@example.com
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:48:28 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '{"message": "Email does not exist"}'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:48:28 GMT
3
+ - request:
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/suppression/spam_reports/test@example.com
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:48:28 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"message": "Email does not exist"}'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:48:28 GMT
36
36
  recorded_with: VCR 2.8.0
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.sendgrid.com/v3/asm/suppressions/global
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:49:15 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '{"message": "success"}'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:49:15 GMT
3
+ - request:
4
+ method: post
5
+ uri: https://api.sendgrid.com/v3/asm/suppressions/global
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:49:15 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"message": "success"}'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:49:15 GMT
36
36
  recorded_with: VCR 2.8.0
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: delete
5
- uri: https://api.sendgrid.com/v3/asm/suppressions/global/test@example.com
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:49:18 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '{"message": "success"}'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:49:18 GMT
3
+ - request:
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/asm/suppressions/global/test@example.com
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:49:18 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"message": "success"}'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:49:18 GMT
36
36
  recorded_with: VCR 2.8.0
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.sendgrid.com/v3/suppression/unsubscribes
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:49:16 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '[{"email": "test@example.com"}]'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:49:16 GMT
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/unsubscribes
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:49:16 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '[{"email": "test@example.com"}]'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:49:16 GMT
36
36
  recorded_with: VCR 2.8.0
@@ -1,36 +1,36 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: delete
5
- uri: https://api.sendgrid.com/v3/asm/suppressions/global/test@example.com
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.8.9
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Server:
22
- - nginx/1.4.2
23
- Date:
24
- - Fri, 17 Jan 2014 01:49:19 GMT
25
- Content-Type:
26
- - text/html
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '{"errors":[{"field":"null","message":"resource not found"}]}'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:49:19 GMT
3
+ - request:
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/asm/suppressions/global/test@example.com
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:49:19 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"errors":[{"field":"null","message":"resource not found"}]}'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:49:19 GMT
36
36
  recorded_with: VCR 2.8.0
data/spec/client_spec.rb CHANGED
@@ -21,6 +21,23 @@ describe "client" do
21
21
  end
22
22
 
23
23
  describe "#modules", :vcr do
24
+ describe "#address_whitelist", :vcr do
25
+ it "should get address whitelist" do
26
+ response = client.address_whitelist.get
27
+ expect(response["list"]).to eql ["test@example.com", "test2@example.com"]
28
+ end
29
+
30
+ it "should add email to whitelist" do
31
+ response = client.address_whitelist.add({ list: ["new@example.com"] })
32
+ expect(response["list"]).to include("new@example.com")
33
+ end
34
+
35
+ it "should delete email from whitelist" do
36
+ response = client.address_whitelist.delete({ email: "test2@example.com" })
37
+ expect(response["list"]).not_to include("test2@example.com")
38
+ end
39
+ end
40
+
24
41
  describe "#block" do
25
42
  it "should get block emails" do
26
43
  expect(client.blocks.get).to eql []