Class: CitibikeTrips::Trip

Inherits:
Object
  • Object
show all
Defined in:
lib/citibike_trips/trip.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, start_station, end_station, start_timestamp, end_timestmap) ⇒ Trip

Returns a new instance of Trip.



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

def initialize(id, start_station, end_station, start_timestamp, end_timestmap)
  @id = id
  stations = CitibikeTrips::Stations.new
  @start_station = stations[start_station.to_i]
  @end_station = stations[end_station.to_i]
  @start_timestamp = Time.at(start_timestamp.to_i)
  @end_timestamp = Time.at(end_timestmap.to_i)
end

Instance Attribute Details

#end_stationObject (readonly)

Returns the value of attribute end_station.



2
3
4
# File 'lib/citibike_trips/trip.rb', line 2

def end_station
  @end_station
end

#end_timestampObject (readonly)

Returns the value of attribute end_timestamp.



2
3
4
# File 'lib/citibike_trips/trip.rb', line 2

def end_timestamp
  @end_timestamp
end

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/citibike_trips/trip.rb', line 2

def id
  @id
end

#start_stationObject (readonly)

Returns the value of attribute start_station.



2
3
4
# File 'lib/citibike_trips/trip.rb', line 2

def start_station
  @start_station
end

#start_timestampObject (readonly)

Returns the value of attribute start_timestamp.



2
3
4
# File 'lib/citibike_trips/trip.rb', line 2

def start_timestamp
  @start_timestamp
end