Class: TflApi::Client::AccidentStats

Inherits:
Object
  • Object
show all
Defined in:
lib/tfl_api_client/accident_stats.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ AccidentStats

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

Parameters:

  • client (Client)

    the client object



41
42
43
# File 'lib/tfl_api_client/accident_stats.rb', line 41

def initialize(client)
  @client = client
end

Instance Method Details

#details(year) ⇒ Array

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

Returns:

  • (Array)

    An array of hashes containing all Accident Statistics



50
51
52
# File 'lib/tfl_api_client/accident_stats.rb', line 50

def details(year)
  @client.get("/AccidentStats/#{year}")
end