Class: TflApi::Client::Cycle

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

Overview

This class communicates with the TFL “/CycleSuperhighway” API to obtain details about the cycle superhighways based upon their IDs.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Cycle

Initialize the Cycle object and store the reference to Client object

Parameters:

  • client (Client)

    the client object



40
41
42
# File 'lib/tfl_api_client/cycle.rb', line 40

def initialize(client)
  @client = client
end

Instance Method Details

#superhighway(id) ⇒ hash

Returns the all details known by the TFL service for the given Cycle Superhighway id.

Parameters:

  • id (String)

    the TFL Cycle Superhighway id

Returns:

  • (hash)

    A hash containing the details of the given Cycle Superhighway



60
61
62
# File 'lib/tfl_api_client/cycle.rb', line 60

def superhighway(id)
  @client.get("/CycleSuperhighway/#{id}")
end

#superhighwaysArray

Returns all Cycle Superhighway locations known by the TFL service

Returns:

  • (Array)

    An array of hashes containing all Cycle Superhighways and their details



49
50
51
# File 'lib/tfl_api_client/cycle.rb', line 49

def superhighways
  @client.get('/CycleSuperhighway')
end