class GoogleMapsAPI::Directions::Route

Attributes

bounds[R]
copyrights[R]
legs[R]
overview_polyline[R]
summary[R]
warnings[R]
waypoint_order[R]

Public Class Methods

from_hash(hash) click to toggle source
# File lib/google_maps_api/directions/route.rb, line 20
def self.from_hash(hash)
  bounds = build_bounds(hash)
  copyrights = hash["copyrights"]
  legs = build_legs(hash)
  overview_polyline = build_overview_polyline(hash)
  summary = hash["summary"]
  warnings = hash["warnings"]
  waypoint_order = hash["waypoint_order"]

  self.new(
    bounds, copyrights, legs, 
    overview_polyline, summary, 
    warnings, waypoint_order
  )
end
new( bounds, copyrights, legs, overview_polyline, summary, warnings, waypoint_order ) click to toggle source
# File lib/google_maps_api/directions/route.rb, line 6
def initialize(
  bounds, copyrights, legs, 
  overview_polyline, summary, 
  warnings, waypoint_order
)
  @bounds = bounds
  @copyrights = copyrights
  @legs = legs
  @overview_polyline = overview_polyline
  @summary = summary
  @warnings = warnings
  @waypoint_order = waypoint_order
end

Private Class Methods

build_bounds(hash) click to toggle source
# File lib/google_maps_api/directions/route.rb, line 38
def self.build_bounds(hash)
  GoogleMapsAPI::Directions::Bounds.from_hash(hash["bounds"])
end
build_legs(hash) click to toggle source
# File lib/google_maps_api/directions/route.rb, line 42
def self.build_legs(hash)
  hash["legs"].collect do |l|
    GoogleMapsAPI::Directions::Leg.from_hash(l)
  end
end
build_overview_polyline(hash) click to toggle source
# File lib/google_maps_api/directions/route.rb, line 48
def self.build_overview_polyline(hash)
  GoogleMapsAPI::Directions::EncodedPolyline.new(hash["overview_polyline"]["points"])
end