Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
clearbit
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
prospector
clearbit
Commits
39b31707
Commit
39b31707
authored
Nov 17, 2015
by
Rob Holland
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14 from clearbit/rh-find-endpoint
Use new find endpoint.
parents
102a1dde
d6d64443
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
29 deletions
+15
-29
enrichment.js
src/enrichment.js
+2
-6
company.js
src/enrichment/company.js
+2
-6
person.js
src/enrichment/person.js
+2
-6
company.js
test/company.js
+3
-4
person.js
test/person.js
+6
-7
No files found.
src/enrichment.js
View file @
39b31707
...
@@ -2,11 +2,10 @@
...
@@ -2,11 +2,10 @@
var
assert
=
require
(
'assert'
);
var
assert
=
require
(
'assert'
);
var
resource
=
require
(
'./resource'
);
var
resource
=
require
(
'./resource'
);
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
||
{};
...
@@ -16,10 +15,7 @@ exports.Enrichment = resource.create('Enrichment', {api: 'person'})
...
@@ -16,10 +15,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
,
...
...
src/enrichment/company.js
View file @
39b31707
...
@@ -2,9 +2,8 @@
...
@@ -2,9 +2,8 @@
var
assert
=
require
(
'assert'
);
var
assert
=
require
(
'assert'
);
var
resource
=
require
(
'../resource'
);
var
resource
=
require
(
'../resource'
);
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
);
...
@@ -15,9 +14,6 @@ exports.Company = resource.create('Company', {api: 'company'})
...
@@ -15,9 +14,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'
)
);
}
}
});
});
src/enrichment/person.js
View file @
39b31707
...
@@ -2,9 +2,8 @@
...
@@ -2,9 +2,8 @@
var
assert
=
require
(
'assert'
);
var
assert
=
require
(
'assert'
);
var
resource
=
require
(
'../resource'
);
var
resource
=
require
(
'../resource'
);
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
);
...
@@ -15,9 +14,6 @@ exports.Person = resource.create('Person', {api: 'person'})
...
@@ -15,9 +14,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'
)
);
}
}
});
});
test/company.js
View file @
39b31707
...
@@ -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
(
'/v
1/companies/domain/
uber.com'
)
.
get
(
'/v
2/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
(
'/v
1/companies/domain/
uber.com'
)
.
get
(
'/v
2/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
(
'/v
1/companies/domain/
nonexistent.co'
)
.
get
(
'/v
2/companies/find?domain=
nonexistent.co'
)
.
reply
(
404
,
{
.
reply
(
404
,
{
error
:
{
error
:
{
type
:
'unknown_record'
type
:
'unknown_record'
...
...
test/person.js
View file @
39b31707
...
@@ -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
(
'/v
1/people/email/alex@
alexmaccaw.com'
)
.
get
(
'/v
2/people/find?email=alex%40
alexmaccaw.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
(
'/v
1/people/email/alex@alexmaccaw.com?
subscribe=true'
)
.
get
(
'/v
2/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
(
'/v
1/people/email/alex@
alexmaccaw.com'
)
.
get
(
'/v
2/people/find?email=alex%40
alexmaccaw.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
(
'/v
1/people/email/bademail@
unknown.com'
)
.
get
(
'/v
2/people/find?email=bademail%40
unknown.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
(
'/v
1/combined/email/alex@
alexmaccaw.com'
)
.
get
(
'/v
2/combined/find?email=alex%40
alexmaccaw.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
(
'/v
1/combined/email/alex@
alexmaccaw.com'
)
.
get
(
'/v
2/combined/find?email=alex%40
alexmaccaw.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 () {
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment