Commit fcee189a by Rob Holland

Use new find endpoint.

parent 102a1dde
......@@ -16,10 +16,7 @@ exports.Enrichment = resource.create('Enrichment', {api: 'person'})
assert(options.email, 'An email must be provided');
return this.get(
'/combined/email/' + options.email,
_.omit(options, 'email')
);
return this.get('/combined/find', options);
},
Company: Company,
......
......@@ -15,9 +15,6 @@ exports.Company = resource.create('Company', {api: 'company'})
options = options || {};
assert(options.domain, 'A domain must be provided');
return this.get(
'/companies/domain/' + options.domain,
_.omit(options, 'domain')
);
return this.get('/companies/find', options);
}
});
......@@ -15,9 +15,6 @@ exports.Person = resource.create('Person', {api: 'person'})
options = options || {};
assert(options.email, 'An email must be provided');
return this.get(
'/people/email/' + options.email,
_.omit(options, 'email')
);
return this.get('/people/find', options);
}
});
......@@ -21,7 +21,7 @@ describe('Company', function () {
it('can find a company by domain', function () {
mock
.get('/v1/companies/domain/uber.com')
.get('/v1/companies/find?domain=uber.com')
.reply(200, company);
return Company.find({domain: 'uber.com'})
.then(function (company) {
......@@ -34,7 +34,7 @@ describe('Company', function () {
it('can handle queued requests', function () {
mock
.get('/v1/companies/domain/uber.com')
.get('/v1/companies/find?domain=uber.com')
.reply(202, {
error: {
type: 'queued'
......@@ -46,7 +46,7 @@ describe('Company', function () {
it('can handle unknown records', function () {
mock
.get('/v1/companies/domain/nonexistent.co')
.get('/v1/companies/find?domain=nonexistent.co')
.reply(404, {
error: {
type: 'unknown_record'
......
......@@ -23,7 +23,7 @@ describe('Person', function () {
it('can find a person by email', function () {
mock
.get('/v1/people/email/alex@alexmaccaw.com')
.get('/v1/people/find?email=alex%40alexmaccaw.com')
.reply(200, alex);
return Person.find({email: 'alex@alexmaccaw.com'})
.then(function (person) {
......@@ -35,14 +35,14 @@ describe('Person', function () {
it('can subscribe to a person', function () {
mock
.get('/v1/people/email/alex@alexmaccaw.com?subscribe=true')
.get('/v1/people/find?email=alex%40alexmaccaw.com&subscribe=true')
.reply(200, alex);
return Person.find({email: 'alex@alexmaccaw.com', subscribe: true});
});
it('can handle queued requests', function () {
mock
.get('/v1/people/email/alex@alexmaccaw.com')
.get('/v1/people/find?email=alex%40alexmaccaw.com')
.reply(202, {
error: {
type: 'queued'
......@@ -54,7 +54,7 @@ describe('Person', function () {
it('can handle unknown records', function () {
mock
.get('/v1/people/email/bademail@unknown.com')
.get('/v1/people/find?email=bademail%40unknown.com')
.reply(404, {
error: {
type: 'unknown_record'
......@@ -70,7 +70,7 @@ describe('Person', function () {
it('can find a person by email', function () {
mock
.get('/v1/combined/email/alex@alexmaccaw.com')
.get('/v1/combined/find?email=alex%40alexmaccaw.com')
.reply(200, {
person: alex,
company: company
......@@ -86,7 +86,7 @@ describe('Person', function () {
it('can handle queued requests', function () {
mock
.get('/v1/combined/email/alex@alexmaccaw.com')
.get('/v1/combined/find?email=alex%40alexmaccaw.com')
.reply(202, {
error: {
type: 'queued'
......@@ -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