From a91d7f1e415c1e2267f0c0b2af81ca2aef09ff96 Mon Sep 17 00:00:00 2001 From: David ML Date: Sun, 5 May 2019 19:40:16 +0200 Subject: [PATCH] feat(add instance device to main): add instance device add instance device to main class --- src/sigfox-js.ts | 19 +++---------------- test/__snapshots__/sigfox-js.test.ts.snap | 3 --- 2 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 test/__snapshots__/sigfox-js.test.ts.snap diff --git a/src/sigfox-js.ts b/src/sigfox-js.ts index d0a0672..6176fb7 100644 --- a/src/sigfox-js.ts +++ b/src/sigfox-js.ts @@ -1,8 +1,6 @@ -import axios, { AxiosInstance } from 'axios' - import { ConfigParams } from './types/config-params' -import { Device } from './types/device' import { API_CONFIG } from './config/constants' +import { Devices } from './modules/devices' /** * @class SigfoxApiWrapper @@ -10,29 +8,18 @@ import { API_CONFIG } from './config/constants' */ export default class SigfoxApi { - public rest: AxiosInstance public customParams: object + public devices: Devices /** * @constructor * @param {ConfigParams} customParams ID Client Setup */ constructor(ConfigParams: ConfigParams) { - this.rest = axios.create({ baseURL: API_CONFIG.baseURL }) this.customParams = { auth: ConfigParams, API_CONFIG } - } - - /** - * The endpoint to get Device Info. - * @returns {device} - */ - public getDeviceInfo(deviceId: string) { - return this.rest - .get(API_CONFIG.baseURL + `/devices/${deviceId}`, this.customParams) - .then(response => response.data) - .catch(error => error.response.statusText) + this.devices = new Devices(this.customParams) } } diff --git a/test/__snapshots__/sigfox-js.test.ts.snap b/test/__snapshots__/sigfox-js.test.ts.snap deleted file mode 100644 index 86a779b..0000000 --- a/test/__snapshots__/sigfox-js.test.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`SigfoxApi test getDeviceInfo() call should return device obj 1`] = `""`;