Class: Ratis::Itinerary

Inherits:
Object
  • Object
show all
Defined in:
lib/ratis/itinerary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Itinerary

Returns a new instance of Itinerary.



7
8
9
10
11
12
13
14
15
16
# File 'lib/ratis/itinerary.rb', line 7

def initialize(response)
  @co2_auto       = response[:co2auto].to_f
  @co2_transit    = response[:co2transit].to_f
  @final_walk_dir = response[:finalwalkdir]
  @reduced_fare   = response[:reducedfare].to_f
  @regular_fare   = response[:regularfare].to_f
  @transit_time   = response[:transittime].to_i
  @trace_info     = response[:traceinfo]
  @legs           = response.to_array(:legs, :leg).map { |l| Hashie::Mash.new l }
end

Instance Attribute Details

#co2_autoObject

Returns the value of attribute co2_auto.



5
6
7
# File 'lib/ratis/itinerary.rb', line 5

def co2_auto
  @co2_auto
end

#co2_transitObject

Returns the value of attribute co2_transit.



5
6
7
# File 'lib/ratis/itinerary.rb', line 5

def co2_transit
  @co2_transit
end

#final_walk_dirObject

Returns the value of attribute final_walk_dir.



5
6
7
# File 'lib/ratis/itinerary.rb', line 5

def final_walk_dir
  @final_walk_dir
end

#legsObject

Returns the value of attribute legs.



5
6
7
# File 'lib/ratis/itinerary.rb', line 5

def legs
  @legs
end

#reduced_fareObject

Returns the value of attribute reduced_fare.



5
6
7
# File 'lib/ratis/itinerary.rb', line 5

def reduced_fare
  @reduced_fare
end

#regular_fareObject

Returns the value of attribute regular_fare.



5
6
7
# File 'lib/ratis/itinerary.rb', line 5

def regular_fare
  @regular_fare
end

#trace_infoObject

Returns the value of attribute trace_info.



5
6
7
# File 'lib/ratis/itinerary.rb', line 5

def trace_info
  @trace_info
end

#transit_timeObject

Returns the value of attribute transit_time.



5
6
7
# File 'lib/ratis/itinerary.rb', line 5

def transit_time
  @transit_time
end