Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _status(headers) {
headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
tiny.put({
url,
headers,
}, function done(err, response) {
if (err) {
console.log(err)
}
else {
callback(response.body, headers)
}
})
}
)
function pickTheLock(data, headers) {
let locks = Object.keys(data)
// Make sure we never, ever lock or unlock the wrong lock
if (locks.length > 1) {
throw Error('If you own multiple locks, you must specify which lock to lock.')
}
lockID = locks[0]
const url = 'https://api-production.august.com/remoteoperate/' + lockID + '/unlock'
headers['Content-Length'] = 0
tiny.put({
url,
headers,
}, function done(err, response) {
if (err) {
console.log(err)
}
else {
callback(response.body, headers)
}
})
}
)
function _status(headers) {
headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
tiny.put({
url,
headers,
}, function done(err, response) {
if (err) {
console.log(err)
}
else {
callback(response.body, headers)
}
})
}
)
function _status(headers) {
headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
tiny.put({
url,
headers
}, function done(err, response) {
if (err) {
console.log(err)
}
else {
callback(response.body, headers)
}
})
}
)
function pickTheLock(data, headers) {
let locks = Object.keys(data)
// Make sure we never, ever lock or unlock the wrong lock
if (locks.length > 1) {
throw Error('If you own multiple locks, you must specify which lock to lock.')
}
else {
lockID = locks[0]
let statusEndpoint = 'https://api-production.august.com/remoteoperate/' + lockID + '/lock'
headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
tiny.put({
url: statusEndpoint,
headers
}, function done(err, response) {
if (err) {
console.log(err)
}
else {
callback(response.body, headers)
}
})
}
}
)
function pickTheLock(data, headers) {
// TODO maybe enable this method to return status of all locks?
const locks = Object.keys(data)
lockID = locks[0]
const url = 'https://api-production.august.com/remoteoperate/' + lockID + '/status'
headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
tiny.put({
url,
headers,
}, function done(err, response) {
if (err) {
console.log(err)
}
else {
callback(response.body, headers)
}
})
}
)