Class: GmapsDirections::Route
- Inherits:
-
Object
- Object
- GmapsDirections::Route
- Defined in:
- lib/gmaps_directions.rb
Instance Attribute Summary collapse
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#end_address ⇒ Object
readonly
Returns the value of attribute end_address.
-
#end_location ⇒ Object
readonly
Returns the value of attribute end_location.
-
#formatted_distance ⇒ Object
readonly
Returns the value of attribute formatted_distance.
-
#formatted_duration ⇒ Object
readonly
Returns the value of attribute formatted_duration.
-
#start_address ⇒ Object
readonly
Returns the value of attribute start_address.
-
#start_location ⇒ Object
readonly
Returns the value of attribute start_location.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(gmaps_route_hash, status) ⇒ Route
constructor
A new instance of Route.
Constructor Details
#initialize(gmaps_route_hash, status) ⇒ Route
Returns a new instance of Route.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/gmaps_directions.rb', line 73 def initialize(gmaps_route_hash, status) @duration = gmaps_route_hash["legs"].first["duration"]["value"] @formatted_duration = gmaps_route_hash["legs"].first["duration"]["text"] @distance = gmaps_route_hash["legs"].first["distance"]["value"] @formatted_distance = gmaps_route_hash["legs"].first["distance"]["text"] @start_address = gmaps_route_hash["legs"].first["start_address"] @end_address = gmaps_route_hash["legs"].first["end_address"] @start_location = gmaps_route_hash["legs"].first["start_location"] @end_location = gmaps_route_hash["legs"].first["end_location"] @status = status end |
Instance Attribute Details
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def distance @distance end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def duration @duration end |
#end_address ⇒ Object (readonly)
Returns the value of attribute end_address.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def end_address @end_address end |
#end_location ⇒ Object (readonly)
Returns the value of attribute end_location.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def end_location @end_location end |
#formatted_distance ⇒ Object (readonly)
Returns the value of attribute formatted_distance.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def formatted_distance @formatted_distance end |
#formatted_duration ⇒ Object (readonly)
Returns the value of attribute formatted_duration.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def formatted_duration @formatted_duration end |
#start_address ⇒ Object (readonly)
Returns the value of attribute start_address.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def start_address @start_address end |
#start_location ⇒ Object (readonly)
Returns the value of attribute start_location.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def start_location @start_location end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
69 70 71 |
# File 'lib/gmaps_directions.rb', line 69 def status @status end |