-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from route4me/dev-kiryl
Added Missing Routes Examples and Activities Feed Type
- Loading branch information
Showing
53 changed files
with
8,199 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"use strict" | ||
|
||
const path = require("path") | ||
const chai = require("chai") | ||
const debug = require("debug")("route4me-node:examples") | ||
require("../init-examples-suite") | ||
const helper = require("../../test/helper") | ||
|
||
helper.describeIntegration(helper.toSuiteName(__filename), function T() { | ||
this.timeout(5000) | ||
this.slow(3000) | ||
it(path.basename(__filename), (done) => { | ||
// const Route4Me = require("route4me-node") | ||
const expect = chai.expect | ||
const apiKey = "11111111111111111111111111111111" | ||
const route4me = new Route4Me(apiKey) | ||
|
||
const param = ""; | ||
var memberid = -1; | ||
route4me.Members.get(param, (err, member) => { | ||
debug("error ", err) | ||
debug("result ", member) | ||
expect(err).is.null | ||
expect(member).exist | ||
//console.log(member) | ||
memberid = member.results[0].member_id | ||
}) | ||
|
||
const data = { | ||
"member_id": memberid, | ||
"offset": 0, | ||
"limit": 10 | ||
} | ||
|
||
route4me.ActivityFeed.getactivities_example(data, (err, activity_feed) => { | ||
debug("error ", err) | ||
debug("result ", activity_feed) | ||
expect(err).is.null | ||
expect(activity_feed).exist | ||
console.log(activity_feed) | ||
}) | ||
// TODO: remove `done` call from examples | ||
done() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"use strict" | ||
|
||
const path = require("path") | ||
const chai = require("chai") | ||
const debug = require("debug")("route4me-node:examples") | ||
require("../init-examples-suite") | ||
const helper = require("../../test/helper") | ||
|
||
helper.describeIntegration(helper.toSuiteName(__filename), function T() { | ||
this.timeout(5000) | ||
this.slow(3000) | ||
it(path.basename(__filename), (done) => { | ||
// const Route4Me = require("route4me-node") | ||
const expect = chai.expect | ||
const apiKey = "11111111111111111111111111111111" | ||
const route4me = new Route4Me(apiKey) | ||
|
||
const data = { | ||
"limit": 10, | ||
"offset": 0 | ||
} | ||
|
||
route4me.ActivityFeed.getactivities_example(data, (err, activity_feed) => { | ||
debug("error ", err) | ||
debug("result ", activity_feed) | ||
expect(err).is.null | ||
expect(activity_feed).exist | ||
console.log(activity_feed) | ||
}) | ||
// TODO: remove `done` call from examples | ||
done() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"use strict" | ||
|
||
const path = require("path") | ||
const chai = require("chai") | ||
const debug = require("debug")("route4me-node:examples") | ||
require("../init-examples-suite") | ||
const helper = require("../../test/helper") | ||
|
||
helper.describeIntegration(helper.toSuiteName(__filename), function T() { | ||
this.timeout(5000) | ||
this.slow(3000) | ||
it(path.basename(__filename), (done) => { | ||
// const Route4Me = require("route4me-node") | ||
const expect = chai.expect | ||
const apiKey = "11111111111111111111111111111111" | ||
const route4me = new Route4Me(apiKey) | ||
|
||
const today = new Date() | ||
var activitiesAfterTime = new Date() | ||
activitiesAfterTime.setDate(activitiesAfterTime.getDate() - 7) | ||
var origintime = new Date(1970, 1, 1, 0, 0, 0, 0) | ||
if (activitiesAfterTime < origintime) | ||
activitiesAfterTime = new Date(1970, 1, 1, activitiesAfterTime.getUTCHours(), activitiesAfterTime.getUTCMinutes(), activitiesAfterTime.getUTCSeconds()) | ||
var diffspan = Math.floor((activitiesAfterTime.getTime() - origintime.getTime())/ 1000) | ||
|
||
const data = { | ||
"limit": 10, | ||
"offset": 0, | ||
"start": diffspan | ||
} | ||
|
||
route4me.ActivityFeed.getactivities_example(data, (err, activity_feed) => { | ||
debug("error ", err) | ||
debug("result ", activity_feed) | ||
expect(err).is.null | ||
expect(activity_feed).exist | ||
console.log(activity_feed) | ||
}) | ||
// TODO: remove `done` call from examples | ||
done() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
"use strict" | ||
|
||
const path = require("path") | ||
const chai = require("chai") | ||
const debug = require("debug")("route4me-node:examples") | ||
require("../init-examples-suite") | ||
const helper = require("../../test/helper") | ||
|
||
helper.describeIntegration(helper.toSuiteName(__filename), function T() { | ||
this.timeout(5000) | ||
this.slow(3000) | ||
it(path.basename(__filename), (done) => { | ||
// const Route4Me = require("route4me-node") | ||
const expect = chai.expect | ||
const apiKey = "11111111111111111111111111111111" | ||
const route4me = new Route4Me(apiKey) | ||
|
||
const today = new Date() | ||
var tomorrow = new Date(today) | ||
tomorrow.setDate(tomorrow.getDate() + 1) | ||
var origintime = new Date(1970, 1, 1, 0, 0, 0, 0) | ||
if (tomorrow < origintime) | ||
tomorrow = new Date(1970, 1, 1, tomorrow.getUTCHours(), tomorrow.getUTCMinutes(), tomorrow.getUTCSeconds()) | ||
var diffspan = Math.floor((tomorrow.getTime() - origintime.getTime())/ 1000) | ||
var routeid = "" | ||
const param = { | ||
"addresses": [ | ||
{ | ||
"address" : "151 Arbor Way Milledgeville GA 31061", | ||
"is_depot" : true, | ||
"lat" : 33.132675170898, | ||
"lng" : -83.244743347168, | ||
"time" : 0, | ||
"CustomFields" : {"color": "red" , "size": "huge"} | ||
}, | ||
{ | ||
"address" : "230 Arbor Way Milledgeville GA 31061", | ||
"lat" : 33.129695892334, | ||
"lng" : -83.24577331543, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "148 Bass Rd NE Milledgeville GA 31061", | ||
"lat" : 33.143497, | ||
"lng" : -83.224487, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "117 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.141784667969, | ||
"lng" : -83.237518310547, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "119 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.141086578369, | ||
"lng" : -83.238258361816, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "131 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.142036437988, | ||
"lng" : -83.238845825195, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "138 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.14307, | ||
"lng" : -83.239334, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "139 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.142734527588, | ||
"lng" : -83.237442016602, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "145 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.143871307373, | ||
"lng" : -83.237342834473, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "221 Blake Cir Milledgeville GA 31061", | ||
"lat" : 33.081462860107, | ||
"lng" : -83.208511352539, | ||
"time" : 0 | ||
} | ||
], | ||
"parameters": { | ||
"algorithm_type": 1, | ||
"route_name": "SD Route 10 Stops Test " + today.toUTCString(), | ||
"route_date": diffspan, | ||
"route_time": 60 * 60 * 7, | ||
"optimize": "Distance", | ||
"distance_unit": "mi", | ||
"device_type": "web" | ||
} | ||
} | ||
|
||
route4me.Routes.routeexamples_optiomization(param, (err, sdroute10stopsresult) => { | ||
debug("error ", err) | ||
debug("result ", sdroute10stopsresult) | ||
expect(err).is.null | ||
expect(sdroute10stopsresult).exist | ||
routeid = sdroute10stopsresult.routes[0].route_id | ||
|
||
const data = { | ||
"route_id": routeid, | ||
"team": "true", | ||
"limit": 10, | ||
"offset": 0 | ||
} | ||
|
||
route4me.ActivityFeed.getactivities_example(data, (err, activity_feed) => { | ||
debug("error ", err) | ||
debug("result ", activity_feed) | ||
expect(err).is.null | ||
expect(activity_feed).exist | ||
console.log(activity_feed) | ||
}) | ||
}) | ||
// TODO: remove `done` call from examples | ||
done() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
"use strict" | ||
|
||
const path = require("path") | ||
const chai = require("chai") | ||
const debug = require("debug")("route4me-node:examples") | ||
require("../init-examples-suite") | ||
const helper = require("../../test/helper") | ||
|
||
helper.describeIntegration(helper.toSuiteName(__filename), function T() { | ||
this.timeout(5000) | ||
this.slow(3000) | ||
it(path.basename(__filename), (done) => { | ||
// const Route4Me = require("route4me-node") | ||
const expect = chai.expect | ||
const apiKey = "11111111111111111111111111111111" | ||
const route4me = new Route4Me(apiKey) | ||
const today = new Date(); | ||
var tomorrow = new Date(today) | ||
tomorrow.setDate(tomorrow.getDate() + 1) | ||
var origintime = new Date(1970, 1, 1, 0, 0, 0, 0) | ||
if (tomorrow < origintime) | ||
tomorrow = new Date(1970, 1, 1, tomorrow.getUTCHours(), tomorrow.getUTCMinutes(), tomorrow.getUTCSeconds()) | ||
var diffspan = Math.floor((tomorrow.getTime() - origintime.getTime())/ 1000) | ||
var routeid = "" | ||
|
||
const param = { | ||
"addresses": [ | ||
{ | ||
"address" : "151 Arbor Way Milledgeville GA 31061", | ||
"is_depot" : true, | ||
"lat" : 33.132675170898, | ||
"lng" : -83.244743347168, | ||
"time" : 0, | ||
"CustomFields" : {"color": "red" , "size": "huge"} | ||
}, | ||
{ | ||
"address" : "230 Arbor Way Milledgeville GA 31061", | ||
"lat" : 33.129695892334, | ||
"lng" : -83.24577331543, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "148 Bass Rd NE Milledgeville GA 31061", | ||
"lat" : 33.143497, | ||
"lng" : -83.224487, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "117 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.141784667969, | ||
"lng" : -83.237518310547, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "119 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.141086578369, | ||
"lng" : -83.238258361816, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "131 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.142036437988, | ||
"lng" : -83.238845825195, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "138 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.14307, | ||
"lng" : -83.239334, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "139 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.142734527588, | ||
"lng" : -83.237442016602, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "145 Bill Johnson Rd NE Milledgeville GA 31061", | ||
"lat" : 33.143871307373, | ||
"lng" : -83.237342834473, | ||
"time" : 0 | ||
}, | ||
{ | ||
"address" : "221 Blake Cir Milledgeville GA 31061", | ||
"lat" : 33.081462860107, | ||
"lng" : -83.208511352539, | ||
"time" : 0 | ||
} | ||
], | ||
"parameters": { | ||
"algorithm_type": 1, | ||
"route_name": "SD Route 10 Stops Test " + today.toUTCString(), | ||
"route_date": diffspan, | ||
"route_time": 60 * 60 * 7, | ||
"optimize": "Distance", | ||
"distance_unit": "mi", | ||
"device_type": "web" | ||
} | ||
} | ||
|
||
route4me.Routes.routeexamples_optiomization(param, (err, sdroute10stopsresult) => { | ||
debug("error ", err) | ||
debug("result ", sdroute10stopsresult) | ||
expect(err).is.null | ||
expect(sdroute10stopsresult).exist | ||
routeid = sdroute10stopsresult.routes[0].route_id | ||
|
||
const data = { | ||
"activity_type": "user_message", | ||
"activity_message": "Test User Activity " + today.toUTCString(), | ||
"route_id": routeid | ||
} | ||
|
||
route4me.ActivityFeed.logcustomactivity(data, (err, activity_feed) => { | ||
debug("error ", err) | ||
debug("result ", activity_feed) | ||
expect(err).is.null | ||
expect(activity_feed).exist | ||
console.log(activity_feed) | ||
}) | ||
}) | ||
// TODO: remove `done` call from examples | ||
done() | ||
}) | ||
}) |
Oops, something went wrong.