Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-clima

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-clima - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

23

lib/node-clima.js

@@ -11,3 +11,3 @@ var request = require('request');

.format required The format for the response [json, xml]
.apikey optional The api key for the service
.apikey required The api key for the service
.units optional The metrics units for the response [Fahrenheit, Celsius, Kelvin] - default: Kelvin

@@ -68,3 +68,3 @@ .language optional The language for the response

clima.prototype.language = 'en';
// required
clima.prototype.apikey = '';

@@ -77,4 +77,17 @@ clima.prototype.format = '';

// cityName is required, checking
if (!this.validate(obj, 'byCityName')) return false;
obj.qs = { 'q': obj.cityName };
// countryCode is optional
// if exist and is string, add to query
if (obj.countryCode && typeof obj.countryCode === 'string') {
console.log("countryCode it's... " + obj.countryCode);
var str = obj.cityName + ',' + obj.countryCode;
console.log(str);
obj.qs = { 'q': str};
}
else {
obj.qs = { 'q': obj.cityName };
}
this.makeRequest(obj);

@@ -146,3 +159,2 @@ }

obj.qs['lang'] = this.language;
request({

@@ -153,2 +165,3 @@ method: 'GET',

}, function(err, response, body){
// console.log(response.statusMessage);
if (err) {

@@ -158,3 +171,3 @@ callback(err, body);

if ((response.statusCode === 200) || (response.statusCode === 304)) {
console.log(body);
// console.log(body);
callback(err, body);

@@ -161,0 +174,0 @@ }

{
"name": "node-clima",
"version": "0.0.7",
"version": "0.0.8",
"description": "Simple wrapper for OpenWeatherMap API",

@@ -5,0 +5,0 @@ "author": "Roberto Serrano Diaz-Grande",

@@ -8,3 +8,3 @@ [![Build Status](https://travis-ci.org/robfree/node-clima.svg?branch=master)](https://travis-ci.org/robfree/node-clima)

**currentByCityName**
You can call by city name or city name and country code. API responds with a list of results that match a searching word.
**currentByCityId**

@@ -20,11 +20,12 @@

var clima = require('node-clima');
var clima = require('node-clima');
var c = new clima({
format: 'json', // required
units: 'Celsius' // optional
});
var c = new clima({
format: 'json', // required
apikey: 'your api key' // REQUIRED
units: 'Celsius' // optional
});
c.currentByCityName({
cityName: 'London'
cityName: 'London',
callback: function(err, data) {

@@ -31,0 +32,0 @@ console.log(data);

@@ -6,3 +6,4 @@ var clima = require('../lib/node-clima.js');

format: 'json',
units: 'Celsius'
units: 'Celsius',
apikey: '2345164273a393437e74235c3827044c'
});

@@ -9,0 +10,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc