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
c2c6ebcb
Commit
c2c6ebcb
authored
Oct 10, 2014
by
Ben Drucker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attach resources to the Client in the ctor
parent
8e7e042e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
9 deletions
+8
-9
client.js
src/client.js
+3
-0
company.js
test/company.js
+4
-6
person.js
test/person.js
+1
-3
No files found.
src/client.js
View file @
c2c6ebcb
...
...
@@ -12,6 +12,9 @@ function ClearbitClient (config) {
assert
(
this
instanceof
ClearbitClient
,
'Client must be called with new'
);
assert
(
!!
config
.
key
,
'An API key must be provided'
);
this
.
key
=
config
.
key
;
this
.
Person
=
require
(
'./person'
)(
this
);
this
.
Company
=
require
(
'./company'
)(
this
);
}
var
base
=
'https://%s%s.clearbit.co/v%s'
;
...
...
test/company.js
View file @
c2c6ebcb
'use strict'
;
var
expect
=
require
(
'chai'
).
expect
;
var
nock
=
require
(
'nock'
);
var
Client
=
require
(
'../src/client'
);
var
expect
=
require
(
'chai'
).
expect
;
var
nock
=
require
(
'nock'
);
var
Client
=
require
(
'../src/client'
);
var
Company
=
new
Client
({
key
:
'k'
}).
Company
;
describe
(
'Company'
,
function
()
{
var
client
=
new
Client
({
key
:
'k'
});
var
Company
=
require
(
'../src/company'
)(
client
);
var
mock
;
before
(
function
()
{
mock
=
nock
(
'https://company.clearbit.co'
);
...
...
test/person.js
View file @
c2c6ebcb
...
...
@@ -3,12 +3,10 @@
var
expect
=
require
(
'chai'
).
expect
;
var
nock
=
require
(
'nock'
);
var
Client
=
require
(
'../src/client'
);
var
Person
=
new
Client
({
key
:
'k'
}).
Person
;
describe
(
'Person'
,
function
()
{
var
client
=
new
Client
({
key
:
'k'
});
var
Person
=
require
(
'../src/person'
)(
client
);
var
mock
;
before
(
function
()
{
mock
=
nock
(
'https://person.clearbit.co'
);
...
...
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