theweatherapi
Advanced tools
Comparing version 2.1.2 to 2.1.3
{ | ||
"name": "theweatherapi", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "An NPM Library used to get weather info", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -52,3 +52,3 @@ const { EventEmitter } = require('events'); | ||
*/ | ||
this.api = RequestHandler; | ||
this.api = new RequestHandler(); | ||
@@ -55,0 +55,0 @@ } |
@@ -12,6 +12,5 @@ const CurrentAPI = require('./api/CurrentAPI'); | ||
* A handler to make correct API calls | ||
* @extends null | ||
*/ | ||
class RequestHandler extends null { | ||
class RequestHandler { | ||
constructor() | ||
/** | ||
@@ -21,3 +20,3 @@ * The Search API | ||
*/ | ||
static search = new SearchAPI(); | ||
search = new SearchAPI(); | ||
@@ -28,3 +27,3 @@ /** | ||
*/ | ||
static forecast = new ForecastAPI(); | ||
forecast = new ForecastAPI(); | ||
@@ -35,3 +34,3 @@ /** | ||
*/ | ||
static current = new CurrentAPI(); | ||
current = new CurrentAPI(); | ||
@@ -42,3 +41,3 @@ /** | ||
*/ | ||
static astronomy = new AstronomyAPI(); | ||
astronomy = new AstronomyAPI(); | ||
@@ -49,3 +48,3 @@ /** | ||
*/ | ||
static sports = new SportsAPI(); | ||
sports = new SportsAPI(); | ||
@@ -56,3 +55,3 @@ /** | ||
*/ | ||
static history = new HistoryAPI(); | ||
history = new HistoryAPI(); | ||
@@ -63,3 +62,3 @@ /** | ||
*/ | ||
static timezone = new TimezoneAPI(); | ||
timezone = new TimezoneAPI(); | ||
@@ -70,3 +69,3 @@ /** | ||
*/ | ||
static ip = new IPAPI(); | ||
ip = new IPAPI(); | ||
@@ -79,3 +78,3 @@ | ||
*/ | ||
static async makeRequest(request) { | ||
async makeRequest(request) { | ||
const axios = require('axios'); | ||
@@ -130,3 +129,3 @@ const Util = require('../Utils/Util'); | ||
*/ | ||
static handleError(error) { | ||
handleError(error) { | ||
const WeatherAPIError = require('./WeatherAPIError'); | ||
@@ -146,3 +145,3 @@ const { TypeError, WeatherError, RangeError } = require('../errors'); | ||
*/ | ||
static createRequestObj(path, method, parameters = [], key) { | ||
createRequestObj(path, method, parameters = [], key) { | ||
return { | ||
@@ -149,0 +148,0 @@ path, |
@@ -76,14 +76,15 @@ import { | ||
export class RequestHandler extends null { | ||
public static forecast: ForecastAPI; | ||
public static current: CurrentAPI; | ||
public static timezone: TimezoneAPI; | ||
public static history: HistoryAPI; | ||
public static astronomy: AstronomyAPI; | ||
public static search: SearchAPI; | ||
public static ip: IPAPI; | ||
public static sports: SportsAPI; | ||
public static makeRequest(request: object): Promise<object> | ||
public static handleError(error: Error): WeatherAPIError | ||
public static createRequestObj(path: string, method: string, parameters: Array<string>, key: apiKey): object | ||
export class RequestHandler { | ||
public constructor(); | ||
public forecast: ForecastAPI; | ||
public current: CurrentAPI; | ||
public timezone: TimezoneAPI; | ||
public history: HistoryAPI; | ||
public astronomy: AstronomyAPI; | ||
public search: SearchAPI; | ||
public ip: IPAPI; | ||
public sports: SportsAPI; | ||
public makeRequest(request: object): Promise<object> | ||
public handleError(error: Error): WeatherAPIError | ||
public createRequestObj(path: string, method: string, parameters: Array<string>, key: apiKey): object | ||
@@ -90,0 +91,0 @@ |
2018
83459