Class: GoogleMapsJuice::Directions::Response::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/google_maps_juice/directions/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route) ⇒ Route

Returns a new instance of Route.



21
22
23
24
# File 'lib/google_maps_juice/directions/response.rb', line 21

def initialize(route)
  @route = route
  @first_leg = route['legs'].first
end

Instance Attribute Details

#first_legObject (readonly)

Returns the value of attribute first_leg.



20
21
22
# File 'lib/google_maps_juice/directions/response.rb', line 20

def first_leg
  @first_leg
end

#routeObject (readonly)

Returns the value of attribute route.



20
21
22
# File 'lib/google_maps_juice/directions/response.rb', line 20

def route
  @route
end

Instance Method Details

#distanceObject



42
43
44
# File 'lib/google_maps_juice/directions/response.rb', line 42

def distance
  first_leg['distance']
end

#durationObject



38
39
40
# File 'lib/google_maps_juice/directions/response.rb', line 38

def duration
  first_leg['duration']
end

#end_addressObject



58
59
60
# File 'lib/google_maps_juice/directions/response.rb', line 58

def end_address
  first_leg['end_address']
end

#end_locationObject



50
51
52
# File 'lib/google_maps_juice/directions/response.rb', line 50

def end_location
  first_leg['end_location']
end

#legsObject



26
27
28
# File 'lib/google_maps_juice/directions/response.rb', line 26

def legs
  route['legs']
end

#start_addressObject



54
55
56
# File 'lib/google_maps_juice/directions/response.rb', line 54

def start_address
  first_leg['start_address']
end

#start_locationObject



46
47
48
# File 'lib/google_maps_juice/directions/response.rb', line 46

def start_location
  first_leg['start_location']
end

#stepsObject



34
35
36
# File 'lib/google_maps_juice/directions/response.rb', line 34

def steps
  first_leg['steps']
end

#summaryObject



30
31
32
# File 'lib/google_maps_juice/directions/response.rb', line 30

def summary
  route['summary']
end