lambda/src/index.js
/** Handles up, down, & absolute volume for either an individual room or an entire group */
Handles up, down, & absolute volume for either an individual room or an entire group
Handles up down & absolute volume for either an individual room or an entire group
function volumeHandler(roomValue, response, volume) {
    var roomAndGroup = parseRoomAndGroup(roomValue);
    if (!roomAndGroup.room) {
        response.tell("Please specify a room. For example, turn the volume down in the KITCHEN");
        return;
    }
    if (!roomAndGroup.group) {
        options.path = '/' + encodeURIComponent(roomAndGroup.room) + '/volume/' + volume;
        httpreq(options, function(error) {
            genericResponse(error, response);
        });
    }
    else {
        actOnCoordinator(options, '/groupVolume/' + volume, roomAndGroup.room,  function (error, responseBodyJson) {
            genericResponse(error, response);
        });
    }
}
function volumeHandler ( roomValue , response , volume ) { var roomAndGroup = parseRoomAndGroup ( roomValue ) ; if ( ! roomAndGroup . room ) { response . tell ( "Please specify a room. For example, turn the volume down in the KITCHEN" ) ; return ; } if ( ! roomAndGroup . group ) { options . path = '/' + encodeURIComponent ( roomAndGroup . room ) + '/volume/' + volume ; httpreq ( options , function ( error ) { genericResponse ( error , response ) ; } ) ; } else { actOnCoordinator ( options , '/groupVolume/' + volume , roomAndGroup . room , function ( error , responseBodyJson ) { genericResponse ( error , response ) ; } ) ; } }
Handles up, down, & absolute volume for either an individual room or an entire group
Handles up down & absolute volume for either an individual room or an entire group