From 05abb58875930c00dcb883f297f72c35b2906f67 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Sat, 20 Aug 2016 14:04:03 -0500 Subject: [PATCH 1/6] Fixed README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5d2e430..54edd20 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ npm install --save node-holidayapi ## Usage ```javascript -var hapi = require('node-holidayapi'); -var Hapi = new HolidayAPI('_YOUR_API_KEY').v1; +var HolidayAPI = require('node-holidayapi'); +var hapi = new HolidayAPI('_YOUR_API_KEY').v1; var parameters = { // Required @@ -26,7 +26,7 @@ var parameters = { // pretty: true, }; -var Hapi.holidays(parameters, function (err, data) { +var hapi.holidays(parameters, function (err, data) { // Insert awesome code here... }); ``` From 8288d8f2463ac2647c79d032b1cf1787c7e6309b Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Sat, 20 Aug 2016 14:04:28 -0500 Subject: [PATCH 2/6] Bumped version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b2a354..6cd386b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-holidayapi", - "version": "1.0.0", + "version": "1.0.1", "description": "Official Node.js library for Holiday API", "main": "index.js", "scripts": { From 5bf4a64d5999a903ffdbbd95aa831e3db59ef838 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Tue, 30 Aug 2016 23:55:58 -0500 Subject: [PATCH 3/6] Fixed up README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 54edd20..090ed5c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ npm install --save node-holidayapi ```javascript var HolidayAPI = require('node-holidayapi'); -var hapi = new HolidayAPI('_YOUR_API_KEY').v1; +var hapi = new HolidayAPI('_YOUR_API_KEY_').v1; var parameters = { // Required @@ -20,13 +20,13 @@ var parameters = { // Optional // month: 7, // day: 4, - // previous true, - // upcoming true, + // previous: true, + // upcoming: true, // public: true, // pretty: true, }; -var hapi.holidays(parameters, function (err, data) { +hapi.holidays(parameters, function (err, data) { // Insert awesome code here... }); ``` From e4b27db043e4f04019cda1c80bfcbad2d2034b35 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Tue, 30 Aug 2016 23:56:39 -0500 Subject: [PATCH 4/6] Bumped version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6cd386b..b398977 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-holidayapi", - "version": "1.0.1", + "version": "1.0.2", "description": "Official Node.js library for Holiday API", "main": "index.js", "scripts": { From b6ad36a075238ff4aec0f727ac2d0d9b9d796980 Mon Sep 17 00:00:00 2001 From: Yaw Etse Date: Sat, 23 Jun 2018 17:49:02 -0400 Subject: [PATCH 5/6] allow for the key to be passed as a parameter this will also use the property `key` on the prototype if it's defined. --- index.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 12c43a2..819cc92 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ 'use strict'; -var https = require('https'); +const https = require('https'); +const qs = require('querystring'); var HolidayAPI = function (key) { if ('undefined' !== typeof key) { @@ -11,16 +12,13 @@ var HolidayAPI = function (key) { HolidayAPI.prototype.v1 = {}; HolidayAPI.prototype.v1.holidays = function (parameters, callback) { - var url = 'https://holidayapi.com/v1/holidays'; - var querystring = '?key=' + HolidayAPI.prototype.key; - - if ('object' === typeof parameters) { - for (var parameter in parameters) { - querystring += '&' + parameter + '=' + parameters[parameter]; - } - } - - url += querystring; + const querystringObject = Object.assign( + {}, + {key: HolidayAPI.prototype.key}, + parameters, + ) + const querystring = qs.stringify(querystringObject); + const url = `https://holidayapi.com/v1/holidays?${querystring}`; https.get(url, function (res) { res.on('data', function (data) { From 2cade7ce077b59eae9682c9ab71eaf64c413985a Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Tue, 10 Sep 2019 10:09:50 -0500 Subject: [PATCH 6/6] Added deprecation notices. --- README.md | 9 +++++++++ package.json | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 090ed5c..c83e7ca 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,13 @@ +# This repository has moved to [https://github.com/holidayapi/node-holidayapi](https://github.com/holidayapi/node-holidayapi) + +**The NPM package has also been renamed from `node-holidayapi` to simply `holidayapi`** + +**This repository has been archived.** + +--- + # node-holidayapi + Official Node.js library for [Holiday API](https://holidayapi.com) ## Installation diff --git a/package.json b/package.json index b398977..0414a5c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "node-holidayapi", - "version": "1.0.2", - "description": "Official Node.js library for Holiday API", + "version": "1.0.3", + "description": "DEPRECATED -- Official Node.js library for Holiday API", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"