Small method rename

This commit is contained in:
Andrew Stewart 2013-10-31 13:51:53 -07:00
parent 54e5226dd6
commit fbadbac5c6
2 changed files with 8 additions and 8 deletions

8
dist/api/api.js vendored
View File

@ -36,8 +36,8 @@
this.io = socketio.listen(this.server); this.io = socketio.listen(this.server);
this.server.get("/robots", this.getRobots); this.server.get("/robots", this.getRobots);
this.server.get("/robots/:robotid", this.getRobotByName); this.server.get("/robots/:robotid", this.getRobotByName);
this.server.get("/robots/:robotid/devices", this.getRobotDevices); this.server.get("/robots/:robotid/devices", this.getDevices);
this.server.get("/robots/:robotid/devices/:deviceid", this.getRobotDeviceByName); this.server.get("/robots/:robotid/devices/:deviceid", this.getDeviceByName);
this.server.listen(this.port, this.host, function() { this.server.listen(this.port, this.host, function() {
return Logger.info("" + _this.server.name + " is listening at " + _this.server.url); return Logger.info("" + _this.server.name + " is listening at " + _this.server.url);
}); });
@ -63,13 +63,13 @@
}); });
}; };
Server.prototype.getRobotDevices = function(req, res, next) { Server.prototype.getDevices = function(req, res, next) {
return master.findRobot(req.params.robotid, function(err, robot) { return master.findRobot(req.params.robotid, function(err, robot) {
return res.send(err ? err : robot.data().devices); return res.send(err ? err : robot.data().devices);
}); });
}; };
Server.prototype.getRobotDeviceByName = function(req, res, next) { Server.prototype.getDeviceByName = function(req, res, next) {
var deviceid, robotid; var deviceid, robotid;
robotid = req.params.robotid; robotid = req.params.robotid;
deviceid = req.params.deviceid; deviceid = req.params.deviceid;

View File

@ -27,8 +27,8 @@ namespace "Api", ->
@server.get "/robots", @getRobots @server.get "/robots", @getRobots
@server.get "/robots/:robotid", @getRobotByName @server.get "/robots/:robotid", @getRobotByName
@server.get "/robots/:robotid/devices", @getRobotDevices @server.get "/robots/:robotid/devices", @getDevices
@server.get "/robots/:robotid/devices/:deviceid", @getRobotDeviceByName @server.get "/robots/:robotid/devices/:deviceid", @getDeviceByName
@server.listen @port, @host, => @server.listen @port, @host, =>
Logger.info "#{@server.name} is listening at #{@server.url}" Logger.info "#{@server.name} is listening at #{@server.url}"
@ -40,11 +40,11 @@ namespace "Api", ->
master.findRobot req.params.robotid, (err, robot) -> master.findRobot req.params.robotid, (err, robot) ->
res.send if err then err else robot.data() res.send if err then err else robot.data()
getRobotDevices: (req, res, next) -> getDevices: (req, res, next) ->
master.findRobot req.params.robotid, (err, robot) -> master.findRobot req.params.robotid, (err, robot) ->
res.send if err then err else robot.data().devices res.send if err then err else robot.data().devices
getRobotDeviceByName: (req, res, next) -> getDeviceByName: (req, res, next) ->
robotid = req.params.robotid robotid = req.params.robotid
deviceid = req.params.deviceid deviceid = req.params.deviceid