zerobounce-sdk 1.2.0 → 2.1.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/.dockerignore +17 -0
- data/.env.example +3 -0
- data/.github/auto_assign.yml +5 -0
- data/.github/dependabot.yml +35 -0
- data/.github/workflows/auto_assign_ci.yaml +21 -0
- data/.github/workflows/codeql.yml +105 -0
- data/.github/workflows/sdk_ci.yml +29 -0
- data/.gitignore +6 -0
- data/CODE_OF_CONDUCT.md +1 -6
- data/CONTRIBUTING.md +112 -1
- data/Dockerfile +17 -0
- data/Gemfile.lock +6 -2
- data/LICENSE +1 -1
- data/LICENSE.txt +6 -6
- data/README.md +52 -20
- data/SECURITY.md +21 -0
- data/documentation.md +29 -11
- data/lib/zerobounce/base_request.rb +31 -3
- data/lib/zerobounce/download_type.rb +10 -0
- data/lib/zerobounce/get_file_helper.rb +90 -0
- data/lib/zerobounce/get_file_options.rb +14 -0
- data/lib/zerobounce/mock_request.rb +6 -0
- data/lib/zerobounce/request.rb +7 -0
- data/lib/zerobounce/validate_status.rb +17 -0
- data/lib/zerobounce/validate_sub_status.rb +40 -0
- data/lib/zerobounce/version.rb +1 -1
- data/lib/zerobounce.rb +90 -16
- data/zerobounce.gemspec +2 -0
- metadata +45 -8
- data/.env.sample +0 -5
- data/documentation_es.md +0 -524
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2dc83468988043fa3a7907c8c9cbfac6185cc54f6e02d56c89e0be0cd1f1d24b
|
|
4
|
+
data.tar.gz: 410e9b0308a04ba30400123609247b6216c3005b5843ae6a8eb41951ea178171
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c650c338d1ebcf6222fd047b99682bec4e0f6da937e8b06cc2d2dfcb47db975f3ba3b39c909f91ddd7b8c1ab4ae38087dc4c9bfcce166a95ad130de9f34c3e1
|
|
7
|
+
data.tar.gz: cf4b1948a0eb8017cf4e0c1a07658f013d10b0effc35b4483d299df1bbf2117bd7f7dab40ba9bddeb744272217739e31ad9dc95711d4d32d143a5692d49d54df
|
data/.dockerignore
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Keep .git so gemspec `git ls-files` works during `bundle install` in the image.
|
|
2
|
+
|
|
3
|
+
# Docs and tooling not needed to run specs in the image
|
|
4
|
+
*.md
|
|
5
|
+
documentation*.md
|
|
6
|
+
.spec
|
|
7
|
+
.rspec_status
|
|
8
|
+
coverage/
|
|
9
|
+
tmp/
|
|
10
|
+
pkg/
|
|
11
|
+
vendor/bundle
|
|
12
|
+
|
|
13
|
+
# OS & env
|
|
14
|
+
.DS_Store
|
|
15
|
+
Thumbs.db
|
|
16
|
+
.env
|
|
17
|
+
.env.*
|
data/.env.example
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#versioning-strategy
|
|
4
|
+
|
|
5
|
+
version: 2
|
|
6
|
+
updates:
|
|
7
|
+
# Keep the Ruby dependencies up to date
|
|
8
|
+
- package-ecosystem: "bundler"
|
|
9
|
+
directory: "/"
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
|
12
|
+
day: "monday"
|
|
13
|
+
target-branch: "develop"
|
|
14
|
+
labels:
|
|
15
|
+
- "ruby dependencies"
|
|
16
|
+
groups:
|
|
17
|
+
bundler:
|
|
18
|
+
applies-to: version-updates
|
|
19
|
+
patterns:
|
|
20
|
+
- "*"
|
|
21
|
+
|
|
22
|
+
# Keep the Github Actions dependencies up to date
|
|
23
|
+
- package-ecosystem: "github-actions"
|
|
24
|
+
directory: "/"
|
|
25
|
+
schedule:
|
|
26
|
+
interval: "weekly"
|
|
27
|
+
day: "monday"
|
|
28
|
+
target-branch: "develop"
|
|
29
|
+
labels:
|
|
30
|
+
- "github dependencies"
|
|
31
|
+
groups:
|
|
32
|
+
github:
|
|
33
|
+
applies-to: version-updates
|
|
34
|
+
patterns:
|
|
35
|
+
- "*"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Auto Assign
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- synchronize
|
|
8
|
+
- reopened
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
add-assignee:
|
|
16
|
+
name: Auto assign (me only)
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: kentaro-m/auto-assign-action@v2.0.2
|
|
20
|
+
with:
|
|
21
|
+
configuration-path: ".github/auto_assign.yml"
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL Advanced"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ "develop" ]
|
|
17
|
+
pull_request:
|
|
18
|
+
branches: [ "develop" ]
|
|
19
|
+
schedule:
|
|
20
|
+
- cron: '19 14 * * 4'
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
security-events: write
|
|
24
|
+
packages: read
|
|
25
|
+
actions: read
|
|
26
|
+
contents: read
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
analyze:
|
|
30
|
+
name: Analyze (${{ matrix.language }})
|
|
31
|
+
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
|
32
|
+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
|
33
|
+
# - https://gh.io/supported-runners-and-hardware-resources
|
|
34
|
+
# - https://gh.io/using-larger-runners (GitHub.com only)
|
|
35
|
+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
|
36
|
+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
|
37
|
+
permissions:
|
|
38
|
+
# required for all workflows
|
|
39
|
+
security-events: write
|
|
40
|
+
|
|
41
|
+
# required to fetch internal or private CodeQL packs
|
|
42
|
+
packages: read
|
|
43
|
+
|
|
44
|
+
# only required for workflows in private repositories
|
|
45
|
+
actions: read
|
|
46
|
+
contents: read
|
|
47
|
+
|
|
48
|
+
strategy:
|
|
49
|
+
fail-fast: false
|
|
50
|
+
matrix:
|
|
51
|
+
include:
|
|
52
|
+
- language: ruby
|
|
53
|
+
build-mode: none
|
|
54
|
+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
|
|
55
|
+
# Use `c-cpp` to analyze code written in C, C++ or both
|
|
56
|
+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
|
|
57
|
+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
|
58
|
+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
|
|
59
|
+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
|
|
60
|
+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
|
|
61
|
+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
|
|
62
|
+
steps:
|
|
63
|
+
- name: Checkout repository
|
|
64
|
+
uses: actions/checkout@v6
|
|
65
|
+
|
|
66
|
+
# Add any setup steps before running the `github/codeql-action/init` action.
|
|
67
|
+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
|
|
68
|
+
# or others). This is typically only required for manual builds.
|
|
69
|
+
# - name: Setup runtime (example)
|
|
70
|
+
# uses: actions/setup-example@v1
|
|
71
|
+
|
|
72
|
+
# Initializes the CodeQL tools for scanning.
|
|
73
|
+
- name: Initialize CodeQL
|
|
74
|
+
uses: github/codeql-action/init@v4
|
|
75
|
+
with:
|
|
76
|
+
languages: ${{ matrix.language }}
|
|
77
|
+
build-mode: ${{ matrix.build-mode }}
|
|
78
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
79
|
+
# By default, queries listed here will override any specified in a config file.
|
|
80
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
81
|
+
|
|
82
|
+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
83
|
+
# queries: security-extended,security-and-quality
|
|
84
|
+
|
|
85
|
+
# If the analyze step fails for one of the languages you are analyzing with
|
|
86
|
+
# "We were unable to automatically build your code", modify the matrix above
|
|
87
|
+
# to set the build mode to "manual" for that language. Then modify this step
|
|
88
|
+
# to build your code.
|
|
89
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
90
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
91
|
+
- name: Run manual build steps
|
|
92
|
+
if: matrix.build-mode == 'manual'
|
|
93
|
+
shell: bash
|
|
94
|
+
run: |
|
|
95
|
+
echo 'If you are using a "manual" build mode for one or more of the' \
|
|
96
|
+
'languages you are analyzing, replace this with the commands to build' \
|
|
97
|
+
'your code, for example:'
|
|
98
|
+
echo ' make bootstrap'
|
|
99
|
+
echo ' make release'
|
|
100
|
+
exit 1
|
|
101
|
+
|
|
102
|
+
- name: Perform CodeQL Analysis
|
|
103
|
+
uses: github/codeql-action/analyze@v4
|
|
104
|
+
with:
|
|
105
|
+
category: "/language:${{matrix.language}}"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Run RSpec tests (VCR cassettes; no live API key needed for recorded specs).
|
|
2
|
+
name: SDK CI
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
types: [opened, synchronize, reopened]
|
|
7
|
+
push:
|
|
8
|
+
branches: [main, master]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
name: Test
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
env:
|
|
18
|
+
ZEROBOUNCE_API_KEY: "invalid_key_for_tests"
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v6
|
|
21
|
+
|
|
22
|
+
- name: Set up Ruby
|
|
23
|
+
uses: ruby/setup-ruby@v1
|
|
24
|
+
with:
|
|
25
|
+
ruby-version: "3.2"
|
|
26
|
+
bundler-cache: true
|
|
27
|
+
|
|
28
|
+
- name: Run specs
|
|
29
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -54,12 +54,7 @@ further defined and clarified by project maintainers.
|
|
|
54
54
|
|
|
55
55
|
## Enforcement
|
|
56
56
|
|
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting the project team at afrase91@gmail.com. All
|
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project team at **integrations@zerobounce.net**. All complaints will be reviewed and investigated promptly and fairly. The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
63
58
|
|
|
64
59
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
60
|
faith may face temporary or permanent repercussions as determined by other
|
data/CONTRIBUTING.md
CHANGED
|
@@ -1 +1,112 @@
|
|
|
1
|
-
|
|
1
|
+
# Contributing to Zero Bounce Ruby SDK
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing. This document explains how to get set up, run tests, and submit changes.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
By participating in this project, you agree to uphold our [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
* Ruby 3.2+ (see [.ruby-version](.ruby-version))
|
|
14
|
+
* [Bundler](https://bundler.io/) ~> 2.4
|
|
15
|
+
|
|
16
|
+
### Setup
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git clone https://github.com/zerobounce/zero-bounce-ruby.git
|
|
20
|
+
cd zero-bounce-ruby
|
|
21
|
+
bundle install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Running Tests
|
|
25
|
+
|
|
26
|
+
Tests use [RSpec](https://rspec.info/) with [VCR](https://github.com/vcr/vcr) for recorded HTTP interactions. Use the placeholder key so cassettes match:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
ZEROBOUNCE_API_KEY=vcr_test_key bundle exec rspec
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or copy `.env.example` to `.env`, set `ZEROBOUNCE_API_KEY=vcr_test_key`, then:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bundle exec rspec
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**With Docker:**
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
docker build -t zerobounce-ruby-test .
|
|
42
|
+
docker run --rm zerobounce-ruby-test
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Code Style
|
|
46
|
+
|
|
47
|
+
The project uses [RuboCop](https://github.com/rubocop/rubocop). Run before submitting:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bundle exec rubocop
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## How to Contribute
|
|
54
|
+
|
|
55
|
+
### Reporting Bugs
|
|
56
|
+
|
|
57
|
+
Open an [issue](https://github.com/zerobounce/zero-bounce-ruby/issues) and include:
|
|
58
|
+
|
|
59
|
+
* Ruby version (`ruby -v`)
|
|
60
|
+
* Steps to reproduce
|
|
61
|
+
* Expected vs actual behavior
|
|
62
|
+
* Relevant code or error messages
|
|
63
|
+
|
|
64
|
+
### Suggesting Changes
|
|
65
|
+
|
|
66
|
+
* Check existing issues and pull requests first.
|
|
67
|
+
* Open an issue to discuss larger changes or API design before coding.
|
|
68
|
+
|
|
69
|
+
### Submitting Changes
|
|
70
|
+
|
|
71
|
+
1. **Fork** the repository and create a branch from `main`:
|
|
72
|
+
```bash
|
|
73
|
+
git checkout -b feature/your-feature-name
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. **Make your changes** and add or update tests where relevant.
|
|
77
|
+
|
|
78
|
+
3. **Run the suite** and RuboCop:
|
|
79
|
+
```bash
|
|
80
|
+
ZEROBOUNCE_API_KEY=vcr_test_key bundle exec rspec
|
|
81
|
+
bundle exec rubocop
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
4. **Commit** with a clear message (e.g. `Add X`, `Fix Y`).
|
|
85
|
+
|
|
86
|
+
5. **Push** your branch and open a **Pull Request** against `main`.
|
|
87
|
+
|
|
88
|
+
6. In the PR description, briefly explain what changed and why. Link any related issues.
|
|
89
|
+
|
|
90
|
+
Maintainers will review and may request changes. Once approved, your PR can be merged.
|
|
91
|
+
|
|
92
|
+
## Project Layout
|
|
93
|
+
|
|
94
|
+
* `lib/` – SDK source (entry point: `lib/zerobounce.rb`)
|
|
95
|
+
* `spec/` – RSpec tests and VCR cassettes (`spec/cassettes/`)
|
|
96
|
+
* `data/` – Sample CSV files for batch validation and scoring examples
|
|
97
|
+
|
|
98
|
+
## Re-recording VCR Cassettes
|
|
99
|
+
|
|
100
|
+
If you change or add API calls and need to re-record cassettes:
|
|
101
|
+
|
|
102
|
+
1. Use a valid Zero Bounce API key (e.g. from [dashboard](https://www.zerobounce.net/docs/api-dashboard)).
|
|
103
|
+
2. Set `ZEROBOUNCE_API_KEY` and run the specs; VCR will record new HTTP interactions.
|
|
104
|
+
3. Replace any real API key in the new cassette files with `vcr_test_key` before committing, so the repo never contains real credentials.
|
|
105
|
+
|
|
106
|
+
## Questions
|
|
107
|
+
|
|
108
|
+
* [Zero Bounce API docs](https://www.zerobounce.net/docs/)
|
|
109
|
+
* [Project homepage](https://zerobounce.net)
|
|
110
|
+
* Contact: **integrations@zerobounce.net**
|
|
111
|
+
|
|
112
|
+
Thanks for contributing.
|
data/Dockerfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ZeroBounce Ruby SDK – test image (Ruby 3.2)
|
|
2
|
+
FROM ruby:3.2-alpine
|
|
3
|
+
|
|
4
|
+
RUN apk add --no-cache build-base git
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
COPY . .
|
|
9
|
+
# Gemfile.lock expects Bundler 2.4.x (see gemspec); Ruby 3.2 image may ship Bundler 4.x.
|
|
10
|
+
RUN gem install bundler -v 2.4.22 && \
|
|
11
|
+
bundle config set --local path 'vendor/bundle' && \
|
|
12
|
+
bundle _2.4.22_ install
|
|
13
|
+
|
|
14
|
+
# Dummy key for VCR/cassette-based specs; override with env for live API
|
|
15
|
+
ENV ZEROBOUNCE_API_KEY="${ZEROBOUNCE_API_KEY:-invalid_key_for_tests}"
|
|
16
|
+
|
|
17
|
+
CMD ["bundle", "_2.4.22_", "exec", "rspec"]
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
zerobounce-sdk (1.
|
|
4
|
+
zerobounce-sdk (2.1.0)
|
|
5
5
|
dotenv
|
|
6
6
|
rest-client (~> 2.1)
|
|
7
7
|
|
|
@@ -11,6 +11,8 @@ GEM
|
|
|
11
11
|
addressable (2.8.4)
|
|
12
12
|
public_suffix (>= 2.0.2, < 6.0)
|
|
13
13
|
ast (2.4.2)
|
|
14
|
+
base64 (0.3.0)
|
|
15
|
+
bigdecimal (4.0.1)
|
|
14
16
|
coderay (1.1.3)
|
|
15
17
|
crack (0.4.5)
|
|
16
18
|
rexml
|
|
@@ -105,6 +107,8 @@ PLATFORMS
|
|
|
105
107
|
x86_64-linux
|
|
106
108
|
|
|
107
109
|
DEPENDENCIES
|
|
110
|
+
base64
|
|
111
|
+
bigdecimal
|
|
108
112
|
bundler (~> 2.4.6)
|
|
109
113
|
pry (~> 0.14.1)
|
|
110
114
|
rake (~> 13.0)
|
|
@@ -121,4 +125,4 @@ DEPENDENCIES
|
|
|
121
125
|
zerobounce-sdk!
|
|
122
126
|
|
|
123
127
|
BUNDLED WITH
|
|
124
|
-
2.4.
|
|
128
|
+
2.4.22
|
data/LICENSE
CHANGED
data/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 ZeroBounce
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
10
10
|
furnished to do so, subject to the following conditions:
|
|
11
11
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -189,10 +189,13 @@ Zerobounce.api_usage(Date.today, Date.today)
|
|
|
189
189
|
"sub_status_mailbox_quota_exceeded"=>0,
|
|
190
190
|
"sub_status_forcible_disconnect"=>0,
|
|
191
191
|
"sub_status_failed_smtp_connection"=>0,
|
|
192
|
+
"sub_status_accept_all"=>0,
|
|
192
193
|
"sub_status_mx_forward"=>0,
|
|
193
194
|
"sub_status_alternate"=>0,
|
|
194
|
-
"sub_status_blocked"=>0,
|
|
195
195
|
"sub_status_allowed"=>0,
|
|
196
|
+
"sub_status_blocked"=>0,
|
|
197
|
+
"sub_status_gold"=>0,
|
|
198
|
+
"sub_status_role_based_accept_all"=>0,
|
|
196
199
|
"start_date"=>"4/28/2023",
|
|
197
200
|
"end_date"=>"4/28/2023"}
|
|
198
201
|
```
|
|
@@ -378,10 +381,13 @@ Send file
|
|
|
378
381
|
last_name_column: 3,
|
|
379
382
|
gender_column: 4,
|
|
380
383
|
has_header_row: true,
|
|
381
|
-
return_url: nil
|
|
384
|
+
return_url: nil, # results callback url
|
|
385
|
+
allow_phase_2: true # optional; validation bulk sendfile only (omit or nil to skip)
|
|
382
386
|
# Zerobounce.validate_file_send(validate_file_path, email_address_column: 1, gender_column: 4)
|
|
383
387
|
```
|
|
384
388
|
|
|
389
|
+
Bulk validation uses `https://bulkapi.zerobounce.net/v2`. See [v2 send file](https://www.zerobounce.net/docs/email-validation-api-quickstart/v2-send-file), [v2 file status](https://www.zerobounce.net/docs/email-validation-api-quickstart/v2-file-status), and [v2 get file](https://www.zerobounce.net/docs/email-validation-api-quickstart/v2-get-file).
|
|
390
|
+
|
|
385
391
|
Check file
|
|
386
392
|
```ruby
|
|
387
393
|
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
|
@@ -394,6 +400,7 @@ Zerobounce.validate_file_check(file_id)
|
|
|
394
400
|
"upload_date"=>"2023-04-28T15:25:41Z",
|
|
395
401
|
"file_status"=>"Greylisted",
|
|
396
402
|
"complete_percentage"=>"0%",
|
|
403
|
+
"file_phase_2_status"=>"N/A", # when present (validation bulk v2)
|
|
397
404
|
"error_reason"=>nil,
|
|
398
405
|
"return_url"=>nil}
|
|
399
406
|
```
|
|
@@ -406,6 +413,18 @@ Zerobounce.validate_file_get(file_id)
|
|
|
406
413
|
=> "\"email\",\"first\",\"last\",\"gender\",\"ip\",\"ZB Status\",\"ZB Sub Status\",\"ZB Account\",\"ZB Domain\",\"ZB First Name\",\"ZB Last Name\",\"ZB Gender\",\"ZB Free Email\",\"ZB MX Found\",\"ZB MX Record\",\"ZB SMTP Provider\",\"ZB Did You Mean\"\n\"disposable@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"disposable\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"invalid@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"mailbox_not_found\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"valid@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"valid\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"toxic@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"toxic\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"donotmail@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"role_based\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"spamtrap@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"spamtrap\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"abuse@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"abuse\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"unknown@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"mail_server_temporary_error\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"catch_all@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"catch-all\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"antispam_system@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"antispam_system\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"does_not_accept_mail@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"does_not_accept_mail\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"exception_occurred@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"exception_occurred\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"failed_smtp_connection@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"failed_smtp_connection\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"failed_syntax_check@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"failed_syntax_check\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"forcible_disconnect@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"forcible_disconnect\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"global_suppression@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"global_suppression\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"greylisted@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"greylisted\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"leading_period_removed@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"valid\",\"leading_period_removed\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"mail_server_did_not_respond@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"mail_server_did_not_respond\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"mail_server_temporary_error@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"mail_server_temporary_error\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"mailbox_quota_exceeded@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"mailbox_quota_exceeded\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"mailbox_not_found@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"mailbox_not_found\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"no_dns_entries@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"no_dns_entries\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"possible_trap@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"possible_trap\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"possible_typo@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"possible_typo\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"role_based@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"role_based\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"timeout_exceeded@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"timeout_exceeded\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"unroutable_ip_address@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"unroutable_ip_address\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"free_email@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"valid\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"True\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"role_based_catch_all@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"role_based_catch_all\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n"
|
|
407
414
|
```
|
|
408
415
|
|
|
416
|
+
Optional [v2 get file](https://www.zerobounce.net/docs/email-validation-api-quickstart/v2-get-file) query parameters use `Zerobounce::GetFileOptions` and `Zerobounce::DownloadType` (`PHASE_1`, `PHASE_2`, `COMBINED`). Set `activity_data` for validation `validate_file_get` only; it is not sent for `scoring_file_get`.
|
|
417
|
+
|
|
418
|
+
```ruby
|
|
419
|
+
opts = Zerobounce::GetFileOptions.new(
|
|
420
|
+
download_type: Zerobounce::DownloadType::COMBINED,
|
|
421
|
+
activity_data: true
|
|
422
|
+
)
|
|
423
|
+
csv = Zerobounce.validate_file_get(file_id, opts)
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Non-success HTTP responses or JSON error bodies (including some HTTP 200 responses with `"success": false`) raise `RuntimeError` with the API message. To inspect a raw body string, use `Zerobounce.get_file_json_indicates_error?(body)`.
|
|
427
|
+
|
|
409
428
|
Delete file
|
|
410
429
|
```ruby
|
|
411
430
|
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
|
@@ -459,13 +478,15 @@ file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
|
|
459
478
|
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
|
460
479
|
Zerobounce.scoring_file_get(file_id)
|
|
461
480
|
=> "\"email\",\"ZeroBounceQualityScore\"\r\n\"disposable@example.com\",\"0\"\r\n\"invalid@example.com\",\"10\"\r\n\"valid@example.com\",\"10\"\r\n\"toxic@example.com\",\"2\"\r\n\"donotmail@example.com\",\"0\"\r\n\"spamtrap@example.com\",\"0\"\r\n\"abuse@example.com\",\"10\"\r\n\"unknown@example.com\",\"10\"\r\n\"catch_all@example.com\",\"10\"\r\n\"antispam_system@example.com\",\"0\"\r\n\"does_not_accept_mail@example.com\",\"0\"\r\n\"exception_occurred@example.com\",\"0\"\r\n\"failed_smtp_connection@example.com\",\"0\"\r\n\"failed_syntax_check@example.com\",\"0\"\r\n\"forcible_disconnect@example.com\",\"0\"\r\n\"global_suppression@example.com\",\"0\"\r\n\"greylisted@example.com\",\"0\"\r\n\"leading_period_removed@example.com\",\"0\"\r\n\"mail_server_did_not_respond@example.com\",\"0\"\r\n\"mail_server_temporary_error@example.com\",\"0\"\r\n\"mailbox_quota_exceeded@example.com\",\"0\"\r\n\"mailbox_not_found@example.com\",\"0\"\r\n\"no_dns_entries@example.com\",\"0\"\r\n\"possible_trap@example.com\",\"0\"\r\n\"possible_typo@example.com\",\"0\"\r\n\"role_based@example.com\",\"0\"\r\n\"timeout_exceeded@example.com\",\"0\"\r\n\"unroutable_ip_address@example.com\",\"0\"\r\n\"free_email@example.com\",\"0\"\r\n\"role_based_catch_all@example.com\",\"0\""
|
|
481
|
+
# Optional second argument: GetFileOptions with download_type only (activity_data is not sent for scoring getfile)
|
|
482
|
+
# Zerobounce.scoring_file_get(file_id, Zerobounce::GetFileOptions.new(download_type: Zerobounce::DownloadType::PHASE_2))
|
|
462
483
|
```
|
|
463
484
|
|
|
464
485
|
Delete file
|
|
465
486
|
```ruby
|
|
466
487
|
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
|
467
488
|
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
|
468
|
-
Zerobounce.
|
|
489
|
+
Zerobounce.scoring_file_delete(file_id)
|
|
469
490
|
=> {"success"=>false, "message"=>"File cannot be found."}
|
|
470
491
|
```
|
|
471
492
|
|
|
@@ -705,14 +726,29 @@ gem install bundler -v "~>2.4.6"
|
|
|
705
726
|
bundle install
|
|
706
727
|
```
|
|
707
728
|
|
|
708
|
-
### Run tests
|
|
729
|
+
### Run tests with Docker
|
|
730
|
+
From the **parent repository root** (the folder that contains all SDKs and `docker-compose.yml`):
|
|
731
|
+
|
|
732
|
+
```bash
|
|
733
|
+
docker compose build ruby
|
|
734
|
+
docker compose run --rm ruby
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
Or from this directory:
|
|
738
|
+
|
|
739
|
+
```bash
|
|
740
|
+
docker build -t zb-ruby-sdk .
|
|
741
|
+
docker run --rm zb-ruby-sdk
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
### Run tests (local)
|
|
709
745
|
```bash
|
|
710
746
|
bundle exec rspec
|
|
711
747
|
```
|
|
712
748
|
|
|
713
749
|
You should see an output like this
|
|
714
750
|
```bash
|
|
715
|
-
running
|
|
751
|
+
running tests
|
|
716
752
|
.....................................................
|
|
717
753
|
|
|
718
754
|
Finished in 6.81 seconds (files took 0.40587 seconds to load)
|
|
@@ -720,24 +756,20 @@ Finished in 6.81 seconds (files took 0.40587 seconds to load)
|
|
|
720
756
|
```
|
|
721
757
|
|
|
722
758
|
### Test parameters
|
|
723
|
-
The tests use the following environment
|
|
724
|
-
ZEROBOUNCE_API_KEY
|
|
725
|
-
INCORRECT_API_KEY {any non whitespace string value that is not a valid key} used for tests where the requests are meant to fail due to the API key value.
|
|
759
|
+
The tests use the following environment parameter:
|
|
760
|
+
- **ZEROBOUNCE_API_KEY** – Your API key; used in mock tests as the valid key sample (any value will work for mock tests).
|
|
726
761
|
|
|
727
|
-
|
|
762
|
+
An invalid API key for error-handling tests is hardcoded in the spec; no env var is required.
|
|
763
|
+
|
|
764
|
+
To set your key:
|
|
728
765
|
```bash
|
|
729
|
-
export ZEROBOUNCE_API_KEY=
|
|
730
|
-
export INCORRECT_API_KEY=thiskeyisinvalidorotherwiseincorrect
|
|
766
|
+
export ZEROBOUNCE_API_KEY=your_api_key_here
|
|
731
767
|
```
|
|
732
768
|
|
|
733
|
-
A .env.
|
|
769
|
+
A .env.example file is provided.
|
|
734
770
|
|
|
735
|
-
Tests use webmock and vcr for mocking HTTP requests. This means that actual requests were made and recorded in the spec/cassettes with an (at the time) valid API key used for testing purposes. This key has been invalidated in the meantime, however it is provided in the .env.
|
|
771
|
+
Tests use webmock and vcr for mocking HTTP requests. This means that actual requests were made and recorded in the spec/cassettes with an (at the time) valid API key used for testing purposes. This key has been invalidated in the meantime, however it is provided in the .env.example file for the mock tests to work. If you do not wish to use this key for mocks, you can replace it with any value in the .yml files under spec/cassettes or delete all of them and rerun the tests so that vcr records them with a new key.
|
|
736
772
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
gem
|
|
740
|
-
gem build zerobounce.spec
|
|
741
|
-
gem push zerobounce-sdk-<version>.gem
|
|
742
|
-
gem search zerobounce-sdk --remote
|
|
743
|
-
```
|
|
773
|
+
## Publish
|
|
774
|
+
|
|
775
|
+
See the [sdk-docs (RubyGems)](../sdk-docs/rubygems/) guide in the SDKs repo for build and `gem push` steps.
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a Vulnerability
|
|
4
|
+
|
|
5
|
+
If you think you've found a security issue, please report it privately instead of opening a public issue.
|
|
6
|
+
|
|
7
|
+
**Email:** integrations@zerobounce.net (use a subject like `[zero-bounce-ruby] Security`).
|
|
8
|
+
|
|
9
|
+
We'll look into reports as we can. If the issue is in the Zero Bounce API or service rather than this SDK, we may forward it to the right team.
|
|
10
|
+
|
|
11
|
+
## Supported Versions
|
|
12
|
+
|
|
13
|
+
We focus on the current release line for fixes. Using the [latest version](https://rubygems.org/gems/zerobounce-sdk) is recommended.
|
|
14
|
+
|
|
15
|
+
## Tips for Using This SDK
|
|
16
|
+
|
|
17
|
+
* Don't commit API keys or `.env` files—use environment variables or a secrets manager.
|
|
18
|
+
* Keep dependencies up to date with `bundle install` and upgrade when new versions are released.
|
|
19
|
+
* The client uses HTTPS by default; avoid overriding to non-HTTPS in production.
|
|
20
|
+
|
|
21
|
+
Thanks for helping keep things secure.
|