Class: CTA::Bus

Inherits:
Trip
  • Object
show all
Defined in:
lib/cta_redux/models/bus.rb

Overview

Note:

Current columns: [:route_id, :service_id, :trip_id, :direction_id, :block_id, :shape_id, :direction, :wheelchair_accessible, :schd_trip_id]

A Sequel::Model, inherited from Trip This corresponds to trips.txt in the GTFS feed, though the CTA does not fully implement the standard.

Defined Under Namespace

Classes: Live, Prediction

Constant Summary

Constants inherited from Trip

Trip::BUS_ROUTES, Trip::L_ROUTES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Trip

#calendar, find_active_run, #route, #stop_times, #stops

Instance Attribute Details

#liveLive

Note:

a CTA::Bus will only contain live data when augmented with an API::Response

Returns the Live data associated with this CTA::Bus, if available.

Returns:



9
10
11
# File 'lib/cta_redux/models/bus.rb', line 9

def live
  @live
end

Instance Method Details

#block_idInteger

Returns:

  • (Integer)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id

#directionString

Returns:

  • (String)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id

#direction_idInteger

Returns:

  • (Integer)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id

#predictions!(options = {}) ⇒ CTA::BusTracker::PredictionsResponse

Returns predictions for this CTA::Bus. Accepts all options for CTA::BusTracker.predictions!, and will merge in it’s own vehicle_id or route_id if present.

Examples:

predictions!(:stops => 15895)
predictions!(:limit => 1)

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :vehicles (Array<String>, Array<Integer>, String, Integer)

    Vehicles to predict. Not available with :routes

  • :routes (Array<String>, Array<Integer>, String, Integer)

    Routes to predict. Not available with :vehicles

  • :stops (Array<String>, Array<Integer>, String, Integer)

    Stops along a route to predict. Required with :routes

  • :limit (String, Integer)

    Maximum number of predictions to return.

Returns:



44
45
46
47
# File 'lib/cta_redux/models/bus.rb', line 44

def predictions!(options = {})
  opts = (self.vehicle_id ? { :vehicles => self.vehicle_id } : { :routes => self.route_id })
  CTA::BusTracker.predictions!(options.merge(opts))
end

#route_idString Also known as: id

Returns:

  • (String)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id

#schd_trip_idString Also known as: scheduled_trip_id, run

Returns:

  • (String)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id

#service_idInteger

Returns:

  • (Integer)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id

#shape_idInteger

Returns:

  • (Integer)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id

#trip_idInteger

Returns:

  • (Integer)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id

#wheelchair_accessibletrue, false

Returns:

  • (true, false)


29
# File 'lib/cta_redux/models/bus.rb', line 29

alias_method :id, :route_id