-
Notifications
You must be signed in to change notification settings - Fork 0
Locate Gas Stations endpoint
Flerex edited this page Jan 25, 2021
·
2 revisions
The LocateGasStations endpoint is accesible through a class that implements the contract StationLocationBuilder
. An instance of this class is provided by GasApi::locateGasStations()
.
This builder class has two type of available methods to use:
- Filtering methods: Provide tools to customize the request, filtering the results according to the specified parameters.
-
get()
: Performs the requests and returns the obtained values. This operation is slow, as it has to perform an HTTP request to provide the results.
-
province(Province $province)
: Shows gas stations for the specified province. Provinces are static methods of the Province enum class. Take a look at that enum to see all available provinces. Take into account that they are methods, not properties! For example, to use the province of Zaragoza you would retrieve it likeProvince::ZARAGOZA()
. -
town(int $town):
Shows gas stations for the specified town. Due to some limitations by the API, the town's ID must be provided. You can find out about a town's ID by using the Towns endpoint. -
fuel(Fuel $fuel)
: Shows gas stations with the provided fuel type. Provinces are static methods of the Fuel enum class. If a fuel filter is provided, its price is also returned. -
serviceType(ServiceType $serviceType)
: Shows gas stations with the provided service type. Service types are static methods of the ServiceType enum class. -
salesType(SalesType $salesType)
: Shows gas stations with the provided sales type. Sales types are static methods of the SalesType enum class.
The returned object once get()
is called is an instance of GasStation
. The available properties are:
-
id
: The internal ID used to identify this gas station. -
price
: Price of the fuel. Only provided when filtering by fuel. -
rank
: The rank of the gas station according too its price. Only provided when filtering by fuel. Rank is an instance of the Rank enum class.