Class: GoogleMapsJuice::Directions::Response::Route
- Inherits:
-
Object
- Object
- GoogleMapsJuice::Directions::Response::Route
- Defined in:
- lib/google_maps_juice/directions/response.rb
Instance Attribute Summary collapse
-
#first_leg ⇒ Object
readonly
Returns the value of attribute first_leg.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
Instance Method Summary collapse
- #distance ⇒ Object
- #duration ⇒ Object
- #end_address ⇒ Object
- #end_location ⇒ Object
-
#initialize(route) ⇒ Route
constructor
A new instance of Route.
- #legs ⇒ Object
- #start_address ⇒ Object
- #start_location ⇒ Object
- #steps ⇒ Object
- #summary ⇒ Object
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_leg ⇒ Object (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 |
#route ⇒ Object (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
#distance ⇒ Object
42 43 44 |
# File 'lib/google_maps_juice/directions/response.rb', line 42 def distance first_leg['distance'] end |
#duration ⇒ Object
38 39 40 |
# File 'lib/google_maps_juice/directions/response.rb', line 38 def duration first_leg['duration'] end |
#end_address ⇒ Object
58 59 60 |
# File 'lib/google_maps_juice/directions/response.rb', line 58 def end_address first_leg['end_address'] end |
#end_location ⇒ Object
50 51 52 |
# File 'lib/google_maps_juice/directions/response.rb', line 50 def end_location first_leg['end_location'] end |
#legs ⇒ Object
26 27 28 |
# File 'lib/google_maps_juice/directions/response.rb', line 26 def legs route['legs'] end |
#start_address ⇒ Object
54 55 56 |
# File 'lib/google_maps_juice/directions/response.rb', line 54 def start_address first_leg['start_address'] end |
#start_location ⇒ Object
46 47 48 |
# File 'lib/google_maps_juice/directions/response.rb', line 46 def start_location first_leg['start_location'] end |
#steps ⇒ Object
34 35 36 |
# File 'lib/google_maps_juice/directions/response.rb', line 34 def steps first_leg['steps'] end |
#summary ⇒ Object
30 31 32 |
# File 'lib/google_maps_juice/directions/response.rb', line 30 def summary route['summary'] end |