Sha256: 542906f2847f6644cc65d4fde339264648454429daccf354b77b293100f9123e

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

module Ratis

  class Vehicle
    attr_accessor :route, :direction, :updatetime, :adherance, :adhchange, :vehicle_id, :offroute, :stopped, :reliable, :inservice, :speed, :heading, :route_id

    def initialize(vehicle)
      @route      = vehicle[:route]
      @direction  = vehicle[:direction]
      @updatetime = vehicle[:updatetime]
      @adherance  = vehicle[:adherance]
      @adhchange  = vehicle[:adhchange]
      @vehicle_id = vehicle[:vehicle_id]
      @offroute   = vehicle[:offroute]
      @stopped    = vehicle[:stopped]
      @reliable   = vehicle[:reliable]
      @inservice  = vehicle[:inservice]
      @speed      = vehicle[:speed]
      @heading    = vehicle[:heading]
      @route_id   = vehicle[:route_id]
    end
  end

  #--------------------------------------------

  class FleetLocation

    def self.current
      response = Request.get 'Fleetlocation'

      return [] unless response.success?

      response.to_array(:fleetlocation_response, :vehicles, :vehicle).map do |vehicle|
        Vehicle.new(vehicle)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ratis-3.6.6 lib/ratis/fleet_location.rb
ratis-3.6.5 lib/ratis/fleet_location.rb
ratis-3.6.4 lib/ratis/fleet_location.rb
ratis-3.6.3 lib/ratis/fleet_location.rb
ratis-3.6.2 lib/ratis/fleet_location.rb
ratis-3.6.1 lib/ratis/fleet_location.rb
ratis-3.6.0 lib/ratis/fleet_location.rb
ratis-3.5.0 lib/ratis/fleet_location.rb