From ddcfd8009217be570fea3353e695149128f04e19 Mon Sep 17 00:00:00 2001 From: Maksym Novozhylov Date: Thu, 24 May 2018 17:30:21 +0200 Subject: [PATCH 1/2] Prepare changes for the upcoming release --- .tests | 1 + CHANGES.md | 5 ++++ lib/routers/snapshot.js | 52 +++--------------------------------- lib/routers/teams.js | 57 ---------------------------------------- lib/routers/workdays.js | 4 +-- lib/routers/workdiary.js | 7 +++-- package.json | 2 +- 7 files changed, 15 insertions(+), 113 deletions(-) create mode 100644 .tests create mode 100644 CHANGES.md delete mode 100644 lib/routers/teams.js diff --git a/.tests b/.tests new file mode 100644 index 0000000..72c4429 --- /dev/null +++ b/.tests @@ -0,0 +1 @@ +npm test diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..0494c93 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,5 @@ +# Release History + +## 1.3.0 +* Stop supporting deprecated Teamrooms API +* Migrate Workdiaries, Workdays and Snapshots API to v3 diff --git a/lib/routers/snapshot.js b/lib/routers/snapshot.js index 4a023ba..75a9623 100644 --- a/lib/routers/snapshot.js +++ b/lib/routers/snapshot.js @@ -32,52 +32,6 @@ exports.Snapshot = function(api) { this.api.epoint = entryPoint; } -/** - * Get snaphot info - * - * @method get - * @param company {String} Company - * @param username {String} Username - * @param ts {String} Timestamp - * @param callback {String} Callback function - * @async - */ -exports.Snapshot.prototype.get = function(company, username, ts, callback) { - debug('running request'); - this.api.client.get('team/v1/snapshots/' + company + '/' + username + '/' + ts, {}, callback); -} - -/** - * Update snapshot - * - * @method update - * @param company {String} Company - * @param username {String} Username - * @param ts {String} Timestamp - * @param params {Hash} Parameters - * @param callback {String} Callback function - * @async - */ -exports.Snapshot.prototype.update = function(company, username, ts, params, callback) { - debug('running request'); - this.api.client.put('team/v1/snapshots/' + company + '/' + username + '/' + ts, params, callback); -} - -/** - * Delete snaphot - * - * @method delete - * @param company {String} Company - * @param username {String} Username - * @param ts {String} Timestamp - * @param callback {String} Callback function - * @async - */ -exports.Snapshot.prototype.delete = function(company, username, ts, callback) { - debug('running request'); - this.api.client.delete('team/v1/snapshots/' + company + '/' + username + '/' + ts, {}, callback); -} - /** * Get snaphot info by specific contract * @@ -89,7 +43,7 @@ exports.Snapshot.prototype.delete = function(company, username, ts, callback) { */ exports.Snapshot.prototype.getByContract = function(contract, ts, callback) { debug('running request'); - this.api.client.get('team/v2/snapshots/contracts/' + contract + '/' + ts, {}, callback); + this.api.client.get('team/v3/snapshots/contracts/' + contract + '/' + ts, {}, callback); } /** @@ -104,7 +58,7 @@ exports.Snapshot.prototype.getByContract = function(contract, ts, callback) { */ exports.Snapshot.prototype.updateByContract = function(contract, ts, params, callback) { debug('running request'); - this.api.client.put('team/v2/snapshots/contracts/' + contract + '/' + ts, params, callback); + this.api.client.put('team/v3/snapshots/contracts/' + contract + '/' + ts, params, callback); } /** @@ -118,5 +72,5 @@ exports.Snapshot.prototype.updateByContract = function(contract, ts, params, cal */ exports.Snapshot.prototype.deleteByContract = function(contract, ts, callback) { debug('running request'); - this.api.client.delete('team/v2/snapshots/contracts/' + contract + '/' + ts, {}, callback); + this.api.client.delete('team/v3/snapshots/contracts/' + contract + '/' + ts, {}, callback); } diff --git a/lib/routers/teams.js b/lib/routers/teams.js deleted file mode 100644 index 05e0bca..0000000 --- a/lib/routers/teams.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Upwork auth library for using with public API by OAuth - * - * @package UpworkAPI - * @since 09/23/2014 - * @copyright Copyright 2014(c) Upwork.com - * @author Maksym Novozhylov - * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} - */ - -/** - * @module routes.teams - */ - -/** - * @property entryPoint - * @type String - * @default api - * @static - * @final - */ -var entryPoint = 'api'; - -/** - * @class Teams - * @constructor - */ -exports.Teams = function(api) { - this.api = api; - this.api.epoint = entryPoint; -} - -/** - * Get Teamrooms - * - * @method getList - * @param callback {String} Callback function - * @async - */ -exports.Teams.prototype.getList = function(callback) { - debug('running request'); - this.api.client.get('team/v2/teamrooms', {}, callback); -} - -/** - * Get specific team or company - * - * @method getSpecific - * @param team {String} Teamroom or company ID - * @param params {Hash} Parameters - * @param callback {String} Callback function - * @async - */ -exports.Teams.prototype.getSpecific = function(team, params, callback) { - debug('running request'); - this.api.client.get('team/v2/teamrooms/' + team, params, callback); -} diff --git a/lib/routers/workdays.js b/lib/routers/workdays.js index 8dae9d0..42e9fc2 100644 --- a/lib/routers/workdays.js +++ b/lib/routers/workdays.js @@ -43,7 +43,7 @@ exports.Workdays = function(api) { */ exports.Workdays.prototype.getByCompany = function(company, fromDate, tillDate, params, callback) { debug('running request'); - this.api.client.get('team/v2/workdays/companies/' + company + '/' + fromDate + ',' + tillDate, params, callback); + this.api.client.get('team/v3/workdays/companies/' + company + '/' + fromDate + ',' + tillDate, params, callback); } /** @@ -59,5 +59,5 @@ exports.Workdays.prototype.getByCompany = function(company, fromDate, tillDate, */ exports.Workdays.prototype.getByContract = function(contract, fromDate, tillDate, params, callback) { debug('running request'); - this.api.client.get('team/v2/workdays/contracts/' + contract + '/' + fromDate + ',' + tillDate, params, callback); + this.api.client.get('team/v3/workdays/contracts/' + contract + '/' + fromDate + ',' + tillDate, params, callback); } diff --git a/lib/routers/workdiary.js b/lib/routers/workdiary.js index 636c410..b1cf306 100644 --- a/lib/routers/workdiary.js +++ b/lib/routers/workdiary.js @@ -35,15 +35,14 @@ exports.Workdiary = function(api) { * * @method get * @param company {String} Company - * @param username {String} Username * @param date {String} Date * @param params {Hash} Parameters * @param callback {String} Callback function * @async */ -exports.Workdiary.prototype.get = function(company, username, date, params, callback) { +exports.Workdiary.prototype.get = function(company, date, params, callback) { debug('running request'); - this.api.client.get('team/v1/workdiaries/' + company + '/' + username + '/' + date, params, callback); + this.api.client.get('team/v3/workdiaries/companies/' + company + '/' + date, params, callback); } /** @@ -58,5 +57,5 @@ exports.Workdiary.prototype.get = function(company, username, date, params, call */ exports.Workdiary.prototype.getByContract = function(contract, date, params, callback) { debug('running request'); - this.api.client.get('team/v2/workdiaries/contracts/' + contract + '/' + date, params, callback); + this.api.client.get('team/v3/workdiaries/contracts/' + contract + '/' + date, params, callback); } diff --git a/package.json b/package.json index d0aaa44..5e1d097 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "upwork-api", "description": "Node.JS bindings for Upwork API", - "version": "1.2.4", + "version": "1.3.0", "author": { "name": "Maksym Novozhylov", "email": "mnovozhilov@upwork.com" From 66b04e8ca8e3b63c474b19816ba331b61cc4e3f0 Mon Sep 17 00:00:00 2001 From: Maksym Novozhylov Date: Fri, 25 May 2018 11:18:16 +0200 Subject: [PATCH 2/2] Fix travis config --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2373bd6..3868cb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,10 @@ language: node_js node_js: - - 0.9 - 0.10 - 0.11 + - 7 + - 8 notifications: email: