Commit f871a6e3 by Rob Holland

Swing find endpoint to /v2

parent fcee189a
...@@ -6,7 +6,7 @@ var _ = require('lodash'); ...@@ -6,7 +6,7 @@ var _ = require('lodash');
var Company = require('./enrichment/company'); var Company = require('./enrichment/company');
var Person = require('./enrichment/person'); var Person = require('./enrichment/person');
exports.Enrichment = resource.create('Enrichment', {api: 'person'}) exports.Enrichment = resource.create('Enrichment', {api: 'person', version: 2})
.extend(null, { .extend(null, {
find: function(options){ find: function(options){
options = options || {}; options = options || {};
......
...@@ -4,7 +4,7 @@ var assert = require('assert'); ...@@ -4,7 +4,7 @@ var assert = require('assert');
var resource = require('../resource'); var resource = require('../resource');
var _ = require('lodash'); var _ = require('lodash');
exports.Company = resource.create('Company', {api: 'company'}) exports.Company = resource.create('Company', {api: 'company', version: 2})
.extend({ .extend({
flag: function(options){ flag: function(options){
return this.constructor.post('/companies/' + this.id + '/flag', options); return this.constructor.post('/companies/' + this.id + '/flag', options);
......
...@@ -4,7 +4,7 @@ var assert = require('assert'); ...@@ -4,7 +4,7 @@ var assert = require('assert');
var resource = require('../resource'); var resource = require('../resource');
var _ = require('lodash'); var _ = require('lodash');
exports.Person = resource.create('Person', {api: 'person'}) exports.Person = resource.create('Person', {api: 'person', version: 2})
.extend({ .extend({
flag: function(options){ flag: function(options){
return this.constructor.post('/people/' + this.id + '/flag', options); return this.constructor.post('/people/' + this.id + '/flag', options);
......
...@@ -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/find?domain=uber.com') .get('/v2/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) {
...@@ -32,9 +32,8 @@ describe('Company', function () { ...@@ -32,9 +32,8 @@ describe('Company', function () {
}); });
it('can handle queued requests', function () { it('can handle queued requests', function () {
mock mock
.get('/v1/companies/find?domain=uber.com') .get('/v2/companies/find?domain=uber.com')
.reply(202, { .reply(202, {
error: { error: {
type: 'queued' type: 'queued'
...@@ -46,7 +45,7 @@ describe('Company', function () { ...@@ -46,7 +45,7 @@ describe('Company', function () {
it('can handle unknown records', function () { it('can handle unknown records', function () {
mock mock
.get('/v1/companies/find?domain=nonexistent.co') .get('/v2/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/find?email=alex%40alexmaccaw.com') .get('/v2/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/find?email=alex%40alexmaccaw.com&subscribe=true') .get('/v2/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/find?email=alex%40alexmaccaw.com') .get('/v2/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/find?email=bademail%40unknown.com') .get('/v2/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/find?email=alex%40alexmaccaw.com') .get('/v2/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/find?email=alex%40alexmaccaw.com') .get('/v2/combined/find?email=alex%40alexmaccaw.com')
.reply(202, { .reply(202, {
error: { error: {
type: 'queued' type: 'queued'
......
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