Class: TflApi::Client::Mode

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

Overview

This class communicates with the TFL “/Journey” API to obtain details about taxis and minicabs contact information.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Mode

Initialize the Mode object and store the reference to Client object

Parameters:

  • client (Client)

    the client object



39
40
41
# File 'lib/tfl_api_client/mode.rb', line 39

def initialize(client)
  @client = client
end

Instance Method Details

#active_service_typesArray

Returns the service type active for a mode.

Returns:

  • (Array)

    An array of service types that are active for a mode



47
48
49
# File 'lib/tfl_api_client/mode.rb', line 47

def active_service_types
  @client.get('/Mode/ActiveServiceTypes')
end

#next_arrival(mode, count = -1)) ⇒ Array

Returns the next arrival predictions for all stops of a given mode

Parameters:

  • mode (String)

    A mode name e.g. tube, dlr

  • count (Integer) (defaults to: -1))

    Number of arrivals to return for each stop

Returns:

  • (Array)

    An array of arrival predictions for all stops of a given mode



58
59
60
# File 'lib/tfl_api_client/mode.rb', line 58

def next_arrival(mode, count = -1)
  @client.get("/Mode/#{mode}/Arrivals", { count: count })
end