node-clima
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// clientrequest.ts | ||
const node_fetch_1 = __importDefault(require("node-fetch")); | ||
@@ -8,0 +9,0 @@ class ClientRequest { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// clima.ts | ||
function checkOptions(option, type) { | ||
@@ -12,11 +13,8 @@ if (typeof option !== type) { | ||
* @param {String} apiKey - Contains your API KEY | ||
* @param {Object} client - Contains a instance client | ||
* | ||
*/ | ||
class Clima { | ||
constructor(apiKey, client) { | ||
constructor(apiKey) { | ||
this.url = 'http://api.openweathermap.org/data/2.5/weather?'; | ||
checkOptions(apiKey, 'string'); | ||
checkOptions(client, 'object'); | ||
this.client = client; | ||
this.apiKey = apiKey; | ||
@@ -23,0 +21,0 @@ } |
@@ -15,7 +15,10 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// current.ts | ||
const clima_1 = require("./clima"); | ||
const clientrequest_1 = require("./clientrequest"); | ||
const querystring_1 = __importDefault(require("querystring")); | ||
class Current extends clima_1.Clima { | ||
constructor(apiKey, client) { | ||
super(apiKey, client); | ||
constructor(apiKey) { | ||
super(apiKey); | ||
this.client = new clientrequest_1.ClientRequest(); | ||
} | ||
@@ -22,0 +25,0 @@ byCityName(cityName, countryCode = null) { |
"use strict"; | ||
// index.js | ||
const clientrequest = require('../lib/clientrequest'); | ||
// main.ts | ||
const current = require('../lib/current'); | ||
exports.ClientRequest = clientrequest.ClientRequest; | ||
exports.Current = current.Current; |
{ | ||
"name": "node-clima", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "Simple wrapper for OpenWeatherMap API", | ||
@@ -5,0 +5,0 @@ "author": "Roberto Serrano Diaz-Grande", |
@@ -39,8 +39,7 @@ [![Build Status](https://travis-ci.org/rsdiaz/node-clima.svg?branch=master)](https://travis-ci.org/rsdiaz/node-clima) | ||
``` | ||
const Client = require('node-clima').ClientRequest; | ||
const Current = require('node-clima').Current; | ||
var apiKey = 'YOUR API KEY' | ||
var client = new Client(); | ||
var current = new Current(apiKey, client); | ||
var current = new Current(apiKey); | ||
@@ -47,0 +46,0 @@ current.byCityName('Tarragona') |
@@ -0,1 +1,2 @@ | ||
// clientrequest.ts | ||
import fetch from 'node-fetch'; | ||
@@ -2,0 +3,0 @@ |
@@ -0,1 +1,2 @@ | ||
// clima.ts | ||
function checkOptions(option: any, type: string ) { | ||
@@ -11,3 +12,2 @@ if(typeof option !== type) { | ||
* @param {String} apiKey - Contains your API KEY | ||
* @param {Object} client - Contains a instance client | ||
* | ||
@@ -18,9 +18,6 @@ */ | ||
url: string = 'http://api.openweathermap.org/data/2.5/weather?'; | ||
client: any; | ||
apiKey: string; | ||
constructor(apiKey: string, client: object) { | ||
constructor(apiKey: string) { | ||
checkOptions(apiKey, 'string'); | ||
checkOptions(client, 'object'); | ||
this.client = client; | ||
this.apiKey = apiKey; | ||
@@ -27,0 +24,0 @@ } |
@@ -0,2 +1,4 @@ | ||
// current.ts | ||
import { Clima } from './clima'; | ||
import { ClientRequest } from './clientrequest'; | ||
import qs from 'querystring'; | ||
@@ -6,4 +8,7 @@ | ||
constructor(apiKey: string, client: object) { | ||
super(apiKey, client); | ||
client: any; | ||
constructor(apiKey: string) { | ||
super(apiKey); | ||
this.client = new ClientRequest(); | ||
} | ||
@@ -10,0 +15,0 @@ |
@@ -1,5 +0,3 @@ | ||
// index.js | ||
const clientrequest = require('../lib/clientrequest'); | ||
// main.ts | ||
const current = require('../lib/current'); | ||
exports.ClientRequest = clientrequest.ClientRequest; | ||
exports.Current = current.Current; |
@@ -13,7 +13,7 @@ import { ClientRequest } from '../lib/clientrequest'; | ||
test('client no es object, lanzo error', () => { | ||
/* test('client no es object, lanzo error', () => { | ||
expect(() => { | ||
const api = new Clima('string', 'string'); | ||
}).toThrow(Error); | ||
}); | ||
}); */ | ||
}); | ||
@@ -27,6 +27,6 @@ | ||
test('Clima.client es de tipo object', () => { | ||
/* test('Clima.client es de tipo object', () => { | ||
expect(typeof api.client).toBe(typeof {}); | ||
}); | ||
*/ | ||
}); |
@@ -1,7 +0,5 @@ | ||
import { ClientRequest } from '../lib/clientrequest'; | ||
import { Current } from '../lib/current'; | ||
const apiKey = 'YOUR API KEY'; | ||
const client = new ClientRequest(); | ||
const current = new Current(apiKey, client); | ||
const current = new Current(apiKey); | ||
@@ -8,0 +6,0 @@ describe('Incorrect parameters in the methods of the Current class', () => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1055156
981
64