Module: Inthegra::Client::BusStops

Included in:
Inthegra::Client
Defined in:
lib/inthegra/client/bus_stops.rb

Overview

Define methods related to bus_stops

Instance Method Summary collapse

Instance Method Details

#bus_stopsArray::BusStop

Return a list of all bus_stops

Examples:

Return all bus stops

Inthegra.bus_stops

Returns:

  • (Array::BusStop)

    All bus stops

See Also:



13
14
15
16
17
# File 'lib/inthegra/client/bus_stops.rb', line 13

def bus_stops
  response = get('paradas')

  CollectionSerializer.parse(response, BusStop)
end

#bus_stops_by_line(line_code) ⇒ Array::BusStop

Return all bus stops of the line code passed

Examples:

Return a list of all bus stops by the line code passed

Inthegra.line_search('0401')

Parameters:

  • line_code (String)

    An line code

Returns:

  • (Array::BusStop)

    All bus stops in the line

See Also:



41
42
43
44
45
# File 'lib/inthegra/client/bus_stops.rb', line 41

def (line_code)
  response = get('paradasLinha', { busca: URI::encode(line_code) })

  CollectionSerializer.parse(response['Paradas'], BusStop)
end

#bus_stops_search(query) ⇒ Array::BusStop

Return a list of all searched bus stops

Examples:

Return a list of all bus stops localized in ‘ininga’ neighborhood

Inthegra.bus_stops_search('ininga')

Parameters:

  • query (String)

    An search query

Returns:

  • (Array::BusStop)

    All bus stops returned by search

See Also:



27
28
29
30
31
# File 'lib/inthegra/client/bus_stops.rb', line 27

def bus_stops_search(query)
  response = get('paradas', { busca: URI::encode(query) })

  CollectionSerializer.parse(response, BusStop)
end