class TflApi::Client::Mode

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

Public Class Methods

new(client) click to toggle source

Initialize the Mode object and store the reference to Client object

@param client [Client] the client object

@return [Mode] the Mode object

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

Public Instance Methods

active_service_types() click to toggle source

Returns the service type active for a mode.

@return [Array] An array of service types that are active for a mode

# File lib/tfl_api_client/mode.rb, line 47
def active_service_types
  @client.get('/Mode/ActiveServiceTypes')
end
next_arrival(mode, count = -1) click to toggle source

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

@param mode [String] A mode name e.g. tube, dlr @param count [Integer] Number of arrivals to return for each stop

@return [Array] An array of arrival predictions for all stops of a given mode

# File lib/tfl_api_client/mode.rb, line 58
def next_arrival(mode, count = -1)
  @client.get("/Mode/#{mode}/Arrivals", { count: count })
end