sendgrid_webapi 0.1.2 → 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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/.ruby-version +0 -0
- data/.tekton/Chart.lock +6 -0
- data/.tekton/Chart.yaml +14 -0
- data/.tekton/templates/pipelinerun.yaml +53 -0
- data/.tekton/values-main.yaml +14 -0
- data/.tekton/values-pr.yaml +8 -0
- data/.tekton/values.yaml +19 -0
- data/.tool-versions +0 -0
- data/Gemfile +0 -0
- data/MIT-LICENSE +0 -0
- data/README.rdoc +69 -20
- data/Rakefile +0 -0
- data/lib/api_key/management.rb +0 -0
- data/lib/api_key/modules.rb +0 -0
- data/lib/apikey_client.rb +0 -0
- data/lib/base.rb +7 -0
- data/lib/helper.rb +0 -0
- data/lib/middlewares/sendgrid_response.rb +0 -0
- data/lib/sendgrid_webapi.rb +0 -0
- data/lib/sub_user/apps.rb +0 -0
- data/lib/sub_user/auth.rb +0 -0
- data/lib/sub_user/bounces.rb +0 -0
- data/lib/sub_user/event_notification.rb +0 -0
- data/lib/sub_user/iframe.rb +0 -0
- data/lib/sub_user/invalid_emails.rb +0 -0
- data/lib/sub_user/ip_management.rb +0 -0
- data/lib/sub_user/limits.rb +0 -0
- data/lib/sub_user/management.rb +0 -0
- data/lib/sub_user/modules.rb +0 -0
- data/lib/sub_user/monitor_records.rb +0 -0
- data/lib/sub_user/parse.rb +0 -0
- data/lib/sub_user/spam.rb +0 -0
- data/lib/sub_user/stats.rb +0 -0
- data/lib/sub_user/unsubscribes.rb +0 -0
- data/lib/sub_user/white_label.rb +0 -0
- data/lib/subuser_client.rb +0 -0
- data/lib/version.rb +1 -1
- data/lib/web_api/address_whitelist.rb +24 -0
- data/lib/web_api/blocks.rb +20 -7
- data/lib/web_api/bounces.rb +19 -6
- data/lib/web_api/event_notification.rb +0 -0
- data/lib/web_api/invalid_emails.rb +15 -5
- data/lib/web_api/mail.rb +0 -0
- data/lib/web_api/modules.rb +5 -1
- data/lib/web_api/parse.rb +0 -0
- data/lib/web_api/profile.rb +0 -0
- data/lib/web_api/spam.rb +14 -4
- data/lib/web_api/stats.rb +0 -0
- data/lib/web_api/unsubscribes.rb +19 -6
- data/lib/web_api/version.rb +0 -0
- data/lib/webapi_client.rb +0 -0
- data/sendgrid_webapi.gemspec +0 -0
- data/spec/cassettes/client/_modules/_address_whitelist/should_add_email_to_whitelist.yml +36 -0
- data/spec/cassettes/client/_modules/_address_whitelist/should_delete_email_from_whitelist.yml +36 -0
- data/spec/cassettes/client/_modules/_address_whitelist/should_get_address_whitelist.yml +36 -0
- data/spec/cassettes/client/_modules/_block/should_get_block_emails.yml +33 -33
- data/spec/cassettes/client/_modules/_block/should_get_totals_blocks.yml +33 -33
- data/spec/cassettes/client/_modules/_block/should_try_delete_not_existing_block_email.yml +33 -33
- data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails.yml +33 -33
- data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails_using_params.yml +36 -0
- data/spec/cassettes/client/_modules/_bounce/should_get_totals_bounces.yml +0 -0
- data/spec/cassettes/client/_modules/_bounce/should_try_delete_not_existing_bounce_email.yml +33 -33
- data/spec/cassettes/client/_modules/_event_notification/should_delete_event_notification_url.yml +0 -0
- data/spec/cassettes/client/_modules/_event_notification/should_get_event_notification_url.yml +0 -0
- data/spec/cassettes/client/_modules/_event_notification/should_set_event_notification_url.yml +0 -0
- data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails.yml +33 -33
- data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails_emails_using_params.yml +37 -0
- data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails_using_params.yml +36 -0
- data/spec/cassettes/client/_modules/_invalid_email/should_try_delete_not_existing_invalid_emails.yml +33 -33
- data/spec/cassettes/client/_modules/_parse_email/should_delete_parse_email.yml +0 -0
- data/spec/cassettes/client/_modules/_parse_email/should_get_parse_email.yml +0 -0
- data/spec/cassettes/client/_modules/_parse_email/should_set_parse_email.yml +0 -0
- data/spec/cassettes/client/_modules/_profile/should_get_profile.yml +0 -0
- data/spec/cassettes/client/_modules/_profile/should_set_first_name.yml +0 -0
- data/spec/cassettes/client/_modules/_spam/should_get_spam_emails.yml +33 -33
- data/spec/cassettes/client/_modules/_spam/should_try_delete_not_existing_spam_emails.yml +33 -33
- data/spec/cassettes/client/_modules/_unsubscribe/should_add_unsubscribe_emails.yml +33 -33
- data/spec/cassettes/client/_modules/_unsubscribe/should_delete_unsubscribe_email.yml +33 -33
- data/spec/cassettes/client/_modules/_unsubscribe/should_get_unsubscribe_emails.yml +33 -33
- data/spec/cassettes/client/_modules/_unsubscribe/should_try_delete_not_existing_unsubscribe_emails.yml +33 -33
- data/spec/cassettes/helper/_create_sub_user_account/should_create_sub_user_account.yml +0 -0
- data/spec/cassettes/helper/_run_sendgrid_query/should_raise_with_unsucessfull_request.yml +0 -0
- data/spec/cassettes/helper/_run_sendgrid_query/should_run_sendgrid_request.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_activate_app.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_deactivate_app.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_get_current_setting_from_one_app.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_return_available_apps.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_set_current_app.yml +0 -0
- data/spec/cassettes/sub_user/_authentication/should_auth_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_authentication/should_return_error_with_a_bad_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_bounces/should_returns_bounce_emails.yml +0 -0
- data/spec/cassettes/sub_user/_bounces/should_tries_to_delete_unexisting_bounce_emails.yml +0 -0
- data/spec/cassettes/sub_user/_event_notification/should_add_event_notification_url.yml +0 -0
- data/spec/cassettes/sub_user/_event_notification/should_delete_event_notification_url.yml +0 -0
- data/spec/cassettes/sub_user/_event_notification/should_get_event_notification_url.yml +0 -0
- data/spec/cassettes/sub_user/_invalid_emails/should_return_invalid_emails.yml +0 -0
- data/spec/cassettes/sub_user/_invalid_emails/should_tries_to_delete_unexisting_invalid_mail.yml +0 -0
- data/spec/cassettes/sub_user/_ip_management/should_return_all_ips_available.yml +0 -0
- data/spec/cassettes/sub_user/_ip_management/should_show_ip_subuser.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_decrements_credits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_delete_all_limits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_increments_credits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_list_the_limits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_reset_all_limits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_returns_limits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_set_total_credits.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_add_new_subuser.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_disable_sub_user_for_send_email.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_enable_sub_user_for_access_to_website.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_enable_sub_user_for_send_email.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_update_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_add_existing_sub_user_to_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_create_a_new_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_delete_a_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_edit_a_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_remove_existing_sub_user_from_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_parse_email/should_delete_parse_email.yml +0 -0
- data/spec/cassettes/sub_user/_parse_email/should_get_parse_email.yml +0 -0
- data/spec/cassettes/sub_user/_parse_email/should_set_parse_email.yml +0 -0
- data/spec/cassettes/sub_user/_spam/should_return_spam_mails.yml +0 -0
- data/spec/cassettes/sub_user/_spam/should_tries_to_delete_unexisting_spam_mail.yml +0 -0
- data/spec/cassettes/sub_user/_unsubscribes/should_add_bounce_email.yml +0 -0
- data/spec/cassettes/sub_user/_unsubscribes/should_delete_existing_bounce_email.yml +0 -0
- data/spec/cassettes/sub_user/_unsubscribes/should_delete_unexisting_bounce_email.yml +0 -0
- data/spec/cassettes/sub_user/_unsubscribes/should_returns_bounce_emails.yml +0 -0
- data/spec/client_spec.rb +85 -52
- data/spec/helper_spec.rb +2 -3
- data/spec/internal/config/database-standard.yml +24 -0
- data/spec/spec_helper.rb +0 -4
- data/spec/sub_user_spec.rb +0 -0
- data/test.rb +0 -0
- metadata +21 -80
- data/.circleci/config.yml +0 -132
- data/.circleci/setup-rubygems.sh +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f7c07661a9477609e12ca455e47fd9b25bc6ebd2c9a78b40d2c8e4c3ecacb39
|
4
|
+
data.tar.gz: 85501d8dde08a350daf3c2a7767e720aacabaebff8cf2ba2bdfaaa76cc4f0cd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e652dde2618ce68c0e0cf324a4be5a3738ec37dfdd62ff4f26dbf6422d4334c4d28aa91501d3803b060596307270427b8175118866ae76da203a3702f4404bb
|
7
|
+
data.tar.gz: 3ff924e24f09c82414730eaa441d5bd9f388a16f8885e203cedd3f14a9a866dafdebd43ede78aadb8254a7617734533fbef76809c0687274df63f5472bab6f8d
|
data/.gitignore
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/.ruby-version
CHANGED
File without changes
|
data/.tekton/Chart.lock
ADDED
data/.tekton/Chart.yaml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
apiVersion: v2
|
2
|
+
name: pipeline
|
3
|
+
description: A Helm chart for Kubernetes
|
4
|
+
|
5
|
+
type: application
|
6
|
+
|
7
|
+
version: 0.1.0
|
8
|
+
|
9
|
+
dependencies:
|
10
|
+
- name: ruby-pipelines
|
11
|
+
alias: delivery
|
12
|
+
version: "0.2.0-dev.2"
|
13
|
+
repository: "oci://public.ecr.aws/c6o8b8d1"
|
14
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
apiVersion: tekton.dev/v1beta1
|
2
|
+
kind: PipelineRun
|
3
|
+
metadata:
|
4
|
+
name: {{ .Release.Name }}-{{ .Release.Revision }}
|
5
|
+
annotations:
|
6
|
+
"helm.sh/hook": post-upgrade,post-install
|
7
|
+
spec:
|
8
|
+
serviceAccountName: build-bot
|
9
|
+
params:
|
10
|
+
- name: ci-image-name
|
11
|
+
value: onehq.azurecr.io/{{ .Values.gem }}-ci
|
12
|
+
- name: gem-name
|
13
|
+
value: "{{ .Values.gem }}"
|
14
|
+
- name: publish
|
15
|
+
value: '{{ .Values.publish }}'
|
16
|
+
- name: git-url
|
17
|
+
value: "https://{{ .Values.git.provider }}/{{ .Values.git.organization }}/{{ .Values.git.repository }}.git"
|
18
|
+
- name: git-sha
|
19
|
+
value: "{{ .Values.git.sha }}"
|
20
|
+
- name: git-ref
|
21
|
+
value: "{{ required "Required .Values.git.ref" .Values.git.ref }}"
|
22
|
+
- name: rubyVersion
|
23
|
+
value: "{{ .Values.global.rubyVersion }}"
|
24
|
+
- name: run-rubocop
|
25
|
+
value: "{{ .Values.global.runRubocop }}"
|
26
|
+
- name: gem-repository
|
27
|
+
value: "{{ .Values.global.gemRepository }}"
|
28
|
+
workspaces:
|
29
|
+
|
30
|
+
|
31
|
+
pipelineRef:
|
32
|
+
name: gem-delivery
|
33
|
+
timeout: 1h30m0s
|
34
|
+
podTemplate:
|
35
|
+
volumes:
|
36
|
+
- name: oidc-token
|
37
|
+
projected:
|
38
|
+
sources:
|
39
|
+
- serviceAccountToken:
|
40
|
+
path: oidc-token
|
41
|
+
expirationSeconds: 1800
|
42
|
+
|
43
|
+
workspaces:
|
44
|
+
- name: git-source
|
45
|
+
volumeClaimTemplate:
|
46
|
+
spec:
|
47
|
+
storageClassName: rwm
|
48
|
+
accessModes:
|
49
|
+
- ReadWriteMany # access mode may affect how you can use this volume in parallel tasks
|
50
|
+
resources:
|
51
|
+
requests:
|
52
|
+
storage: 1Gi
|
53
|
+
|
data/.tekton/values.yaml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
publish: false
|
2
|
+
|
3
|
+
gem: &gem sendgrid_webapi
|
4
|
+
git:
|
5
|
+
provider: github.com
|
6
|
+
organization: OneHQ
|
7
|
+
repository: *gem
|
8
|
+
|
9
|
+
global:
|
10
|
+
taskAnnotations:
|
11
|
+
vault.security.banzaicloud.io/vault-addr: "https://vault-onehq.apps.hub.internal.onehq.com"
|
12
|
+
vault.security.banzaicloud.io/vault-path: "jwt-hub"
|
13
|
+
vault.security.banzaicloud.io/vault-auth-method: "jwt"
|
14
|
+
vault.security.banzaicloud.io/vault-tls-secret: "custom-trusted-ca"
|
15
|
+
gem: *gem
|
16
|
+
rubyVersion: 3.0.2
|
17
|
+
mountGemDockerfile: true
|
18
|
+
runRubocop: "false"
|
19
|
+
gemRepository: rubygems
|
data/.tool-versions
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/MIT-LICENSE
CHANGED
File without changes
|
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
|
@@ -26,51 +24,102 @@ for sendgrid v2 support
|
|
26
24
|
=== Bounces
|
27
25
|
This module allows you to retrieve and delete email addresses that have bounced from emails that you've delivered.
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
# Retrieve all of your bounces.
|
28
|
+
# A maximum of 500 bounces will be returned per query.
|
29
|
+
# You can use the offset and limit parameters to retrieve more or less than 500 results.
|
30
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
31
|
+
# * https://docs.sendgrid.com/api-reference/bounces-api/retrieve-all-bounces
|
32
|
+
# i.e client.bounces.get({ "on_behalf_of": "sub_user_email"})
|
33
|
+
# i.e using limit/offset: client.bounces.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
34
|
+
client.bounces.get (options)
|
35
|
+
|
36
|
+
# This method will delete all bounces from the given email.
|
37
|
+
# * https://docs.sendgrid.com/api-reference/bounces-api/delete-a-bounce
|
38
|
+
# i.e: client.bounces.delete( { on_behalf_of: "sub_user_email", email: "email@to.delete" })
|
39
|
+
client.bounces.delete(options)
|
40
|
+
|
41
|
+
# Deprecated: Count is no longer supported on SendGrid v3.
|
42
|
+
# As an alternative, SendGrid recommends to query depending on time frames since `get` limit is 500.
|
43
|
+
# Deprecated, under the hood it's doing a get an returning the count
|
33
44
|
client.blocks.count
|
34
45
|
|
35
|
-
* options are available here:
|
46
|
+
* options are available here: https://docs.sendgrid.com/api-reference/bounces-api
|
36
47
|
|
37
48
|
=== Blocks
|
38
49
|
This module allows you to retrieve and delete email addresses that were blocked by their ISP. These emails are not suppressed and are just for information.
|
39
|
-
|
50
|
+
# Retrieve all of your blocks.
|
51
|
+
# A maximum of 500 blocks will be returned per query.
|
52
|
+
# You can use the offset and limit parameters to retrieve more or less than 500 results.
|
53
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
54
|
+
#* https://docs.sendgrid.com/api-reference/blocks-api/retrieve-all-blocks
|
55
|
+
# i.e: client.blocks.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
40
56
|
client.blocks.get(options)
|
41
|
-
|
42
|
-
|
43
|
-
|
57
|
+
|
58
|
+
|
59
|
+
# This method will delete all blocks from the given email
|
60
|
+
# * https://docs.sendgrid.com/api-reference/blocks-api/delete-blocks
|
61
|
+
# i.e: client.blocks.delete( { on_behalf_of: "sub_user_email", email: "email@example.com" })
|
62
|
+
client.blocks.delete(options)
|
63
|
+
|
64
|
+
# Deprecated: Count is no longer supported on SendGrid v3.
|
65
|
+
# As an alternative, SendGrid recommends to query depending on time frames since `get` limit is 500.
|
44
66
|
client.blocks.count
|
45
67
|
|
46
|
-
* options are available here:
|
68
|
+
* options are available here: https://docs.sendgrid.com/api-reference/blocks-api
|
47
69
|
|
48
70
|
=== Invalid Email
|
49
71
|
This module allows you to retrieve and delete email addresses that you've sent to that are invalid email addresses.
|
50
|
-
|
72
|
+
# Retrieve a list of all invalid email addresses.
|
73
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
74
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
75
|
+
# * https://docs.sendgrid.com/api-reference/invalid-e-mails-api/retrieve-all-invalid-emails
|
76
|
+
# i.e: client.invalid_emails.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
51
77
|
client.invalid_emails.get(options)
|
52
78
|
|
53
|
-
|
79
|
+
# This method will delete all invalid_emails from the given email
|
80
|
+
# * https://docs.sendgrid.com/api-reference/invalid-e-mails-api/delete-a-specific-invalid-email
|
81
|
+
# i.e: client.invalid_emails.delete( { on_behalf_of: "sub_user_email", email: "email@example.com" })
|
82
|
+
client.invalid_emails.delete(options)
|
54
83
|
|
55
|
-
* options are available here:
|
84
|
+
* options are available here: https://docs.sendgrid.com/api-reference/invalid-e-mails-api
|
56
85
|
|
57
86
|
=== Spam Report
|
58
87
|
This module allows you to retrieve and delete email addresses that have marked your emails as SPAM.
|
59
|
-
|
88
|
+
# Retrieve a list of all spam reports.
|
89
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
90
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
91
|
+
# * https://docs.sendgrid.com/api-reference/spam-reports-api/retrieve-all-spam-reports
|
92
|
+
# i.e: client.spam.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
60
93
|
client.spam.get(options)
|
61
94
|
|
62
|
-
|
95
|
+
# This method will delete all spam_reports from the given email.
|
96
|
+
# * https://docs.sendgrid.com/api-reference/spam-reports-api/delete-a-specific-spam-report
|
97
|
+
# i.e: client.spam.delete( { on_behalf_of: "sub_user_email", email: "email@example.com" })
|
98
|
+
client.spam.delete(options)
|
63
99
|
|
64
100
|
* options are available here: http://sendgrid.com/docs/API_Reference/Web_API/spam_reports.html
|
65
101
|
|
66
102
|
=== Unsubscribes
|
67
103
|
This module allows you to add, retrieve and delete email addresses that were unsubscribed from your emails.
|
68
104
|
|
69
|
-
|
70
|
-
|
105
|
+
|
106
|
+
# Example @email_client.send(:unsubscribes).delete( { email: "test@example.com", on_behalf_of: "sub_user_email" })
|
107
|
+
# * https://docs.sendgrid.com/api-reference/suppressions-global-suppressions/add-recipient-addresses-to-the-global-suppression-group
|
108
|
+
# i.e: client.unsubscribes.add( { on_behalf_of: "sub_user_email, recipient_emails: ["test@example.com"] })
|
109
|
+
client.unsubscribes.add(options)
|
110
|
+
|
111
|
+
# Retrieve a list of all email address that are globally suppressed.
|
112
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
113
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
114
|
+
# * https://docs.sendgrid.com/api-reference/suppressions-global-suppressions/retrieve-all-global-suppressions
|
115
|
+
# client.unsubscribes.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
71
116
|
client.unsubscribes.get(options)
|
72
117
|
|
73
|
-
|
118
|
+
|
119
|
+
# This method will delete all unsubscribes from the given email
|
120
|
+
# * https://docs.sendgrid.com/api-reference/suppressions-global-suppressions/delete-a-global-suppression
|
121
|
+
# i.e: client.unsubscribes.delete( { on_behalf_of: "sub_user_email", email: "email@example.com" })
|
122
|
+
client.unsubscribes.delete(options)
|
74
123
|
|
75
124
|
* options are available here: http://sendgrid.com/docs/API_Reference/Web_API/unsubscribes.html
|
76
125
|
|
data/Rakefile
CHANGED
File without changes
|
data/lib/api_key/management.rb
CHANGED
File without changes
|
data/lib/api_key/modules.rb
CHANGED
File without changes
|
data/lib/apikey_client.rb
CHANGED
File without changes
|
data/lib/base.rb
CHANGED
@@ -71,5 +71,12 @@ module SendGridWebApi
|
|
71
71
|
conn.adapter Faraday.default_adapter
|
72
72
|
end
|
73
73
|
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def process_header_options options
|
77
|
+
on_behalf_of = options.delete(:on_behalf_of)
|
78
|
+
options.merge!({ headers: { "on-behalf-of" => on_behalf_of } }) unless on_behalf_of.nil?
|
79
|
+
options
|
80
|
+
end
|
74
81
|
end
|
75
82
|
end
|
data/lib/helper.rb
CHANGED
File without changes
|
File without changes
|
data/lib/sendgrid_webapi.rb
CHANGED
File without changes
|
data/lib/sub_user/apps.rb
CHANGED
File without changes
|
data/lib/sub_user/auth.rb
CHANGED
File without changes
|
data/lib/sub_user/bounces.rb
CHANGED
File without changes
|
File without changes
|
data/lib/sub_user/iframe.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/lib/sub_user/limits.rb
CHANGED
File without changes
|
data/lib/sub_user/management.rb
CHANGED
File without changes
|
data/lib/sub_user/modules.rb
CHANGED
File without changes
|
File without changes
|
data/lib/sub_user/parse.rb
CHANGED
File without changes
|
data/lib/sub_user/spam.rb
CHANGED
File without changes
|
data/lib/sub_user/stats.rb
CHANGED
File without changes
|
File without changes
|
data/lib/sub_user/white_label.rb
CHANGED
File without changes
|
data/lib/subuser_client.rb
CHANGED
File without changes
|
data/lib/version.rb
CHANGED
@@ -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
|
data/lib/web_api/blocks.rb
CHANGED
@@ -1,18 +1,31 @@
|
|
1
1
|
module SendGridWebApi::Modules
|
2
2
|
class Block < SendGridWebApi::Client
|
3
|
+
BLOCKS_URL = "suppression/blocks"
|
4
|
+
|
5
|
+
def base_url
|
6
|
+
"https://api.sendgrid.com/v3/"
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve all of your blocks.
|
10
|
+
# A maximum of 500 blocks will be returned per query.
|
11
|
+
# You can use the offset and limit parameters to retrieve more or less than 500 results.
|
12
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
3
13
|
def get options = {}
|
4
|
-
|
5
|
-
query_api(block_get_url, options)
|
14
|
+
query_api(BLOCKS_URL, process_header_options(options))
|
6
15
|
end
|
7
16
|
|
17
|
+
# This method will delete all blocks from the given email
|
8
18
|
def delete options = {}
|
9
|
-
|
10
|
-
|
19
|
+
delete_url = BLOCKS_URL+"/#{options[:email]}"
|
20
|
+
options.delete(:email)
|
21
|
+
query_delete_api(delete_url, process_header_options(options))
|
11
22
|
end
|
12
23
|
|
24
|
+
# Deprecated: Count is no longer supported on SendGrid v3.
|
25
|
+
# As an alternative, SendGrid recommends to query depending on time frames since `get` limit is 500.
|
13
26
|
def count options = {}
|
14
|
-
|
15
|
-
|
27
|
+
count = query_api(BLOCKS_URL, process_header_options(options)).count
|
28
|
+
{count: count}
|
16
29
|
end
|
17
30
|
end
|
18
|
-
end
|
31
|
+
end
|
data/lib/web_api/bounces.rb
CHANGED
@@ -1,18 +1,31 @@
|
|
1
1
|
module SendGridWebApi::Modules
|
2
2
|
class Bounce < SendGridWebApi::Client
|
3
|
+
BOUNCES_URL = "suppression/bounces"
|
4
|
+
|
5
|
+
def base_url
|
6
|
+
"https://api.sendgrid.com/v3/"
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve all of your bounces.
|
10
|
+
# A maximum of 500 bounces will be returned per query.
|
11
|
+
# You can use the offset and limit parameters to retrieve more or less than 500 results.
|
12
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
3
13
|
def get options = {}
|
4
|
-
|
5
|
-
query_api(bounce_get_url, options)
|
14
|
+
query_api(BOUNCES_URL, process_header_options(options))
|
6
15
|
end
|
7
16
|
|
17
|
+
# This method will delete all bounces from the given email.
|
8
18
|
def delete options = {}
|
9
|
-
|
10
|
-
|
19
|
+
delete_url = BOUNCES_URL+"/#{options[:email]}"
|
20
|
+
options.delete(:email)
|
21
|
+
query_delete_api(delete_url, process_header_options(options))
|
11
22
|
end
|
12
23
|
|
24
|
+
# Deprecated: Count is no longer supported on SendGrid v3.
|
25
|
+
# As an alternative, SendGrid recommends to query depending on time frames since `get` limit is 500.
|
13
26
|
def count options = {}
|
14
|
-
|
15
|
-
|
27
|
+
count = query_api(BOUNCES_URL, process_header_options(options)).count
|
28
|
+
{count: count}
|
16
29
|
end
|
17
30
|
end
|
18
31
|
end
|
File without changes
|
@@ -1,13 +1,23 @@
|
|
1
1
|
module SendGridWebApi::Modules
|
2
2
|
class InvalidEmail < SendGridWebApi::Client
|
3
|
+
INVALID_EMAILS_URL = "suppression/invalid_emails"
|
4
|
+
|
5
|
+
def base_url
|
6
|
+
"https://api.sendgrid.com/v3/"
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a list of all invalid email addresses.
|
10
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
11
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
3
12
|
def get options = {}
|
4
|
-
|
5
|
-
query_api(invalid_email_get_url, options)
|
13
|
+
query_api(INVALID_EMAILS_URL, process_header_options(options))
|
6
14
|
end
|
7
15
|
|
16
|
+
# This method will delete all invalid_emails from the given email
|
8
17
|
def delete options = {}
|
9
|
-
|
10
|
-
|
11
|
-
|
18
|
+
delete_url = INVALID_EMAILS_URL+"/#{options[:email]}"
|
19
|
+
options.delete(:email)
|
20
|
+
query_delete_api(delete_url, process_header_options(options))
|
21
|
+
end
|
12
22
|
end
|
13
23
|
end
|
data/lib/web_api/mail.rb
CHANGED
File without changes
|
data/lib/web_api/modules.rb
CHANGED
@@ -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)
|
data/lib/web_api/parse.rb
CHANGED
File without changes
|
data/lib/web_api/profile.rb
CHANGED
File without changes
|
data/lib/web_api/spam.rb
CHANGED
@@ -1,13 +1,23 @@
|
|
1
1
|
module SendGridWebApi::Modules
|
2
2
|
class Spam < SendGridWebApi::Client
|
3
|
+
SPAM_REPORTS_URL = "suppression/spam_reports"
|
4
|
+
|
5
|
+
def base_url
|
6
|
+
"https://api.sendgrid.com/v3/"
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a list of all spam reports.
|
10
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
11
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
3
12
|
def get options = {}
|
4
|
-
|
5
|
-
query_api(spam_get_url, options)
|
13
|
+
query_api(SPAM_REPORTS_URL, process_header_options(options))
|
6
14
|
end
|
7
15
|
|
16
|
+
# This method will delete all spam_reports from the given email.
|
8
17
|
def delete options = {}
|
9
|
-
|
10
|
-
|
18
|
+
delete_url = SPAM_REPORTS_URL+"/#{options[:email]}"
|
19
|
+
options.delete(:email)
|
20
|
+
query_delete_api(delete_url, process_header_options(options))
|
11
21
|
end
|
12
22
|
end
|
13
23
|
end
|
data/lib/web_api/stats.rb
CHANGED
File without changes
|
data/lib/web_api/unsubscribes.rb
CHANGED
@@ -1,18 +1,31 @@
|
|
1
1
|
module SendGridWebApi::Modules
|
2
2
|
class Unsubscribe < SendGridWebApi::Client
|
3
|
+
def base_url
|
4
|
+
"https://api.sendgrid.com/v3/"
|
5
|
+
end
|
6
|
+
|
7
|
+
# Retrieve a list of all email address that are globally suppressed.
|
8
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
9
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
3
10
|
def get options = {}
|
4
|
-
|
5
|
-
query_api(
|
11
|
+
unsubscribe_url = "suppression/unsubscribes"
|
12
|
+
query_api(unsubscribe_url, process_header_options(options))
|
6
13
|
end
|
7
14
|
|
15
|
+
# Add one or more email addresses to the global suppressions group.
|
16
|
+
# Expects options => recipient_emails: ["test@example.com"]
|
8
17
|
def add options = {}
|
9
|
-
|
10
|
-
|
18
|
+
unsubscribe_url = "asm/suppressions/global"
|
19
|
+
query_post_json_api(unsubscribe_url, process_header_options(options))
|
11
20
|
end
|
12
21
|
|
22
|
+
# This method will delete all unsubscribes from the given email
|
13
23
|
def delete options = {}
|
14
|
-
|
15
|
-
|
24
|
+
unsubscribe_url = "asm/suppressions/global"
|
25
|
+
delete_url = unsubscribe_url + "/#{options[:email]}"
|
26
|
+
options.delete(:email)
|
27
|
+
|
28
|
+
query_delete_api(delete_url, process_header_options(options))
|
16
29
|
end
|
17
30
|
end
|
18
31
|
end
|
data/lib/web_api/version.rb
CHANGED
File without changes
|
data/lib/webapi_client.rb
CHANGED
File without changes
|
data/sendgrid_webapi.gemspec
CHANGED
File without changes
|
@@ -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
|