Class: Nextbus::Prediction

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttrWithDefault

included

Methods included from InstantiateWithAttrs

#initialize

Instance Attribute Details

#departureObject

Returns the value of attribute departure.



7
8
9
# File 'lib/nextbus/prediction.rb', line 7

def departure
  @departure
end

#stopObject

Returns the value of attribute stop.



7
8
9
# File 'lib/nextbus/prediction.rb', line 7

def stop
  @stop
end

#timeObject

Returns the value of attribute time.



7
8
9
# File 'lib/nextbus/prediction.rb', line 7

def time
  @time
end

Class Method Details

.all(agency_id, route_id, stop_id) ⇒ Object



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

def self.all(agency_id, route_id, stop_id)
  Nextbus.client.predictions(agency_id, route_id, stop_id).map{|prediction| new(prediction) }
end

Instance Method Details

#epoch_time=(nanosecs) ⇒ Object



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

def epoch_time=(nanosecs)
  self.time = Time.at(nanosecs.to_i/1000)
end