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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d193cbbc918879debc5aee92e0f7397be4f83a4d876bac7a049dd42c9a9a671
4
- data.tar.gz: ae235e49239b82ed69de5c93654555cc93f702e6905928e6fb89de0fc6427fe5
3
+ metadata.gz: 8f7c07661a9477609e12ca455e47fd9b25bc6ebd2c9a78b40d2c8e4c3ecacb39
4
+ data.tar.gz: 85501d8dde08a350daf3c2a7767e720aacabaebff8cf2ba2bdfaaa76cc4f0cd9
5
5
  SHA512:
6
- metadata.gz: b65c616400aeeaa7e5bfff61f0626635558986679c3f56b4dc9e42c165c68cdf7998a4b8574a1cc60d2b0c96ce3f18982dfb2d69c197ce065ad29a2285e500fa
7
- data.tar.gz: 12c01121d669de6b3bdc22d5b44b6036152b8e06495f56542acb541f1600b360f154cfdf1dac279bd94648f0be85587009ae70c9a054f75e99f4aec816fd6f73
6
+ metadata.gz: 6e652dde2618ce68c0e0cf324a4be5a3738ec37dfdd62ff4f26dbf6422d4334c4d28aa91501d3803b060596307270427b8175118866ae76da203a3702f4404bb
7
+ data.tar.gz: 3ff924e24f09c82414730eaa441d5bd9f388a16f8885e203cedd3f14a9a866dafdebd43ede78aadb8254a7617734533fbef76809c0687274df63f5472bab6f8d
@@ -8,7 +8,7 @@ spec:
8
8
  serviceAccountName: build-bot
9
9
  params:
10
10
  - name: ci-image-name
11
- value: 237082684006.dkr.ecr.us-east-2.amazonaws.com/{{ .Values.gem }}-ci
11
+ value: onehq.azurecr.io/{{ .Values.gem }}-ci
12
12
  - name: gem-name
13
13
  value: "{{ .Values.gem }}"
14
14
  - name: publish
data/README.rdoc CHANGED
@@ -1,6 +1,4 @@
1
1
  = SendGrid WEB API gem for Rails 3
2
- {<img src="https://secure.travis-ci.org/kylejginavan/sendgrid_webapi.png"/>}[http://travis-ci.org/kylejginavan/sendgrid_webapi] {<img src="https://badge.fury.io/rb/sendgrid_webapi.png" alt="Gem Version" />}[http://badge.fury.io/rb/sendgrid_webapi] {<img src="https://codeclimate.com/github/kylejginavan/sendgrid_webapi.png" />}[https://codeclimate.com/github/kylejginavan/sendgrid_webapi]
3
-
4
2
  SendGrid WEB API gem allow you to retrieve information such as statistics, bounces, spam reports, unsubscribes, send email and other information.
5
3
 
6
4
  == Rails 3 configuration
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SendGridWebApi
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -0,0 +1,24 @@
1
+ module SendGridWebApi::Modules
2
+ class AddressWhitelist < SendGridWebApi::Client
3
+ ADDRESS_WHITELIST_URL = "mail_settings/address_whitelist"
4
+
5
+ def base_url
6
+ "https://api.sendgrid.com/v3/"
7
+ end
8
+
9
+ # Retrieve a list of all email addresses whitelist.
10
+ def get options = {}
11
+ query_api(ADDRESS_WHITELIST_URL, process_header_options(options))
12
+ end
13
+
14
+ # Add an email address to the whitelist.
15
+ def add options = {}
16
+ query_patch_api(ADDRESS_WHITELIST_URL, process_header_options(options))
17
+ end
18
+
19
+ # Delete an email address from the whitelist.
20
+ def delete options = {}
21
+ query_patch_api(ADDRESS_WHITELIST_URL, process_header_options(options))
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  #loading modules
2
- %w(bounces spam blocks invalid_emails unsubscribes parse event_notification stats profile mail).each do |mod|
2
+ %w(address_whitelist bounces spam blocks invalid_emails unsubscribes parse event_notification stats profile mail).each do |mod|
3
3
  require "web_api/" + mod
4
4
  end
5
5
 
@@ -43,6 +43,10 @@ module SendGridWebApi::Modules
43
43
  def mail
44
44
  @mail_instance ||= Mail.new(@api_key)
45
45
  end
46
+
47
+ def address_whitelist
48
+ @address_whitelist_instance ||= AddressWhitelist.new(@api_key)
49
+ end
46
50
 
47
51
  def sub_user
48
52
  @sub_user ||= SendGridWebApi::SubUser.new(@api_key)
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: patch
5
+ uri: https://api.sendgrid.com/v3/mail_settings/address_whitelist
6
+ body:
7
+ encoding: US-ASCII
8
+ string: '{"list":["new@example.com"]}'
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: '{"enabled":true,"list":["test@example.com","test2@example.com","new@example.com"]}'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:39:57 GMT
36
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: patch
5
+ uri: https://api.sendgrid.com/v3/mail_settings/address_whitelist
6
+ body:
7
+ encoding: US-ASCII
8
+ string: '{"list":["test2@example.com"]}'
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: '{"enabled":true,"list":["test@example.com","new@example.com"]}'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:39:57 GMT
36
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/mail_settings/address_whitelist
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: '{"enabled":true,"list":["test@example.com","test2@example.com"]}'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:39:57 GMT
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/blocks
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:37:37 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:37:37 GMT
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/blocks
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:37:37 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:37:37 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/blocks
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:37:40 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:37:40 GMT
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/blocks
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:37:40 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:37:40 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/blocks/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:37:38 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:37:39 GMT
3
+ - request:
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/suppression/blocks/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:37:38 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:37:39 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/bounces
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:31 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:31 GMT
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/bounces
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:31 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:31 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/bounces?limit=2&offset=1
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:31 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: '["email1@test.com", "email2@test.com"]'
34
- http_version:
35
- recorded_at: Fri, 17 Jan 2014 01:39:31 GMT
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/bounces?limit=2&offset=1
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:31 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: '["email1@test.com", "email2@test.com"]'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:39:31 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/bounces/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:32 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:32 GMT
3
+ - request:
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/suppression/bounces/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:32 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:32 GMT
36
36
  recorded_with: VCR 2.8.0