Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding function to get recording link
- Loading branch information
1 parent
7419af2
commit e416746
Showing
5 changed files
with
60 additions
and
19 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
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,16 @@ | ||
{ | ||
"disabled": false, | ||
"bindings": [ | ||
{ | ||
"authLevel": "function", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req" | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
} | ||
] | ||
} |
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,21 @@ | ||
const ring = require('../ring-api').ring_client; | ||
|
||
module.exports = function (context, req) { | ||
context.log('JavaScript HTTP trigger function processed a request.'); | ||
ring.recording(req.body[0]['data']['id_str'], (e, recording) => { | ||
context.log(`got recording link: ${recording}`); | ||
if(recording) { | ||
context.res = { | ||
status: 200, | ||
body: recording | ||
} | ||
} else { | ||
context.res = { | ||
status: 404, | ||
body: null | ||
} | ||
} | ||
context.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
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,9 @@ | ||
const secrets = require('./function-utils').getSecrets(); | ||
const RingAPI = require('doorbot'); | ||
|
||
module.exports.ring_client = RingAPI({ | ||
email: process.env['ring_email'], | ||
password: secrets.ring_password, | ||
retries: 10, //authentication retries, optional, defaults to 0 | ||
}); | ||
|