google-flights-wrapper1
Advanced tools
Comparing version 1.0.7 to 1.0.8
39
index.js
@@ -24,2 +24,4 @@ module.exports = function(apikey){ | ||
var flightNumber; | ||
var origin; | ||
var destination; | ||
@@ -31,2 +33,5 @@ if(body.error) return console.error(body.error); | ||
if(body.trips.data.carrier[j].code==body.trips.tripOption[i].slice[0].segment[k].flight.carrier){ | ||
if(airline!=""){ | ||
airline = airline + "Connecting Airline: "+body.trips.data.carrier[j].name | ||
} | ||
airline = body.trips.data.carrier[j].name; | ||
@@ -36,9 +41,31 @@ break; | ||
} | ||
flightNumber = body.trips.tripOption[i].slice[0].segment[k].flight.number; | ||
price = body.trips.tripOption[i].saleTotal; | ||
arrivalTime = body.trips.tripOption[i].slice[0].segment[k].leg[body.trips.tripOption[i].slice[0].segment[k].leg.length-1].arrivalTime; | ||
departureTime = body.trips.tripOption[i].slice[0].segment[k].leg[0].departureTime; | ||
jsonObject = {"airline": airline , "price": price, "departureTime:":departureTime, "arrivalTime:":arrivalTime, "flightNumber:":flightNumber}; | ||
info.push(jsonObject); | ||
if(origin != ""){ | ||
origin = origin + "Connecting Origin: "+ body.trips.tripOption[i].slice[0].segment[k].leg[0].origin; | ||
}else{ | ||
origin = body.trips.tripOption[i].slice[0].segment[k].leg[0].origin; | ||
} | ||
if(destination != ""){ | ||
destination = destination + "Connecting Destination: "+ body.trips.tripOption[i].slice[0].segment[k].leg[0].destination; | ||
}else{ | ||
destination = body.trips.tripOption[i].slice[0].segment[k].leg[0].destination; | ||
} | ||
if(flightNumber != ""){ | ||
flightNumber = flightNumber + "Connecting Flight Number: "+body.trips.tripOption[i].slice[0].segment[k].flight.number; | ||
}else{ | ||
flightNumber = body.trips.tripOption[i].slice[0].segment[k].flight.number; | ||
} | ||
price = body.trips.tripOption[i].saleTotal; | ||
if(arrivalTime != ""){ | ||
arrivalTime = arrivalTime + "Connecting Flight Arrival Time: " + body.trips.tripOption[i].slice[0].segment[k].leg[body.trips.tripOption[i].slice[0].segment[k].leg.length-1].arrivalTime; | ||
}else{ | ||
arrivalTime = body.trips.tripOption[i].slice[0].segment[k].leg[body.trips.tripOption[i].slice[0].segment[k].leg.length-1].arrivalTime; | ||
} | ||
if(departureTime != ""){ | ||
departureTime = departureTime + "Connecting Flight Departure Time: " + body.trips.tripOption[i].slice[0].segment[k].leg[0].departureTime; | ||
}else{ | ||
departureTime = body.trips.tripOption[i].slice[0].segment[k].leg[0].departureTime; | ||
} | ||
jsonObject = {"airline": airline , "price": price, "departureTime:":departureTime, "arrivalTime:":arrivalTime, "flightNumber:":flightNumber, "Origin: ": origin, "Destination: ":destination}; | ||
} | ||
info.push(jsonObject); | ||
} | ||
@@ -45,0 +72,0 @@ fn(info); |
{ | ||
"name": "google-flights-wrapper1", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A simple wrapper for the Google Flights API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
5417
85