Class: Nextbus::Vehicle

Inherits:
Object
  • Object
show all
Includes:
AttrWithDefault, InstantiateWithAttrs
Defined in:
lib/nextbus/vehicle.rb

Class Method Summary collapse

Methods included from AttrWithDefault

included

Methods included from InstantiateWithAttrs

#initialize

Class Method Details

.all(agency_id, route_id) ⇒ Object



9
10
11
# File 'lib/nextbus/vehicle.rb', line 9

def self.all(agency_id, route_id)
  Nextbus.client.vehicles(agency_id, route_id).map{|vehicle| new(vehicle) }
end

.find(agency_id, route_id, id) ⇒ Object



13
14
15
# File 'lib/nextbus/vehicle.rb', line 13

def self.find(agency_id, route_id, id)
  all(agency_id, route_id).detect{|vehicle| vehicle.id == id }
end