class GoogleMapsAPI::Directions::Leg
Attributes
distance[R]
duration[R]
end_address[R]
end_location[R]
start_address[R]
start_location[R]
steps[R]
via_waypoint[R]
Public Class Methods
from_hash(hash)
click to toggle source
# 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
new( distance, duration, end_address, end_location, start_address, start_location, steps, via_waypoint )
click to toggle source
# 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
Private Class Methods
build_steps(hash)
click to toggle source
# File lib/google_maps_api/directions/leg.rb, line 41 def self.build_steps(hash) hash["steps"].collect do |s| GoogleMapsAPI::Directions::Step.from_hash(s) end end