class TflApi::Client::AccidentStats

This class communicates with the TFL “/AccidentStats” API to obtain details about Accident Statistics based upon the year the accident occurred.

Public Class Methods

new(client) click to toggle source

Initialize the AccidentStats object and store the reference to Client object.

@param client [Client] the client object

@return [AccidentStats] the AccidentStats object

# File lib/tfl_api_client/accident_stats.rb, line 41
def initialize(client)
  @client = client
end

Public Instance Methods

details(year) click to toggle source

Returns all accident details for accidents occurring in the specified year.

@return [Array] An array of hashes containing all Accident Statistics

# File lib/tfl_api_client/accident_stats.rb, line 50
def details(year)
  @client.get("/AccidentStats/#{year}")
end