module TowerdataEmail

Constants

VERSION

Public Class Methods

config() click to toggle source

Configuration

# File lib/towerdata_email.rb, line 17
def self.config
  @config ||= TowerdataEmail::Config.new
end
config=(new_config) click to toggle source
# File lib/towerdata_email.rb, line 21
def self.config=(new_config)
  @config = new_config
end
configure() { |config| ... } click to toggle source
# File lib/towerdata_email.rb, line 25
def self.configure
  yield config if block_given?
  raise MustProvideTokenError, "Your provider requires an API token" unless config.token
end
demographics_data(email) click to toggle source
# File lib/towerdata_email.rb, line 58
def self.demographics_data(email)
  response  = lead_data(email)
  response.demographics
end
lead_data(email) click to toggle source

Before every call check cache first, is just a hash of response objects that is not persisted given provider validates email and returns it as TowerdataEmail::Response Object

# File lib/towerdata_email.rb, line 41
def self.lead_data(email)
  provider.lead_data(email)
end
new() click to toggle source
# File lib/towerdata_email.rb, line 12
def initialize

end
postal_data(email) click to toggle source

needs special API permissions

# File lib/towerdata_email.rb, line 51
def self.postal_data(email)
  if config.postal
    response  = lead_data(email)
    response.postal
  end
end
provider() click to toggle source

defaults to Tower Data see providers.rb

# File lib/towerdata_email.rb, line 31
def self.provider
  @provider ||= TowerdataEmail::TowerDataDefault.new
end
provider=(new_prov) click to toggle source
# File lib/towerdata_email.rb, line 35
def self.provider=(new_prov)
  @provider = new_prov
end
validate_email(email) click to toggle source
# File lib/towerdata_email.rb, line 45
def self.validate_email(email)
  response  = lead_data(email)
  response.email
end