Sha256: ba89ae281c530981fd748f3c0391ee1e9fb06add77358755d3afa88ebfb9bc8c

Contents?: true

Size: 405 Bytes

Versions: 2

Compression:

Stored size: 405 Bytes

Contents

module Nextbus
  class Vehicle

    include InstantiateWithAttrs
    include AttrWithDefault

    attr_accessor :id, :agency, :route, :reports => []

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

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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nextbus-0.0.1 lib/nextbus/vehicle.rb
nextbus-0.0.0 lib/nextbus/vehicle.rb