 
     static func coordinatesForStop(stop: Stop, callback: (lat: Double, lon: Double) -> Void) -> Void {
         let query = "{stop(id: \"HSL:\(stop.codeLong)\" ) {lat, lon}}"
-        HTTP.post(url, body: query, callback: {(obj: [String: AnyObject], error: String?) in
+        HTTP.post(APIURL, body: query, callback: {(obj: [String: AnyObject], error: String?) in
             if let data = obj["data"] as? [String: AnyObject],
                 let stop = data["stop"] as? [String: AnyObject],
                 let lat = stop["lat"] as? Double,


public class HSL {

    static let url = "https://api.digitransit.fi/routing/v1/routers/hsl/index/graphql"

    static func departuresForStop(gtfsId: String, callback: (departures: [Departure]) -> Void) -> Void {
        let query = "{stop(id: \"\(gtfsId)\" ) {" +
            "gtfsId, lat, lon, code, platformCode, desc, name," +
            "stoptimesWithoutPatterns(numberOfDepartures: 30) {" +
                "scheduledDeparture," +
                "realtimeDeparture," +
                "departureDelay," +
                "realtime," +
                "realtimeState," +
                "serviceDay," +
                "pickupType," +
                "trip {" +
                    "tripHeadsign," +
                    "directionId," +
                    "route {" +
                        "shortName," +
                        "longName," +
                        "mode" +
                    "}}}}}"
        HTTP.post(url, body: query, callback: {(obj: [String: AnyObject], error: String?) in
            if let data = obj["data"] as? [String: AnyObject],
                let stop = data["stop"] as? [String: AnyObject],
                let nextDeparturesData = stop["stoptimesWithoutPatterns"] as? NSArray {


    static func nearestStops(lat: Double, lon: Double, callback: (stops: [Stop]) -> Void) {
        let query = "{stopsByRadius(lat:\(String(lat)), lon: \(String(lon)), agency: \"HSL\", radius: 500)" +
            "{edges {node {distance, stop { \(stopFields) }}}}}"
        HTTP.post(APIURL, body: query, callback: {(obj: [String: AnyObject], error: String?) in
            var stops: [Stop?] = []
            if let data = obj["data"] as? [String: AnyObject],
                let stopsByRadius = data["stopsByRadius"] as? [String: AnyObject],
