Guidance for AI coding agents working in this repository.
zero-bounce-ruby publishes the zerobounce-sdk gem. Callers set Zerobounce.config.apikey, or construct Zerobounce::Client.new(api_key). Module methods share one configuration object. A Client stores the key on the current thread for the duration of each call.
lib/zerobounce.rb: public methods for validate, credits, batch, files, scoring, and finder.lib/zerobounce/priority3.rb: bulk email finder, domain search, list evaluator, filters, and S3.lib/zerobounce/base_request.rbandrequest.rb: RestClient transport.response_error.rbturns HTML, empty bodies, and non-JSON into a shortRuntimeError.lib/zerobounce/version.rb:Zerobounce::VERSION.Gemfile.lockpinszerobounce-sdk (X.Y.Z)to that same version.spec/offline_api_spec.rb: offline suite. WebMock answers without the network.- The user agent is
ZerobounceRubyGem/#{Zerobounce::VERSION}.
bundle exec rspec
bundle exec rubocoprspec is the test command. rubocop is the lint step; there is no separate typechecker. CI (.github/workflows/sdk_ci.yml) runs both on Ruby 3.2. This checkout may be a newer Ruby where RuboCop cannot load benchmark; use 3.2 to lint.
- One key per caller.
Zerobounce.configis process-wide. Do not reuse it across users. UseZerobounce::Client(orwith_api_key) so two threads cannot observe each other's keys. The offline concurrency spec does this. - Column indexes.
0is a real column. Do not drop it withif column. Omit an optional column only when the argument isnil.domain_columnof0is rejected.Import-style defaults are not used here: the send methods default name columns to 1–4, and an explicit0is sent. - Optional parameters are omitted when unset.
timeout,activity_data,verify_plus, andallow_phase_2are omitted whennil. Explicitfalseis sent asfalse. - Booleans on multipart are the strings
trueandfalse.has_header_row: falseon bulk email finder and domain search is sent.allow_phase_2is validationsendfileonly.activity_dataon get-file is validation only. validatetimeout is 3–60 seconds.validate_batchtimeout is 10–120 seconds. Out-of-range values raiseArgumentErrorbefore a request.- Failures are
RuntimeError(orArgumentErrorfor bad arguments). The message must be short: no raw HTML, no megabyte body, noJSON::ParserErrordump, and noError: Error:prefix. An account-levelvalidate_batcherror (email_addressall) raises. A per-address error stays on the returned hash. validate_batchreturns the hash, withemail_batchanderrors, not only the array.- Tests replace HTTP with WebMock. Do not call the live API from
rspec. - Match the surrounding style. Do not reformat unrelated code.
CHANGELOG.md follows Keep a Changelog 1.1.0, and the project adheres to Semantic Versioning 2.0.0.
- Add every user-visible change to
## [Unreleased]in the same commit as the change. - Group entries under these headings, in this order, omitting empty ones:
Added,Changed,Deprecated,Removed,Fixed,Security. - Write for SDK users: name the method, option, or behaviour, and say what changed. Leave out CI-only changes, internal refactors, and fixes to code that was never released.
- At 2.y.z, a breaking change bumps the major version, a new method or option bumps the minor version, and fixes alone bump the patch version.
Publishing and pushing tags need a maintainer's explicit approval. Do not bump the version, tag, or publish unless they asked.
- Move
[Unreleased]entries under## [x.y.z] - YYYY-MM-DD, leave an empty[Unreleased]section, and update the compare links at the bottom ofCHANGELOG.md. - Set the same version in
lib/zerobounce/version.rband in thezerobounce-sdk (X.Y.Z)pin inGemfile.lock. A frozen CI install fails if those two differ. The gemspec readsZerobounce::VERSION; do not add a third copy. bundle exec rubocopandbundle exec rspec.- Tag
vx.y.zon that commit and run the Publish workflow with that tag. It publishes to RubyGems.