module Zerobounce

Validate an email address with Zerobounce.net

Constants

VERSION

The version of the gem.

Attributes

configuration[W]

Public Class Methods

config()
Alias for: configuration
configuration() click to toggle source

Zerobounce configuration

@return [Zerobounce::Configuration]

# File lib/zerobounce.rb, line 18
def configuration
  @configuration ||= Configuration.new
end
Also aliased as: config
configure() { |configuration| ... } click to toggle source

Configure Zerobounce inside a block.

@example

Zerobounce.configure do |config|
  config.apikey = 'api-key'
end

@yieldparam [Zerobounce::Configuration] config

# File lib/zerobounce.rb, line 31
def configure
  yield configuration
end
credits(params={}) click to toggle source

Get the number of remaining credits on the account.

@param [Hash] params @option params [String] :apikey Use a different API key for this request. @option params [String] :host Use a different host for this request. @option params [String] :headers Use different headers for this request. @option params [Proc] :middleware Use different middleware for this request. @return [Integer]

# File lib/zerobounce.rb, line 57
def credits(params={})
  Request.new(params).credits(params)
end
invalid?(email, params={}) click to toggle source

Convenience method for checking if an email address is invalid.

@param [String] email @param [Hash] params @return [Boolean]

# File lib/zerobounce.rb, line 75
def invalid?(email, params={})
  validate(params.merge(email: email)).invalid?
end
valid?(email, params={}) click to toggle source

Convenience method for checking if an email address is valid.

@param [String] email @param [Hash] params @return [Boolean]

# File lib/zerobounce.rb, line 66
def valid?(email, params={})
  validate(params.merge(email: email)).valid?
end
validate(params) click to toggle source

Validates the email address and gets geoip information for an IP if provided.

@param [Hash] params @option params [String] :email The email address to validate. @option params [String] :ip_address An IP address, :ipaddress also works. @option params [String] :apikey Use a different API key for this request. @option params [String] :host Use a different host for this request. @option params [String] :headers Use different headers for this request. @option params [Proc] :middleware Use different middleware for this request. @return [Zerobounce::Response]

# File lib/zerobounce.rb, line 45
def validate(params)
  Request.new(params).validate(params)
end