infogare-api.js
Advanced tools
Comparing version 1.0.10 to 1.0.11
{ | ||
"name": "infogare-api.js", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"main": "src/core/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -1,3 +0,10 @@ | ||
import App from "../modules/App"; | ||
import Station from '../modules/Station'; | ||
import User from '../modules/User'; | ||
export declare function initApp(appId: string): App; | ||
export declare function getUser(uid: String): User; | ||
export declare function getUserFolders(uid: String): String[]; | ||
export declare function getPublicProfile(uid: String): JSON; | ||
export declare function getStation(uid: String, stationId: String): Station; |
const User = require('./User'); | ||
const Station = require('./Station'); | ||
const Train = require('./Train'); | ||
const { Train, TrainRER } = require('./Train'); | ||
const { UserException, StationException } = require('./Exceptions'); | ||
@@ -289,4 +289,10 @@ | ||
const trains = []; | ||
for (const trainJSON of trainsJSON) { | ||
trains.push(new Train(trainJSON)); | ||
if (!trainsJSON[0].mission) { | ||
for (const trainJSON of trainsJSON) { | ||
trains.push(new Train(trainJSON)); | ||
} | ||
} else { | ||
for (const trainJSON of trainsJSON) { | ||
trains.push(new TrainRER(trainJSON)); | ||
} | ||
} | ||
@@ -293,0 +299,0 @@ return trains; |
@@ -106,2 +106,86 @@ class Train { | ||
module.exports = Train; | ||
class TrainRER { | ||
constructor(data) { | ||
this.id = data.id; | ||
this.arivalTime = data.arivalTime; | ||
this.delayTime = data.delayTime; | ||
this.delayType = data.delayType; | ||
this.departureTime = data.departureTime; | ||
this.departureMode = data.departureMode; | ||
this.destination = data.destination; | ||
this.from = data.from; | ||
this.mission = data.mission; | ||
this.number = data.number; | ||
this.provenance = data.provenance; | ||
this.show = data.show; | ||
this.to = data.to; | ||
this.trainLength = data.trainLength; | ||
this.type = data.type; | ||
} | ||
getId() { | ||
return this.id; | ||
} | ||
getArivalTime() { | ||
return this.arivalTime; | ||
} | ||
getCompo() { | ||
return this.compo; | ||
} | ||
getDays() { | ||
return this.days; | ||
} | ||
getDelayTime() { | ||
return this.delayTime; | ||
} | ||
getDelayType() { | ||
return this.delayType; | ||
} | ||
getDepartureTime() { | ||
return this.departureTime; | ||
} | ||
getDepartureMode() { | ||
return this.departureMode; | ||
} | ||
getDestination() { | ||
return this.destination; | ||
} | ||
getFrom() { | ||
return this.from; | ||
} | ||
getMission() { | ||
return this.mission; | ||
} | ||
getNumber() { | ||
return this.number; | ||
} | ||
getProvenance() { | ||
return this.provenance; | ||
} | ||
getTo() { | ||
return this.to; | ||
} | ||
getTrainLength() { | ||
return this.trainLength; | ||
} | ||
getType() { | ||
return this.type; | ||
} | ||
} | ||
module.exports = { Train, TrainRER }; |
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
21921
716