Class: Api::FullContact
- Inherits:
-
Object
- Object
- Api::FullContact
- Defined in:
- app/services/api/full_contact.rb
Instance Method Summary collapse
- #client ⇒ Object
- #enrich_company(data = {}) ⇒ Object
-
#enrich_person(data = {}) ⇒ Object
https://docs.fullcontact.com/?ruby#person-enrichment { "emails": [ "bart@fullcontact.com", "bart.lorang@fullcontact.com" ], "phones": [ "+17202227799", "+13035551234" ], "location": { "addressLine1": "123 Main Street", "addressLine2": "Unit 2", "city": "Denver", "region": "Colorado", "regionCode": "CO", "postalCode": "80203" }, "name": { "full": "Bart Lorang", "given": "Bart", "family": "Lorang" }, "profiles": [{ "service": "twitter", "username": "bartlorang" }, { "service": "twitter", "userid": "5998422" }, { "service": "linkedin", "url": "https://www.linkedin.com/in/bartlorang" }, { "service": "github", "url": "https://www.github.com/lorangb" }] }.
- #test_company_lookup ⇒ Object
- #test_person_lookup ⇒ Object
Instance Method Details
#client ⇒ Object
3 4 5 |
# File 'app/services/api/full_contact.rb', line 3 def client HTTP.auth("Bearer #{Heatwave::Configuration.fetch(:full_contact, :api_key)}") end |
#enrich_company(data = {}) ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/services/api/full_contact.rb', line 8 def enrich_company(data={}) key = Digest::MD5.hexdigest(data.sort.to_json) r = Rails.cache.fetch(key, expires_in: 30.days) { client.post("https://api.fullcontact.com/v3/company.enrich", json: data).parse } r.with_indifferent_access end |
#enrich_person(data = {}) ⇒ Object
https://docs.fullcontact.com/?ruby#person-enrichment
{
"emails": [
"bart@fullcontact.com",
"bart.lorang@fullcontact.com"
],
"phones": [
"+17202227799",
"+13035551234"
],
"location": {
"addressLine1": "123 Main Street",
"addressLine2": "Unit 2",
"city": "Denver",
"region": "Colorado",
"regionCode": "CO",
"postalCode": "80203"
},
"name": {
"full": "Bart Lorang",
"given": "Bart",
"family": "Lorang"
},
"profiles": [{
"service": "twitter",
"username": "bartlorang"
}, {
"service": "twitter",
"userid": "5998422"
}, {
"service": "linkedin",
"url": "https://www.linkedin.com/in/bartlorang"
}, {
"service": "github",
"url": "https://www.github.com/lorangb"
}]
}
53 54 55 |
# File 'app/services/api/full_contact.rb', line 53 def enrich_person(data={}) client.post("https://api.fullcontact.com/v3/person.enrich", json: data).parse.with_indifferent_access end |
#test_company_lookup ⇒ Object
61 62 63 |
# File 'app/services/api/full_contact.rb', line 61 def test_company_lookup enrich_company({domain: 'nuheat.com'}) end |
#test_person_lookup ⇒ Object
57 58 59 |
# File 'app/services/api/full_contact.rb', line 57 def test_person_lookup enrich_person(emails: ['tgolden@nacarchitecture.com'], phones: ['+15099534795']) end |