var request = require('request');

var OpenWeatherMap = {

  apikey: sails.config.rpiApp.openWeatherMap.apikey,
  city: sails.config.rpiApp.openWeatherMap.city,
  unit: sails.config.rpiApp.openWeatherMap.unit,

  getInfo: function (cb) {
    request.get(
      {
        url: 'http://api.openweathermap.org/data/2.5/weather?q=' + this.city + '&units=' + this.unit + '&APPID=' + this.apikey,
      }, function (err, httpResponse, body) {
        if (err) {
          cb({err: err, httpResponse: httpResponse, data: false});
        } else {
          var response = JSON.parse(body);
          cb({err: false, httpResponse: httpResponse, data: response});
        }
      });
  }
};

module.exports = OpenWeatherMap;

@@ -213,115 +213,1081 @@
  get
-Info: function (cb) %7B%0A    request.get(%0A      %7B%0A        url: 'http://api.openweathermap.org/data/2.5/weather
+Current: function (cb) %7B%0A    request.get(%0A      %7B%0A        url: 'http://api.openweathermap.org/data/2.5/weather?q=' + this.city + '&units=' + this.unit + '&APPID=' + this.apikey,%0A      %7D, function (err, httpResponse, body) %7B%0A        if (err) %7B%0A          cb(%7Berr: err, httpResponse: httpResponse, data: false%7D);%0A        %7D else %7B%0A          var response = JSON.parse(body);%0A          cb(%7Berr: false, httpResponse: httpResponse, data: response%7D);%0A        %7D%0A      %7D);%0A  %7D,%0A%0A  getRecentForecast: function (cb) %7B%0A    request.get(%0A      %7B%0A        url: 'http://api.openweathermap.org/data/2.5/forecast?q=' + this.city + '&units=' + this.unit + '&APPID=' + this.apikey,%0A      %7D, function (err, httpResponse, body) %7B%0A        if (err) %7B%0A          cb(%7Berr: err, httpResponse: httpResponse, data: false%7D);%0A        %7D else %7B%0A          var response = JSON.parse(body);%0A          cb(%7Berr: false, httpResponse: httpResponse, data: response%7D);%0A        %7D%0A      %7D);%0A  %7D,%0A%0A  getAdvancedForecast: function (cb) %7B%0A    request.get(%0A      %7B%0A        url: 'api.openweathermap.org/data/2.5/forecast/daily
 ?q='
@@ -1295,32 +1295,39 @@
 + this.city + '&
+cnt=16&
 units=' + this.u

Update OpenWeatherMap Service