-
Notifications
You must be signed in to change notification settings - Fork 0
Towns endpoint
Flerex edited this page Jan 25, 2021
·
2 revisions
The Towns endpoint is accesible through a class that implements the contract TownBuilder
. An instance of this class is provided by GasApi::towns()
. This endpoint is only used to retrieve the ID of a specific town to be used as filter in other endpoints or to know the name of a town that will be returned as a string in a GasStation
object.
This builder class has two methods to use:
-
province(Province $province)
: The province to return the towns of. -
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.
Note: It is compulsory to call the province(Province $province)
method before get()
.
The returned object once get()
is called is an instance of Town
. The available properties are:
-
id
: The internal ID used to identify this town. This is the value that can be used as a filter in other endpoints. -
name
: The name of the gas station. This is the value that is going to be returned as a string in theGasStation
object.