sendgrid_webapi 0.1.1 → 0.2.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/.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 -1
- data/MIT-LICENSE +20 -0
- data/README.rdoc +69 -18
- 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/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 +0 -0
- 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 +7 -1
- data/spec/cassettes/client/_modules/_block/should_get_block_emails.yml +1 -1
- data/spec/cassettes/client/_modules/_block/should_get_totals_blocks.yml +2 -2
- data/spec/cassettes/client/_modules/_block/should_try_delete_not_existing_block_email.yml +2 -2
- data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails.yml +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- data/spec/cassettes/client/_modules/_spam/should_try_delete_not_existing_spam_emails.yml +2 -2
- data/spec/cassettes/client/_modules/_unsubscribe/should_add_unsubscribe_emails.yml +2 -2
- data/spec/cassettes/client/_modules/_unsubscribe/should_delete_unsubscribe_email.yml +2 -2
- data/spec/cassettes/client/_modules/_unsubscribe/should_get_unsubscribe_emails.yml +1 -1
- data/spec/cassettes/client/_modules/_unsubscribe/should_try_delete_not_existing_unsubscribe_emails.yml +3 -3
- 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 +68 -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 +20 -81
- 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: 3d193cbbc918879debc5aee92e0f7397be4f83a4d876bac7a049dd42c9a9a671
|
|
4
|
+
data.tar.gz: ae235e49239b82ed69de5c93654555cc93f702e6905928e6fb89de0fc6427fe5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b65c616400aeeaa7e5bfff61f0626635558986679c3f56b4dc9e42c165c68cdf7998a4b8574a1cc60d2b0c96ce3f18982dfb2d69c197ce065ad29a2285e500fa
|
|
7
|
+
data.tar.gz: 12c01121d669de6b3bdc22d5b44b6036152b8e06495f56542acb541f1600b360f154cfdf1dac279bd94648f0be85587009ae70c9a054f75e99f4aec816fd6f73
|
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: 237082684006.dkr.ecr.us-east-2.amazonaws.com/{{ .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
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2021 Kyle Ginavan
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
|
@@ -26,51 +26,102 @@ for sendgrid v2 support
|
|
|
26
26
|
=== Bounces
|
|
27
27
|
This module allows you to retrieve and delete email addresses that have bounced from emails that you've delivered.
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
# Retrieve all of your bounces.
|
|
30
|
+
# A maximum of 500 bounces will be returned per query.
|
|
31
|
+
# You can use the offset and limit parameters to retrieve more or less than 500 results.
|
|
32
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
|
33
|
+
# * https://docs.sendgrid.com/api-reference/bounces-api/retrieve-all-bounces
|
|
34
|
+
# i.e client.bounces.get({ "on_behalf_of": "sub_user_email"})
|
|
35
|
+
# i.e using limit/offset: client.bounces.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
|
36
|
+
client.bounces.get (options)
|
|
37
|
+
|
|
38
|
+
# This method will delete all bounces from the given email.
|
|
39
|
+
# * https://docs.sendgrid.com/api-reference/bounces-api/delete-a-bounce
|
|
40
|
+
# i.e: client.bounces.delete( { on_behalf_of: "sub_user_email", email: "email@to.delete" })
|
|
41
|
+
client.bounces.delete(options)
|
|
42
|
+
|
|
43
|
+
# Deprecated: Count is no longer supported on SendGrid v3.
|
|
44
|
+
# As an alternative, SendGrid recommends to query depending on time frames since `get` limit is 500.
|
|
45
|
+
# Deprecated, under the hood it's doing a get an returning the count
|
|
33
46
|
client.blocks.count
|
|
34
47
|
|
|
35
|
-
* options are available here:
|
|
48
|
+
* options are available here: https://docs.sendgrid.com/api-reference/bounces-api
|
|
36
49
|
|
|
37
50
|
=== Blocks
|
|
38
51
|
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
|
-
|
|
52
|
+
# Retrieve all of your blocks.
|
|
53
|
+
# A maximum of 500 blocks will be returned per query.
|
|
54
|
+
# You can use the offset and limit parameters to retrieve more or less than 500 results.
|
|
55
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
|
56
|
+
#* https://docs.sendgrid.com/api-reference/blocks-api/retrieve-all-blocks
|
|
57
|
+
# i.e: client.blocks.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
|
40
58
|
client.blocks.get(options)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# This method will delete all blocks from the given email
|
|
62
|
+
# * https://docs.sendgrid.com/api-reference/blocks-api/delete-blocks
|
|
63
|
+
# i.e: client.blocks.delete( { on_behalf_of: "sub_user_email", email: "email@example.com" })
|
|
64
|
+
client.blocks.delete(options)
|
|
65
|
+
|
|
66
|
+
# Deprecated: Count is no longer supported on SendGrid v3.
|
|
67
|
+
# As an alternative, SendGrid recommends to query depending on time frames since `get` limit is 500.
|
|
44
68
|
client.blocks.count
|
|
45
69
|
|
|
46
|
-
* options are available here:
|
|
70
|
+
* options are available here: https://docs.sendgrid.com/api-reference/blocks-api
|
|
47
71
|
|
|
48
72
|
=== Invalid Email
|
|
49
73
|
This module allows you to retrieve and delete email addresses that you've sent to that are invalid email addresses.
|
|
50
|
-
|
|
74
|
+
# Retrieve a list of all invalid email addresses.
|
|
75
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
|
76
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
|
77
|
+
# * https://docs.sendgrid.com/api-reference/invalid-e-mails-api/retrieve-all-invalid-emails
|
|
78
|
+
# i.e: client.invalid_emails.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
|
51
79
|
client.invalid_emails.get(options)
|
|
52
80
|
|
|
53
|
-
|
|
81
|
+
# This method will delete all invalid_emails from the given email
|
|
82
|
+
# * https://docs.sendgrid.com/api-reference/invalid-e-mails-api/delete-a-specific-invalid-email
|
|
83
|
+
# i.e: client.invalid_emails.delete( { on_behalf_of: "sub_user_email", email: "email@example.com" })
|
|
84
|
+
client.invalid_emails.delete(options)
|
|
54
85
|
|
|
55
|
-
* options are available here:
|
|
86
|
+
* options are available here: https://docs.sendgrid.com/api-reference/invalid-e-mails-api
|
|
56
87
|
|
|
57
88
|
=== Spam Report
|
|
58
89
|
This module allows you to retrieve and delete email addresses that have marked your emails as SPAM.
|
|
59
|
-
|
|
90
|
+
# Retrieve a list of all spam reports.
|
|
91
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
|
92
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
|
93
|
+
# * https://docs.sendgrid.com/api-reference/spam-reports-api/retrieve-all-spam-reports
|
|
94
|
+
# i.e: client.spam.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
|
60
95
|
client.spam.get(options)
|
|
61
96
|
|
|
62
|
-
|
|
97
|
+
# This method will delete all spam_reports from the given email.
|
|
98
|
+
# * https://docs.sendgrid.com/api-reference/spam-reports-api/delete-a-specific-spam-report
|
|
99
|
+
# i.e: client.spam.delete( { on_behalf_of: "sub_user_email", email: "email@example.com" })
|
|
100
|
+
client.spam.delete(options)
|
|
63
101
|
|
|
64
102
|
* options are available here: http://sendgrid.com/docs/API_Reference/Web_API/spam_reports.html
|
|
65
103
|
|
|
66
104
|
=== Unsubscribes
|
|
67
105
|
This module allows you to add, retrieve and delete email addresses that were unsubscribed from your emails.
|
|
68
106
|
|
|
69
|
-
|
|
70
|
-
|
|
107
|
+
|
|
108
|
+
# Example @email_client.send(:unsubscribes).delete( { email: "test@example.com", on_behalf_of: "sub_user_email" })
|
|
109
|
+
# * https://docs.sendgrid.com/api-reference/suppressions-global-suppressions/add-recipient-addresses-to-the-global-suppression-group
|
|
110
|
+
# i.e: client.unsubscribes.add( { on_behalf_of: "sub_user_email, recipient_emails: ["test@example.com"] })
|
|
111
|
+
client.unsubscribes.add(options)
|
|
112
|
+
|
|
113
|
+
# Retrieve a list of all email address that are globally suppressed.
|
|
114
|
+
# You can use the offset and limit parameters to retrieve a custom number of results.
|
|
115
|
+
# You can use the start_time and end_time parameters to filter by time frames.
|
|
116
|
+
# * https://docs.sendgrid.com/api-reference/suppressions-global-suppressions/retrieve-all-global-suppressions
|
|
117
|
+
# client.unsubscribes.get({ on_behalf_of: "sub_user_email", limit: 100, offset: 1 })
|
|
71
118
|
client.unsubscribes.get(options)
|
|
72
119
|
|
|
73
|
-
|
|
120
|
+
|
|
121
|
+
# This method will delete all unsubscribes from the given email
|
|
122
|
+
# * https://docs.sendgrid.com/api-reference/suppressions-global-suppressions/delete-a-global-suppression
|
|
123
|
+
# i.e: client.unsubscribes.delete( { on_behalf_of: "sub_user_email", email: "email@example.com" })
|
|
124
|
+
client.unsubscribes.delete(options)
|
|
74
125
|
|
|
75
126
|
* options are available here: http://sendgrid.com/docs/API_Reference/Web_API/unsubscribes.html
|
|
76
127
|
|
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
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
|
File without changes
|
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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
require "version"
|
|
4
|
+
|
|
4
5
|
Gem::Specification.new do |s|
|
|
5
6
|
s.name = "sendgrid_webapi"
|
|
6
7
|
s.version = SendGridWebApi::VERSION
|
|
@@ -10,16 +11,21 @@ Gem::Specification.new do |s|
|
|
|
10
11
|
s.homepage = "https://github.com/kylejginavan/sendgrid_webapi"
|
|
11
12
|
s.summary = %q{SendGrid WEB API gem fo Rails}
|
|
12
13
|
s.description = %q{Gem for access to SendGrid WEB API from rails}
|
|
14
|
+
s.license = "MIT"
|
|
15
|
+
|
|
13
16
|
s.rubyforge_project = "sendgrid_webapi"
|
|
17
|
+
|
|
14
18
|
s.files = `git ls-files`.split("\n")
|
|
15
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
16
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
17
21
|
s.require_paths = ["lib"]
|
|
22
|
+
|
|
18
23
|
s.add_dependency "faraday", "~> 1.0"
|
|
19
24
|
s.add_dependency "faraday_middleware", "~> 1.0"
|
|
20
25
|
s.add_dependency "json", "~> 2.0"
|
|
26
|
+
|
|
21
27
|
s.add_development_dependency "rspec", "~> 3.4"
|
|
22
28
|
s.add_development_dependency "webmock", "~> 3.12"
|
|
23
29
|
s.add_development_dependency "vcr", "~> 6.0"
|
|
24
30
|
s.add_development_dependency "rspec_junit_formatter", "~> 0.3", ">= 0.3.0"
|
|
25
|
-
end
|
|
31
|
+
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: get
|
|
5
|
-
uri: https://api.sendgrid.com/
|
|
5
|
+
uri: https://api.sendgrid.com/v3/suppression/blocks
|
|
6
6
|
body:
|
|
7
7
|
encoding: US-ASCII
|
|
8
8
|
string: ''
|
|
@@ -30,7 +30,7 @@ http_interactions:
|
|
|
30
30
|
- keep-alive
|
|
31
31
|
body:
|
|
32
32
|
encoding: UTF-8
|
|
33
|
-
string: '
|
|
33
|
+
string: '[]'
|
|
34
34
|
http_version:
|
|
35
35
|
recorded_at: Fri, 17 Jan 2014 01:37:40 GMT
|
|
36
36
|
recorded_with: VCR 2.8.0
|