 
 struct API {
     static func getCurrentWeatherForLocation(_ location: CGPoint) {
-       Alamofire.request(OpenWeatherRouter.getCurrentWeatherForLocation(location)).responseJSON { response in
+       Alamofire.request(WeatherUndergroundRouter.getCurrentWeatherForLocation(location)).responseJSON { response in
             if let JSON = response.result.value {
                 print("JSON: \(JSON)")
             }

    }
}

enum OpenWeatherRouter: URLRequestConvertible {
    case getCurrentWeatherForLocation(CGPoint)
    
    private static let baseURLString = "http://api.openweathermap.org/data/2.5/"
    private static let APPID = "&APPID=b22cafbf884cf6f6ff7f56cbe1f4c20a"
    
    
    var method: HTTPMethod {

    var path: String {
        switch self {
        case .getCurrentWeatherForLocation(_):
            return "conditions" //"current_observation" -> temp_f
        case .getYesterdaysWeatherForLocation(_):
            return "yesterday"
        }
    }
    
    func asURLRequest() throws -> URLRequest {
        
        //http://api.wunderground.com/api/9caa09c5d1399971/conditions/q/40.712784,-74.005941.json
        let url = try WeatherUndergroundRouter.baseURLString.asURL()
        let urlWithPath = url.appendingPathComponent(path)
        let urlWithQ = urlWithPath.appendingPathComponent("q")
        var finalURL: URL? = nil
        
        switch self {
        case let .getYesterdaysWeatherForLocation(location):
            finalURL = urlWithQ.appendingPathComponent("\(location.x),\(location.y).json")
        case let .getCurrentWeatherForLocation(location):
            finalURL = urlWithQ.appendingPathComponent("\(location.x),\(location.y).json")
        }
        
        var urlRequest = URLRequest(url: finalURL!)
        urlRequest.httpMethod = method.rawValue
        
        
        print("url: \(urlRequest.url?.absoluteString)")
//        urlRequest = try URLEncoding.default.encode(urlRequest, with: params)
        return urlRequest
    }
}
