Permalink
Browse files

Merge pull request #59 from fullcontact/ind-update

Add company industry support
  • Loading branch information...
MattSainz committed Oct 24, 2017
2 parents 265d5ed + e58657b commit ad057f6d74673f2881a8093d3248061113a65bcf
View
@@ -7,7 +7,7 @@
<groupId>com.fullcontact</groupId>
<artifactId>fullcontact4j</artifactId>
<name>FullContact Java Bindings</name>
<version>5.4.1</version>
<version>5.5.0</version>
<dependencies>
<dependency>
@@ -6,6 +6,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fullcontact.api.libs.fullcontact4j.FullContactException;
import com.fullcontact.api.libs.fullcontact4j.http.FCResponse;
import com.fullcontact.api.libs.fullcontact4j.http.company.model.CompanyIndustry;
import com.fullcontact.api.libs.fullcontact4j.http.company.model.CompanyOrganization;
import com.fullcontact.api.libs.fullcontact4j.http.company.model.CompanyTraffic;
import com.fullcontact.api.libs.fullcontact4j.http.person.model.SocialProfile;
@@ -35,9 +36,11 @@
private CompanyOrganization organization;
private List<SocialProfile> socialProfiles = Collections.emptyList();
private CompanyTraffic traffic;
private List<CompanyIndustry> industries = Collections.emptyList();
/**
* Factory method to create a webhook response from json.
*
* @param json
* @return a new PersonResponse represented by the Json string
* @throws com.fullcontact.api.libs.fullcontact4j.FullContactException if there is a parsing/mapping error.
@@ -49,11 +52,11 @@ public static CompanyResponse fromJson(String json) throws FullContactException
mapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
try {
return mapper.readValue(json, CompanyResponse.class);
} catch(JsonMappingException e) {
} catch (JsonMappingException e) {
throw new FullContactException("Failed to convert person json to a response", e);
} catch(JsonParseException e) {
} catch (JsonParseException e) {
throw new FullContactException("Json is not valid format", e);
} catch(IOException e) {
} catch (IOException e) {
throw new FullContactException("Unexpected exception when parsing json", e);
}
}
@@ -0,0 +1,14 @@
package com.fullcontact.api.libs.fullcontact4j.http.company.model;
import lombok.*;
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
@EqualsAndHashCode
@ToString
public class CompanyIndustry {
private String type;
private String code;
private String name;
}
@@ -6,14 +6,18 @@
import com.fullcontact.api.libs.fullcontact4j.http.cardreader.CardReaderUploadConfirmResponse;
import com.fullcontact.api.libs.fullcontact4j.http.cardreader.CardReaderViewAllResponse;
import com.fullcontact.api.libs.fullcontact4j.http.company.CompanyResponse;
import com.fullcontact.api.libs.fullcontact4j.http.company.model.CompanyIndustry;
import com.fullcontact.api.libs.fullcontact4j.http.company.model.KeyPerson;
import com.fullcontact.api.libs.fullcontact4j.http.email.EmailVerificationAsyncResponse;
import com.fullcontact.api.libs.fullcontact4j.http.email.EmailVerificationResponse;
import com.fullcontact.api.libs.fullcontact4j.http.location.LocationEnrichmentResponse;
import com.fullcontact.api.libs.fullcontact4j.http.location.LocationNormalizationResponse;
import com.fullcontact.api.libs.fullcontact4j.http.misc.AccountStatsResponse;
import com.fullcontact.api.libs.fullcontact4j.http.misc.DisposableEmailResponse;
import com.fullcontact.api.libs.fullcontact4j.http.name.*;
import com.fullcontact.api.libs.fullcontact4j.http.name.NameParseResponse;
import com.fullcontact.api.libs.fullcontact4j.http.name.NameResponse;
import com.fullcontact.api.libs.fullcontact4j.http.name.NameSimilarityResponse;
import com.fullcontact.api.libs.fullcontact4j.http.name.NameStatsResponse;
import com.fullcontact.api.libs.fullcontact4j.http.person.PersonResponse;
import com.fullcontact.api.libs.fullcontact4j.http.person.model.Macromeasures;
import com.fullcontact.api.libs.fullcontact4j.http.person.model.Organization;
@@ -22,6 +26,7 @@
import lombok.SneakyThrows;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -33,7 +38,7 @@
@Test
public void personDeserializationTest() throws IOException {
PersonResponse r = mapper.readValue(Utils.loadFile("example-person-response.json"), PersonResponse.class);
assertEquals( "Lorang", r.getContactInfo().getFamilyName());
assertEquals("Lorang", r.getContactInfo().getFamilyName());
assertEquals("http://fullcontact.com", r.getContactInfo().getWebsites().get(0).getUrl());
assertEquals("Male", r.getDemographics().getGender());
assertEquals(4, r.getContactInfo().getChats().size());
@@ -59,15 +64,26 @@ public void personQueue202Test() throws IOException {
}
private static KeyPerson travisTodd = new KeyPerson("Travis Todd", "Co-Founder",
"https://api.fullcontact.com/v2/person.json?lookup=pDF50R_M0Gw8OfXk4zQXZBhkY_WkYdgF7SulvVo4uE0=");
"https://api.fullcontact.com/v2/person.json?lookup=pDF50R_M0Gw8OfXk4zQXZBhkY_WkYdgF7SulvVo4uE0=");
private static KeyPerson edenElder = new KeyPerson("Eden Elder, Ph.D.",
"Chief People Officer", null);
"Chief People Officer", null);
@Test
public void companyDeserializationTest() throws IOException {
CompanyResponse r = mapper.readValue(Utils.loadFile("example-company-response-with-ind.json"), CompanyResponse.class);
assertFalse(r.getIndustries().isEmpty());
CompanyIndustry ind = r.getIndustries().get(0);
assertEquals("SIC", ind.getType());
assertEquals("Foo", ind.getName());
assertEquals("1111", ind.getCode());
}
@Test
public void companyDeserilizationTestNoInd() throws IOException {
CompanyResponse r = mapper.readValue(Utils.loadFile("example-company-response.json"), CompanyResponse.class);
assertTrue(r.getLogo().contains("cloudfront"));
assertTrue(r.getIndustries().isEmpty());
assertEquals("en", r.getLanguageLocale());
assertEquals("2010", r.getOrganization().getFounded());
assertEquals("FullContact Inc.", r.getOrganization().getName());
@@ -107,7 +123,7 @@ public void canDeserializeCompanyWebhookJSON() throws Exception {
@Test
public void keyPersonToRequestTest() {
assertEquals("pDF50R_M0Gw8OfXk4zQXZBhkY_WkYdgF7SulvVo4uE0=",
travisTodd.toPersonRequestOrNull().build().getParam("lookup"));
travisTodd.toPersonRequestOrNull().build().getParam("lookup"));
assertEquals(null, edenElder.toPersonRequestOrNull());
}
@@ -117,13 +133,15 @@ public void cardReaderAcceptDeserializationTest() throws Exception {
assertEquals(conf.getEstimatedWaitTimeMinutes(), 33);
assertEquals(conf.getStatus(), 202);
}
@Test
public void cardReaderViewDeserializationTest() throws Exception {
CardReaderFullResponse conf = mapper.readValue(Utils.loadFile("example-card-full-response.json"), CardReaderFullResponse.class);
assertEquals(conf.getQuality(), CardReaderQuality.MEDIUM);
assertEquals(conf.getContact().getOrganizations().size(), 1);
}
@Test
public void cardReaderViewAllDeserializationTest() throws Exception {
CardReaderViewAllResponse conf = mapper.readValue(Utils.loadFile("example-card-view-all-response.json"), CardReaderViewAllResponse.class);
@@ -178,7 +196,7 @@ public void nameSimilarityDeserializationTest() throws Exception {
@Test
public void locationEnrichmentDeserializationTest() throws Exception {
LocationEnrichmentResponse r = mapper.readValue(Utils.loadFile("example-location-enrichment-response.json"),LocationEnrichmentResponse.class);
LocationEnrichmentResponse r = mapper.readValue(Utils.loadFile("example-location-enrichment-response.json"), LocationEnrichmentResponse.class);
assertEquals("San Miguel", r.getPossibleLocations().get(1).getCounty());
assertEquals("ES", r.getPossibleLocations().get(2).getCountry().getCode());
}
@@ -0,0 +1,215 @@
{
"status" : 200,
"requestId" : "607dcefe-cd40-4d17-8b99-f1a9aa8bdb38",
"category" : [ {
"name" : "Other",
"code" : "OTHER"
} ],
"logo" : "https://d2ojpxxtu63wzl.cloudfront.net/static/1bacd7306731a30d2a9f024eeb1dcff1_94d77dcdedbfe40707ac4a75ca4f4d2978bffc20b2e33a3288ea9e4d47f5af6c",
"website" : "https://www.fullcontact.com",
"languageLocale" : "en",
"industries":[{
"type":"SIC",
"name":"Foo",
"code":"1111"
}],
"organization" : {
"name" : "FullContact Inc.",
"approxEmployees" : 75,
"founded" : "2010",
"overview" : "Solving the world's contact information problem!",
"contactInfo" : {
"emailAddresses" : [ {
"value" : "support@fullcontact.com",
"label" : "support"
}, {
"value" : "sales@fullcontact.com",
"label" : "sales"
} ],
"phoneNumbers" : [ {
"number" : "+1 (888) 330-6943",
"label" : "other"
} ],
"addresses" : [ {
"addressLine1" : "1755 Blake Street",
"addressLine2" : "Suite 450",
"locality" : "Denver",
"region" : {
"name" : "Colorado",
"code" : "CO"
},
"country" : {
"name" : "United States",
"code" : "US"
},
"postalCode" : "80202",
"label" : "work"
} ]
},
"keyPeople" : [ {
"name" : "Bart Lorang",
"title" : "Co-Founder & CEO",
"link" : "https://api.fullcontact.com/v2/person.json?lookup=4CS9dXG04NQkvuxQYiN5Uo3EJMmdOV7HV1QKQus8FIE="
}, {
"name" : "Eden Elder, Ph.D.",
"title" : "Chief People Officer"
}, {
"name" : "Scott Brave",
"title" : "CTO",
"link" : "https://api.fullcontact.com/v2/person.json?lookup=1wUih8S-EiqACt19jgcCNDbtV27LVs0nv7byYA6QUkU="
}, {
"name" : "Travis Todd",
"title" : "Co-Founder",
"link" : "https://api.fullcontact.com/v2/person.json?lookup=pDF50R_M0Gw8OfXk4zQXZBhkY_WkYdgF7SulvVo4uE0="
}, {
"name" : "T.A. McCann",
"title" : "board member",
"link" : "https://api.fullcontact.com/v2/person.json?lookup=jzuWab6cDjycfFJt5uc9eWdx4BK2jXef73AcHm5uee8="
}, {
"name" : "John Arnold",
"title" : "VP Marketing",
"link" : "https://api.fullcontact.com/v2/person.json?lookup=54fd8KPYSxvKuHZL5x2eTF3ZhXL5c5xHZYhvZdXhaOaEFB_zlddU8CpchNzHwkUt"
}, {
"name" : "Michael Brouwer",
"title" : "VP Sales",
"link" : "https://api.fullcontact.com/v2/person.json?lookup=Fa4QMduxou2WhisUkGfm1jD8RG_xR3sZJblKx-qVNeM="
}, {
"name" : "Sean Porter",
"title" : "VP of Product & Engineering",
"link" : "https://api.fullcontact.com/v2/person.json?lookup=tjUW23P85F0B7dgaerE_l43EJMmdOV7HV1QKQus8FIE="
} ],
"links" : [ {
"url" : "https://www.fullcontact.com/comments/feed",
"label" : "rss"
}, {
"url" : "https://www.fullcontact.com/feed",
"label" : "rss"
}, {
"url" : "https://www.fullcontact.com/home/feed",
"label" : "rss"
}, {
"url" : "http://gofullcontact.com",
"label" : "other"
}, {
"url" : "https://www.fullcontact.com/developer",
"label" : "other"
}, {
"url" : "https://fullcontact.com/blog",
"label" : "blog"
} ],
"images" : [ {
"url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/1c390465c39c998a59c8717034982dfc_ff8af9a9f14da29ee687053e65d2ed103b8ab6f95b1f4d0147b9077ea04a3d6c",
"label" : "facebook"
}, {
"url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/edaa53d9a080aea37ddfb85d775620a9_98a2d7beef6a5b4a53f43da4dd1a90bda21dc18f755394fdbf9b6cf3283853a0",
"label" : "twitter"
}, {
"url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/3a54ee9e1deab71ff84d30bb7128ec60_141220a18549c8d45e84bb9349c073e4663f260e5f93c57c5a5d54e9d579406a",
"label" : "twitter"
}, {
"url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/ee07ac81180408fde663426d3b0afb3f_3a1154347631c037b9bd2b2f33d4cbc8511d58f5c11ad3cbbc319957d1a5149b",
"label" : "pinterest"
}, {
"url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/33739df1ce824fd2d2669211ed682196_8d3b1c8ce64909d95c1274bf9ed70ef3ae98e71ef58337e87bb2d19780dafcad",
"label" : "other"
}, {
"url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/4c1d5bdcea5612a206ba2573d5f459cf_b9ac649579685df0f8240be77db8ae57e20569a63521f9419c48cb98031bfe50",
"label" : "other"
} ],
"keywords" : [ "Advertising", "Adweek", "Apple", "Apps", "Books", "Boston", "Colorado", "Contact Management", "Developer APIs", "Finance", "Gmail", "Google", "Management", "PUMA", "SAAS", "Social Media", "Software", "Twitter", "Web Development" ]
},
"socialProfiles" : [ {
"bio" : "FullContact is the largest fully connected contact management platform for professionals and enterprises who need to master their contacts and be awesome with people. \n\nFullContact's cross-platform suite of Apps and APIs enhance contacts with insights, while keeping them organized, synchronized, up to date, and safe.",
"typeId" : "facebook",
"typeName" : "Facebook",
"url" : "https://www.facebook.com/FullContactAPI",
"username" : "FullContactAPI",
"id" : "159926450745554"
}, {
"bio" : "Full Contact is who we are. Full Contact is what we make. We are connectors. We are inventors. We are transformers. We are people making Full Contact.",
"followers" : 586,
"following" : 127,
"typeId" : "twitter",
"typeName" : "Twitter",
"url" : "https://twitter.com/FullContact",
"username" : "FullContact",
"id" : "18452167"
}, {
"bio" : "FullContact's address book brings all of your contacts into one place and keeps them automatically up to date on the web, as well as on your iPhone and iPad. \n\nAdd photos to your contacts. Find them on social networks like Twitter, Facebook, LinkedIn and of course AngelList. It's the address book that busy professionals from any walk of life can appreciate, and best of all it's free. \n\nFor developers, the suite of FullContact APIs builds powerful, complete profiles of contacts that can be included in any application.",
"followers" : 258,
"typeId" : "angellist",
"typeName" : "AngelList",
"url" : "https://angel.co/fullcontact",
"username" : "fullcontact"
}, {
"bio" : "FullContact provides a suite of cloud-based contact management solutions for businesses, developers, and individuals.",
"typeId" : "crunchbasecompany",
"typeName" : "CrunchBase",
"url" : "http://www.crunchbase.com/organization/fullcontact",
"username" : "fullcontact"
}, {
"bio" : "FullContact is the API that keeps contact information current. We build APIs that developers can integrate into their applications using any language.",
"followers" : 28,
"following" : 55,
"typeId" : "pinterest",
"typeName" : "Pinterest",
"url" : "http://www.pinterest.com/fullcontact/",
"username" : "fullcontact"
}, {
"bio" : "All your contacts in one place and automatically up-to-date. Learn more about how we're solving the world's contact information problem at https://www.fullcontact.com.",
"typeId" : "google",
"typeName" : "GooglePlus",
"url" : "https://plus.google.com/u/0/107620035082673219790",
"id" : "107620035082673219790"
}, {
"typeId" : "klout",
"typeName" : "Klout",
"url" : "http://klout.com/FullContact",
"username" : "FullContact",
"id" : "32651102063581374"
}, {
"typeId" : "klout",
"typeName" : "Klout",
"url" : "http://klout.com/fullcontactinc",
"username" : "fullcontactinc",
"id" : "64457798643301578"
}, {
"typeId" : "klout",
"typeName" : "Klout",
"url" : "http://klout.com/FullContactApp",
"username" : "FullContactApp",
"id" : "85568398087860504"
}, {
"typeId" : "youtube",
"typeName" : "YouTube",
"url" : "https://youtube.com/user/FullContactAPI",
"username" : "FullContactAPI"
}, {
"bio" : "FullContact is the largest fully connected contact management platform for professionals and enterprises who need to master their contacts and be awesome with people.\n\n FullContact's cross-platform suite of Apps and APIs enhance contacts with insights, while keeping them organized, synchronized, up to date, and safe.",
"typeId" : "linkedincompany",
"typeName" : "LinkedIn",
"url" : "https://www.linkedin.com/company/fullcontact-inc-",
"username" : "fullcontact-inc-",
"id" : "2431118"
} ],
"traffic" : {
"topCountryRanking" : [ {
"rank" : 11495,
"locale" : "us"
}, {
"rank" : 13300,
"locale" : "in"
}, {
"rank" : 9307,
"locale" : "fr"
} ],
"ranking" : [ {
"rank" : 23918,
"locale" : "global"
}, {
"rank" : 11495,
"locale" : "us"
} ]
}
}
@@ -9,6 +9,7 @@
"logo" : "https://d2ojpxxtu63wzl.cloudfront.net/static/1bacd7306731a30d2a9f024eeb1dcff1_94d77dcdedbfe40707ac4a75ca4f4d2978bffc20b2e33a3288ea9e4d47f5af6c",
"website" : "https://www.fullcontact.com",
"languageLocale" : "en",
"industries":[],
"organization" : {
"name" : "FullContact Inc.",
"approxEmployees" : 75,
@@ -207,4 +208,4 @@
"locale" : "us"
} ]
}
}
}

0 comments on commit ad057f6

Please sign in to comment.