-
Notifications
You must be signed in to change notification settings - Fork 0
Gas Stations endpoint
Flerex edited this page Jan 25, 2021
·
4 revisions
The GasStations endpoint is accesible through a class that implements the contract StationDetailsBuilder
. An instance of this class is provided by GasApi::gasStations()
.
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. -
from(float $latitude, float $longitude)
: Restricts the results to a given bounding box created from a starting geographical location (from) and an ending geographical location (to). In order for this to work, bothfrom
andto
filters must be used. -
to(float $latitude, float $longitude)
: Restricts the results to a given bounding box created from a starting geographical location (from) and an ending geographical location (to). In order for this to work, bothfrom
andto
filters must be used.
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. -
label
: The name of the gas station. -
price
: Price of the fuel. Only provided when filtering by fuel. -
priceLastUpdatedAt
: Last update of fuel prices. -
owner
: Owner of the gas station. -
address
: Address of the gas station. This object is an instance ofAddress
and provides its own properties likeline
,town
,postalCode
andprovince
. -
salesType
: Sales type of the gas station. Instance ofSalesType
. -
location
: Location of the gas station. See Location utilities to know more about theLocation
object. -
bioethanolPercentage
: The bioethanol percentage. -
bioalcoholPercentage
: The bioalcohol percentage. -
hasCarWash
: Whether the gas station has car washing service. -
hasWaterAir
: Whether the gas station has water and air (tires) supply. -
hasStore
: Whether the gas station has a store. -
hasCoffeeShop
: Whether the gas station has a coffee shop to rest. -
schedule
: The schedule of the coffee shop. Returns a string of the formL: 06:00-22:00
. -
averageRating
: The average rating of the gas station. -
numberRating
: The amount of ratings the gas station has received to compute theaverageRating
.