Class: Trip

Inherits:
CUMTD show all
Defined in:
lib/trip.rb

Instance Method Summary collapse

Methods inherited from CUMTD

all_routes, all_stops, #api_key, #get_departures_by_stop, #get_reroutes, #get_routes, #get_routes_by_stop, #get_shape_between_stops, #get_shape_by_id, #get_stop_by_id, #get_stop_times_by_stop, #get_stop_times_by_trip, #get_stops, #get_stops_by_lat_lon, #get_stops_by_search, #get_trip_by_id, #get_trips_by_block, #get_vehicle_by_id, #get_vehicles, #get_vehicles_by_route_id, #nearest_departures, #print_all_departures, reroutes, #serialize_routes, #serialize_stops, #serialize_vehicles

Constructor Details

#initialize(json) ⇒ Trip

Returns a new instance of Trip.



3
4
5
6
7
8
9
10
11
# File 'lib/trip.rb', line 3

def initialize(json)
	@trip_id = json["trip_id"]
	@trip_headsign = json["trip_headsign"]
	@route_id = json["route_id"]
	@block_id = json["block_id"]
	@direction = json["direction"]
	@service_id = json["service_id"]
	@shape_id = json["shape_id"]
end

Instance Method Details

#block_idObject



37
38
39
# File 'lib/trip.rb', line 37

def block_id
	@block_id
end

#directionObject



41
42
43
# File 'lib/trip.rb', line 41

def direction
	@direction
end

#route_idObject



33
34
35
# File 'lib/trip.rb', line 33

def route_id
	@route_id
end

#service_idObject



45
46
47
# File 'lib/trip.rb', line 45

def service_id
	@service_id
end

#shape_idObject



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

def shape_id
	@shape_id
end

#to_json(*a) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/trip.rb', line 13

def to_json(*a)
	{
	'trip_id' => @trip_id,
	'trip_headsign' => @trip_headsign,
	'route_id' => @route_id,
	'block_id' => @block_id,
	'direction' => @direction,
	'service_id' => @service_id,
	'shape_id' => @shape_id
	}.to_json(*a)
end

#trip_headsignObject



29
30
31
# File 'lib/trip.rb', line 29

def trip_headsign
	@trip_headsign
end

#trip_idObject



25
26
27
# File 'lib/trip.rb', line 25

def trip_id
	@trip_id
end