share2nightscout-bridge 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -53,7 +53,6 @@ var Defaults = {
53
53
  , MIN_PASSPHRASE_LENGTH: 12
54
54
  };
55
55
 
56
- var accountId = null;
57
56
 
58
57
  var DIRECTIONS = {
59
58
  NONE: 0
@@ -95,8 +94,8 @@ function auth_payload (opts) {
95
94
  }
96
95
 
97
96
  function getAccountId(opts, then) {
98
- if( accountId) {
99
- then( null, { statusCode: 200 }, accountId );
97
+ if( opts.accountId ) {
98
+ then( null, { statusCode: 200 }, opts.accountId );
100
99
 
101
100
  } else {
102
101
 
@@ -119,7 +118,7 @@ function login_payload (opts) {
119
118
  var body = {
120
119
  "password": opts.password
121
120
  , "applicationId" : opts.applicationId || Defaults.applicationId
122
- , "accountId": accountId
121
+ , "accountId": opts.accountId
123
122
  };
124
123
  return body;
125
124
  }
@@ -128,8 +127,8 @@ function login_payload (opts) {
128
127
  function authorize (opts, then) {
129
128
  getAccountId(opts, function (err, res, accbody) {
130
129
  if ( !err && accbody && res && res.statusCode == 200 ) {
131
- accountId = accbody;
132
- console.log("accountId: " + accountId);
130
+ opts.accountId = accbody;
131
+ console.log("accountId: " + opts.accountId);
133
132
 
134
133
  var url = opts.login || Defaults.login;
135
134
  var body = login_payload(opts);
@@ -390,7 +389,7 @@ if (!module.parent) {
390
389
  ns_config.entries = entries;
391
390
  // Send data to Nightscout.
392
391
  report_to_nightscout(ns_config, function (err, response, body) {
393
- console.log("Nightscout upload", 'error', err, 'status', response.statusCode, body);
392
+ console.log("Nightscout upload", 'error', err, 'response', response, body);
394
393
 
395
394
  });
396
395
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "share2nightscout-bridge",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "share2nightscout-bridge",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Fetches data from Dexcom's webservice and puts it in Nightscout.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wercker.yml CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- box: wercker/ubuntu12.04-nodejs0.10
2
+ box: node:current
3
3
  build:
4
4
  steps:
5
5
  - script: