Created
July 15, 2016 23:34
-
-
Save Alexintosh/815f36139324d4b10e4cbe0563add1b6 to your computer and use it in GitHub Desktop.
$openAmat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
'use strict'; | |
angular | |
.module('starter') | |
.factory('$openAmat', openAmat); | |
function openAmat($log, $http, $q){ | |
var service = { | |
nearBy: nearBy, | |
get: get, | |
stops: fetchStops, | |
routes: fetchStops, | |
timeTable: timeTable | |
}; | |
return service; | |
function nearBy(position, _limit){ | |
var limit = _limit || 10; | |
return $http.get("http://www.weathersicily.it/Amat/API/near_stop.php?latitude="+position.lat+"&longitude="+position.lng+"&limit=10"); | |
} | |
function fetchRoutes(){ | |
return $http.get("http://www.weathersicily.it/Amat/API/routes.php"); | |
} | |
function fetchStops(){ | |
return $http.get("http://www.weathersicily.it/Amat/API/stops.php"); | |
} | |
/** | |
* Fetch data table for specific route | |
* @param {route_id} | |
* @param {day_type} [FR|FL] | |
* */ | |
function timeTable(route_id, day_type){ | |
return $http.get("http://www.weathersicily.it/Amat/API/routes_depart.php?routes_id="+route_id+"&day_type="+day_type); | |
} | |
function get(id){ | |
return $http.get("http://www.weathersicily.it/Amat/API/stop_routes.php?stop_id="+id); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment