From b86bfcf6322b4cfc9474cb997fa53ebae00a5f97 Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Fri, 19 Jul 2019 15:20:03 +0100 Subject: [PATCH 1/3] Adding optional limit to history call --- get-history-list.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/get-history-list.js b/get-history-list.js index b44a9d7..1dc8bd5 100644 --- a/get-history-list.js +++ b/get-history-list.js @@ -21,7 +21,7 @@ module.exports = bottle => bottle.service( 'getHistoryList', getHistoryList, 'restClient', 'apiUrls' ) -function getHistoryList( restClient, apiUrls ) { +function getHistoryList( restClient, apiUrls, limit ) { class HistoryItem { @@ -46,10 +46,11 @@ function getHistoryList( restClient, apiUrls ) { return `[${this.kind} ${emojis[ this.kind ] || ''} at "${this.doorbot.description}" ${this.created_at}]` } } + console.log(arguments) - return async() => { + return async(limit) => { const historyListUrl = apiUrls.doorbots().history() - const historyItems = await restClient.authenticatedRequest( 'GET', historyListUrl ) + const historyItems = await restClient.authenticatedRequest( 'GET', `${historyListUrl}?limit=${limit || 20}` ) return historyItems.map( h => new HistoryItem( h )) } From c6a28d3a855daa72f172dab1c14850484b0ab702 Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Fri, 19 Jul 2019 15:20:46 +0100 Subject: [PATCH 2/3] Bumping version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3d007d1..8c16448 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ring-api", - "version": "3.0.7", + "version": "3.0.8", "description": "Unofficial API for ring doorbells and other devices", "main": "main.js", "dependencies": { From 85f9cd9342595fe6bd6157488ed645f6dec7137e Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Fri, 19 Jul 2019 15:21:27 +0100 Subject: [PATCH 3/3] Tidying up --- get-history-list.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/get-history-list.js b/get-history-list.js index 1dc8bd5..74d2124 100644 --- a/get-history-list.js +++ b/get-history-list.js @@ -46,9 +46,8 @@ function getHistoryList( restClient, apiUrls, limit ) { return `[${this.kind} ${emojis[ this.kind ] || ''} at "${this.doorbot.description}" ${this.created_at}]` } } - console.log(arguments) - return async(limit) => { + return async( limit ) => { const historyListUrl = apiUrls.doorbots().history() const historyItems = await restClient.authenticatedRequest( 'GET', `${historyListUrl}?limit=${limit || 20}` )