Commit fcee189a by Rob Holland

Use new find endpoint.

parent 102a1dde
...@@ -16,10 +16,7 @@ exports.Enrichment = resource.create('Enrichment', {api: 'person'}) ...@@ -16,10 +16,7 @@ exports.Enrichment = resource.create('Enrichment', {api: 'person'})
assert(options.email, 'An email must be provided'); assert(options.email, 'An email must be provided');
return this.get( return this.get('/combined/find', options);
'/combined/email/' + options.email,
_.omit(options, 'email')
);
}, },
Company: Company, Company: Company,
......
...@@ -15,9 +15,6 @@ exports.Company = resource.create('Company', {api: 'company'}) ...@@ -15,9 +15,6 @@ exports.Company = resource.create('Company', {api: 'company'})
options = options || {}; options = options || {};
assert(options.domain, 'A domain must be provided'); assert(options.domain, 'A domain must be provided');
return this.get( return this.get('/companies/find', options);
'/companies/domain/' + options.domain,
_.omit(options, 'domain')
);
} }
}); });
...@@ -15,9 +15,6 @@ exports.Person = resource.create('Person', {api: 'person'}) ...@@ -15,9 +15,6 @@ exports.Person = resource.create('Person', {api: 'person'})
options = options || {}; options = options || {};
assert(options.email, 'An email must be provided'); assert(options.email, 'An email must be provided');
return this.get( return this.get('/people/find', options);
'/people/email/' + options.email,
_.omit(options, 'email')
);
} }
}); });
...@@ -21,7 +21,7 @@ describe('Company', function () { ...@@ -21,7 +21,7 @@ describe('Company', function () {
it('can find a company by domain', function () { it('can find a company by domain', function () {
mock mock
.get('/v1/companies/domain/uber.com') .get('/v1/companies/find?domain=uber.com')
.reply(200, company); .reply(200, company);
return Company.find({domain: 'uber.com'}) return Company.find({domain: 'uber.com'})
.then(function (company) { .then(function (company) {
...@@ -34,7 +34,7 @@ describe('Company', function () { ...@@ -34,7 +34,7 @@ describe('Company', function () {
it('can handle queued requests', function () { it('can handle queued requests', function () {
mock mock
.get('/v1/companies/domain/uber.com') .get('/v1/companies/find?domain=uber.com')
.reply(202, { .reply(202, {
error: { error: {
type: 'queued' type: 'queued'
...@@ -46,7 +46,7 @@ describe('Company', function () { ...@@ -46,7 +46,7 @@ describe('Company', function () {
it('can handle unknown records', function () { it('can handle unknown records', function () {
mock mock
.get('/v1/companies/domain/nonexistent.co') .get('/v1/companies/find?domain=nonexistent.co')
.reply(404, { .reply(404, {
error: { error: {
type: 'unknown_record' type: 'unknown_record'
......
...@@ -23,7 +23,7 @@ describe('Person', function () { ...@@ -23,7 +23,7 @@ describe('Person', function () {
it('can find a person by email', function () { it('can find a person by email', function () {
mock mock
.get('/v1/people/email/alex@alexmaccaw.com') .get('/v1/people/find?email=alex%40alexmaccaw.com')
.reply(200, alex); .reply(200, alex);
return Person.find({email: 'alex@alexmaccaw.com'}) return Person.find({email: 'alex@alexmaccaw.com'})
.then(function (person) { .then(function (person) {
...@@ -35,14 +35,14 @@ describe('Person', function () { ...@@ -35,14 +35,14 @@ describe('Person', function () {
it('can subscribe to a person', function () { it('can subscribe to a person', function () {
mock mock
.get('/v1/people/email/alex@alexmaccaw.com?subscribe=true') .get('/v1/people/find?email=alex%40alexmaccaw.com&subscribe=true')
.reply(200, alex); .reply(200, alex);
return Person.find({email: 'alex@alexmaccaw.com', subscribe: true}); return Person.find({email: 'alex@alexmaccaw.com', subscribe: true});
}); });
it('can handle queued requests', function () { it('can handle queued requests', function () {
mock mock
.get('/v1/people/email/alex@alexmaccaw.com') .get('/v1/people/find?email=alex%40alexmaccaw.com')
.reply(202, { .reply(202, {
error: { error: {
type: 'queued' type: 'queued'
...@@ -54,7 +54,7 @@ describe('Person', function () { ...@@ -54,7 +54,7 @@ describe('Person', function () {
it('can handle unknown records', function () { it('can handle unknown records', function () {
mock mock
.get('/v1/people/email/bademail@unknown.com') .get('/v1/people/find?email=bademail%40unknown.com')
.reply(404, { .reply(404, {
error: { error: {
type: 'unknown_record' type: 'unknown_record'
...@@ -70,7 +70,7 @@ describe('Person', function () { ...@@ -70,7 +70,7 @@ describe('Person', function () {
it('can find a person by email', function () { it('can find a person by email', function () {
mock mock
.get('/v1/combined/email/alex@alexmaccaw.com') .get('/v1/combined/find?email=alex%40alexmaccaw.com')
.reply(200, { .reply(200, {
person: alex, person: alex,
company: company company: company
...@@ -86,7 +86,7 @@ describe('Person', function () { ...@@ -86,7 +86,7 @@ describe('Person', function () {
it('can handle queued requests', function () { it('can handle queued requests', function () {
mock mock
.get('/v1/combined/email/alex@alexmaccaw.com') .get('/v1/combined/find?email=alex%40alexmaccaw.com')
.reply(202, { .reply(202, {
error: { error: {
type: 'queued' type: 'queued'
...@@ -99,4 +99,3 @@ describe('Person', function () { ...@@ -99,4 +99,3 @@ describe('Person', function () {
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment