ptv v0.1.0 PTV View Source
API adaptor for the PTV Timetable API
Link to this section Summary
Link to this section Functions
Link to this function
execute_call(call, devid, api_key) View Source
Executes HTTP request to API for an API call.
Returns {:ok, response_map}
on successful response.
Returns {:error, {:reason_atom, message_string}}
on erronous response where :reason_atom is one of the following:
- :invalid_request
- :access_denied
- :connection_failed
- :decode_failed
Examples
iex> PTV.execute_call(%PTV.Call{
...> api_name: "stops",
...> search_string: "10/route_type/3",
...> params: %{stop_amenities: true}
...> },
...> "1234567",
...> "12345678901234567890"
...> )
{:ok, %{"stop" => %{}, "stop" => %{}""status" => %{}}}
Link to this function
signed_call_url(map, devid, api_key) View Source
Generates signed url for an API call.
Builds request url and calculates hashmac digest for authentication according to instructions at https://www.ptv.vic.gov.au/footer/data-and-reporting/datasets/ptv-timetable-api/.