Skip to content

Commit 8bf4aaa

Browse files
authored
Merge pull request #120 from smarty/mitch/new-features-and-fields
International Street Adds a new lookup property named features. Passed to the API as features=occupant-use Adds a new response field in Metadata called occupant_use which will return a string. US Enrichment Adds a new lookup property named features. This will be passed to the API as features=financial Existing property name: attributes adds financial_history to the property/principal response.
2 parents 1616560 + a468f58 commit 8bf4aaa

File tree

6 files changed

+91
-15
lines changed

6 files changed

+91
-15
lines changed

src/ClientBuilder.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,23 @@ class ClientBuilder {
187187
return this.withCustomCommaSeperatedQuery("features", "component-analysis");
188188
}
189189

190+
/**
191+
* Adds to the request query to use the financial history feature.
192+
* @return ClientBuilder <b>this</b> to accommodate method chaining.
193+
*/
194+
withFinancialHistory() {
195+
return this.withCustomCommaSeperatedQuery("features", "financial");
196+
}
197+
198+
/**
199+
* Adds to the request query to use the occupant use feature.
200+
* @return ClientBuilder <b>this</b> to accommodate method chaining.
201+
*/
202+
withOccupantUse() {
203+
return this.withCustomCommaSeperatedQuery("features", "occupant-use");
204+
}
205+
206+
190207
buildSender() {
191208
if (this.httpSender) return this.httpSender;
192209

src/international_street/Candidate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class Candidate {
155155
this.metadata.geocodePrecision = responseData.metadata.geocode_precision;
156156
this.metadata.maxGeocodePrecision = responseData.metadata.max_geocode_precision;
157157
this.metadata.addressFormat = responseData.metadata.address_format;
158+
this.metadata.occupantUse = responseData.metadata.occupant_use;
158159
}
159160
}
160161
}

src/us_enrichment/Lookup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class Lookup {
55
this.exclude = exclude;
66
this.dataset = dataset;
77
this.dataSubset = dataSubset;
8+
this.features = undefined;
89

910
this.response = {};
1011
this.customParameters = {};

src/us_enrichment/Response.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,54 @@ class Response {
121121
this.attributes.exerciseRoom = responseData.attributes.exercise_room;
122122
this.attributes.exteriorWalls = responseData.attributes.exterior_walls;
123123
this.attributes.familyRoom = responseData.attributes.family_room;
124+
this.attributes.financialHistory = !responseData.attributes.financial_history ? [] : responseData.attributes.financial_history.map(history => {
125+
return {
126+
codeTitleCompany: history.code_title_company,
127+
instrumentDate: history.instrument_date,
128+
interestRateType2: history.interest_rate_type_2,
129+
lenderAddress: history.lender_address,
130+
lenderAddress2: history.lender_address_2,
131+
lenderCity: history.lender_city,
132+
lenderCity2: history.lender_city_2,
133+
lenderCode: history.lender_code,
134+
lenderCode2: history.lender_code_2,
135+
lenderFirstName: history.lender_first_name,
136+
lenderFirstName2: history.lender_first_name_2,
137+
lenderLastName: history.lender_last_name,
138+
lenderLastName2: history.lender_last_name_2,
139+
lenderName: history.lender_name,
140+
lenderName2: history.lender_name_2,
141+
lenderSellerCarryBack: history.lender_seller_carry_back,
142+
lenderSellerCarryBack2: history.lender_seller_carry_back_2,
143+
lenderState: history.lender_state,
144+
lenderState2: history.lender_state_2,
145+
lenderZip: history.lender_zip,
146+
lenderZip2: history.lender_zip_2,
147+
lenderZipExtended: history.lender_zip_extended,
148+
lenderZipExtended2: history.lender_zip_extended_2,
149+
mortgageAmount: history.mortgage_amount,
150+
mortgageAmount2: history.mortgage_amount_2,
151+
mortgageDueDate: history.mortgage_due_date,
152+
mortgageDueDate2: history.mortgage_due_date_2,
153+
mortgageInterestRate: history.mortgage_interest_rate,
154+
mortgageInterestRateType: history.mortgage_interest_rate_type,
155+
mortgageLenderCode: history.mortgage_lender_code,
156+
mortgageRate: history.mortgage_rate,
157+
mortgageRate2: history.mortgage_rate_2,
158+
mortgageRecordingDate: history.mortgage_recording_date,
159+
mortgageRecordingDate2: history.mortgage_recording_date_2,
160+
mortgageTerm: history.mortgage_term,
161+
mortgageTerm2: history.mortgage_term_2,
162+
mortgageTermType: history.mortgage_term_type,
163+
mortgageTermType2: history.mortgage_term_type_2,
164+
mortgageType: history.mortgage_type,
165+
mortgageType2: history.mortgage_type_2,
166+
multiParcelFlag: history.multi_parcel_flag,
167+
nameTitleCompany: history.name_title_company,
168+
recordingDate: history.recording_date,
169+
transferAmount: history.transfer_amount,
170+
}
171+
})
124172
this.attributes.fence = responseData.attributes.fence;
125173
this.attributes.fenceArea = responseData.attributes.fence_area;
126174
this.attributes.fipsCode = responseData.attributes.fips_code;

tests/international_street/test_Candidate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ describe("An International match candidate", function () {
7070
geocode_precision: "54",
7171
max_geocode_precision: "55",
7272
address_format: "56",
73+
occupant_use: "56.5",
7374
},
7475
analysis: {
7576
verification_status: "57",
@@ -204,6 +205,7 @@ describe("An International match candidate", function () {
204205
expect(metadata.geocodePrecision).to.equal("54");
205206
expect(metadata.maxGeocodePrecision).to.equal("55");
206207
expect(metadata.addressFormat).to.equal("56");
208+
expect(metadata.occupantUse).to.equal("56.5");
207209
let analysis = candidate.analysis;
208210
expect(analysis.verificationStatus).to.equal("57");
209211
expect(analysis.addressPrecision).to.equal("58");

tests/us_enrichment/test_Lookup.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,27 @@ const expect = chai.expect;
33
const Lookup = require("../../src/us_enrichment/Lookup");
44

55
describe("A US Enrichment Lookup", function () {
6-
it("can be newed up with all basic fields.", function () {
7-
const expectedSmartyKey = "a";
8-
const expectedInclude = "b";
9-
const expectedExclude = "c";
10-
const expectedDataset = "d";
11-
const expectedDataSubset = "e";
12-
13-
let lookup = new Lookup(expectedSmartyKey, expectedInclude, expectedExclude, expectedDataset, expectedDataSubset);
14-
expect(lookup.smartyKey).to.equal(expectedSmartyKey);
15-
expect(lookup.include).to.equal(expectedInclude);
16-
expect(lookup.exclude).to.equal(expectedExclude);
17-
expect(lookup.dataset).to.equal(expectedDataset);
18-
expect(lookup.dataSubset).to.equal(expectedDataSubset);
19-
});
20-
6+
it("can be newed up with all basic fields.", function () {
7+
const expectedSmartyKey = "a";
8+
const expectedInclude = "b";
9+
const expectedExclude = "c";
10+
const expectedDataset = "d";
11+
const expectedDataSubset = "e";
12+
const expectedFeatures = "f";
2113

14+
let lookup = new Lookup(
15+
expectedSmartyKey,
16+
expectedInclude,
17+
expectedExclude,
18+
expectedDataset,
19+
expectedDataSubset,
20+
);
21+
lookup.features = expectedFeatures;
22+
expect(lookup.smartyKey).to.equal(expectedSmartyKey);
23+
expect(lookup.include).to.equal(expectedInclude);
24+
expect(lookup.exclude).to.equal(expectedExclude);
25+
expect(lookup.dataset).to.equal(expectedDataset);
26+
expect(lookup.dataSubset).to.equal(expectedDataSubset);
27+
expect(lookup.features).to.equal(expectedFeatures);
28+
});
2229
});

0 commit comments

Comments
 (0)