Skip to content

Commit

Permalink
Merge pull request #54 from UI-Jakob/master
Browse files Browse the repository at this point in the history
added historical follower stats and impressions stats and tests
  • Loading branch information
ArkeologeN committed Dec 11, 2015
2 parents 6dbbf35 + 02b799f commit 001f6e5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/services/companies.js
Expand Up @@ -27,6 +27,14 @@
this.company_stats = function(id, cb) {
this.createCall('GET', 'companies/' +id + "/company-statistics", cb)(this.config);
};

this.company_historical_follower_stats = function(id, start, end, cb){
this.createCall('GET', 'companies/' +id + "/historical-follow-statistics", {"time-granularity": "day","start-timestamp": start,"end-timestamp": end}, cb)(this.config);
};

this.company_historical_status_update_stats = function(id, start, end, cb){
this.createCall('GET', 'companies/' +id + "/historical-status-update-statistics", {"time-granularity": "day","start-timestamp": start,"end-timestamp": end}, cb)(this.config);
};

this.name = function(name, cb) {
this.createCall('GET', 'companies/universal-name=' + name.split(' ').join('-') + ":("+ fields.join(',') + ")", cb)(this.config);
Expand Down
27 changes: 27 additions & 0 deletions specs/services/companies_spec.js
Expand Up @@ -21,6 +21,33 @@ describe('API: Companies Test Suite', function() {
});
});

it('should get the statistics for a company by the given id', function(done) {
linkedin.companies.company_stats('162479', function(err, company) {
expect(err).toBe(null);
expect(company).not.toBe(null);
expect(typeof company).toBe('object');
done();
});
});

it('should get the historical follower count for a company by the given id', function(done) {
linkedin.companies.company_historical_follower_stats('162479', 1418117379000, 1449665843000, function(err, company) {
expect(err).toBe(null);
expect(company).not.toBe(null);
expect(typeof company).toBe('object');
done();
});
});

it('should get the historical impressions count for a company by the given id', function(done) {
linkedin.companies.company_historical_status_update_stats('162479', 1418117379000, 1449665843000, function(err, company) {
expect(err).toBe(null);
expect(company).not.toBe(null);
expect(typeof company).toBe('object');
done();
});
});

it('should get company by universal name', function(done) {
linkedin.companies.name('facebook', function(err, company) {
expect(err).toBe(null);
Expand Down

0 comments on commit 001f6e5

Please sign in to comment.