Module: BusTime

Defined in:
lib/bus_time.rb,
lib/bus_time/version.rb

Overview

Interact with BusTime APIs to retrieve bus routing and prediction info from transit authorities such as the Chicago Transit Authority (CTA).

Author:

  • Glenn Turner

Defined Under Namespace

Classes: Api, Bulletin, BusRoute, BusStop, Prediction

Constant Summary collapse

DEFAULT_TS_FORMAT =
"%Y%m%d %h:%m"
MAX_NEARBY_DISTANCE =
0.5
VERSION =
"0.3.2"

Class Method Summary collapse

Class Method Details

.apiObject



24
25
26
# File 'lib/bus_time.rb', line 24

def self.api
  @connection
end

.connection(api_key, api_url = nil) ⇒ Object



12
13
14
# File 'lib/bus_time.rb', line 12

def self.connection(api_key, api_url = nil)
  @connection ||= BusTime::Api.new(api_key, api_url)
end

.nearby_distanceObject



16
17
18
# File 'lib/bus_time.rb', line 16

def self.nearby_distance
  @nearby_distance || MAX_NEARBY_DISTANCE
end

.nearby_distance=(distance) ⇒ Object



20
21
22
# File 'lib/bus_time.rb', line 20

def self.nearby_distance=(distance)
  @nearby_distance = distance
end