class Metrobus::Stop
Stop
class - domain object representing stops for a route going a specific direction
Constants
- STOPS_PATH
Path for the stop endpoint
Attributes
stop_id[RW]
stop_name[RW]
text[RW]
value[RW]
Public Class Methods
find(stop_name, route_id, direction_id, stops = get(route_id, direction_id))
click to toggle source
Finds stops containing the passed in stop name @param stop_name
[String] stop_name
a user is looking for @param route_id [String] route_id for a metro route @param direction_id [String] direction_id attached to the route indicating north, south, east or west @return [array] of Metrobus::Stop
objects
# File lib/metrobus/stop.rb, line 28 def self.find(stop_name, route_id, direction_id, stops = get(route_id, direction_id)) if stops stops.find_all { |stop| stop.stop_name.downcase.include?(stop_name.downcase) } end end
get(route_id, direction_id, connection = Metrobus.connection)
click to toggle source
Get stop information for a a given route and direction @param route_id [String] route_id for a metro route @param direction_id [String] direction_id attached to the route indicating north, south, east or west @return [array] of Metrobus::Stop
objects
# File lib/metrobus/stop.rb, line 17 def self.get(route_id, direction_id, connection = Metrobus.connection) stops = connection.request(STOPS_PATH + "#{route_id}/#{direction_id}") stops.map { |hash| new(hash) } end