Class: PartyResearch::Adapters::PeopleDataLabs

Inherits:
Base
  • Object
show all
Defined in:
app/services/party_research/adapters/people_data_labs.rb

Constant Summary collapse

BASE_URL =
'https://api.peopledatalabs.com/v5'
TIMEOUT_SECONDS =
20
LIKELIHOOD_FLOOR =

PDL's likelihood (0..10) — confidence that the returned record
matches the query. We drop anything below 4 because lower
likelihoods produced "Bob Electric in Brick NJ" when our actual
customer is in Huntington Beach CA.

4

Constants inherited from Base

Base::ALL, Base::PERSONAL_EMAIL_DOMAINS

Instance Attribute Summary

Attributes inherited from Base

#party, #raw_findings

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

adapter_name, arbiter?, #finding, #initialize, lookup, registered

Constructor Details

This class inherits a constructor from PartyResearch::Adapters::Base

Class Method Details

.configured?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'app/services/party_research/adapters/people_data_labs.rb', line 54

def configured?
  Heatwave::Configuration.fetch(:peopledatalabs, :api_key).present?
end

.relevant_for?(party) ⇒ Boolean

PDL is useful in two distinct shapes — person enrichment for
individuals (Contact rows, homeowner Customers) and company
enrichment for non-homeowner Customers. Both are reachable
under the same credential.

Returns:

  • (Boolean)


62
63
64
65
66
67
# File 'app/services/party_research/adapters/people_data_labs.rb', line 62

def relevant_for?(party)
  return true if party.is_a?(Contact)
  return false unless party.is_a?(Customer)

  true
end

Instance Method Details

#findings_forObject

Raises:



70
71
72
73
74
75
76
77
78
# File 'app/services/party_research/adapters/people_data_labs.rb', line 70

def findings_for
  raise ConfigurationError, 'PeopleDataLabs api_key is not configured in Heatwave::Configuration' unless self.class.configured?

  if company_party?
    enrich_company
  else
    enrich_person
  end
end