Class: GoogleMapsAPI::Directions::Leg
- Inherits:
-
Object
- Object
- GoogleMapsAPI::Directions::Leg
- Extended by:
- LegAndStepCommonBuilders
- Defined in:
- lib/google_maps_api/directions/leg.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.
-
#start_address ⇒ Object
readonly
Returns the value of attribute start_address.
-
#start_location ⇒ Object
readonly
Returns the value of attribute start_location.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#via_waypoint ⇒ Object
readonly
Returns the value of attribute via_waypoint.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(distance, duration, end_address, end_location, start_address, start_location, steps, via_waypoint) ⇒ Leg
constructor
A new instance of Leg.
Methods included from LegAndStepCommonBuilders
build_coordinate, build_distance, build_duration
Constructor Details
#initialize(distance, duration, end_address, end_location, start_address, start_location, steps, via_waypoint) ⇒ Leg
Returns a new instance of Leg.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/google_maps_api/directions/leg.rb', line 9 def initialize( distance, duration, end_address, end_location, start_address, start_location, steps, via_waypoint ) @distance = distance @duration = duration @end_address = end_address @end_location = end_location @start_address = start_address @start_location = start_location @steps = steps @via_waypoint = via_waypoint end |
Instance Attribute Details
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
6 7 8 |
# File 'lib/google_maps_api/directions/leg.rb', line 6 def distance @distance end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
6 7 8 |
# File 'lib/google_maps_api/directions/leg.rb', line 6 def duration @duration end |
#end_address ⇒ Object (readonly)
Returns the value of attribute end_address.
6 7 8 |
# File 'lib/google_maps_api/directions/leg.rb', line 6 def end_address @end_address end |
#end_location ⇒ Object (readonly)
Returns the value of attribute end_location.
6 7 8 |
# File 'lib/google_maps_api/directions/leg.rb', line 6 def end_location @end_location end |
#start_address ⇒ Object (readonly)
Returns the value of attribute start_address.
6 7 8 |
# File 'lib/google_maps_api/directions/leg.rb', line 6 def start_address @start_address end |
#start_location ⇒ Object (readonly)
Returns the value of attribute start_location.
6 7 8 |
# File 'lib/google_maps_api/directions/leg.rb', line 6 def start_location @start_location end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
6 7 8 |
# File 'lib/google_maps_api/directions/leg.rb', line 6 def steps @steps end |
#via_waypoint ⇒ Object (readonly)
Returns the value of attribute via_waypoint.
6 7 8 |
# File 'lib/google_maps_api/directions/leg.rb', line 6 def via_waypoint @via_waypoint end |
Class Method Details
.from_hash(hash) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/google_maps_api/directions/leg.rb', line 23 def self.from_hash(hash) distance = build_distance(hash) duration = build_duration(hash) end_address = hash["end_address"] end_location = build_coordinate(hash["end_location"]) start_address = hash["start_address"] start_location = build_coordinate(hash["start_location"]) steps = build_steps(hash) via_waypoint = hash["via_waypoint"] self.new( distance, duration, end_address, end_location, start_address, start_location, steps, via_waypoint ) end |