class GoogleMapsAPI::Directions::Response

Attributes

routes[R]
status[R]

Public Class Methods

from_json(json) click to toggle source
# File lib/google_maps_api/directions/response.rb, line 12
def self.from_json(json)
  parsed_json = parse_json(json)
  routes = build_routes(parsed_json)
  self.new(routes, parsed_json['status'])
end
new(routes, status) click to toggle source
# File lib/google_maps_api/directions/response.rb, line 7
def initialize(routes, status)
  @routes = routes
  @status = status
end

Private Class Methods

build_routes(parsed_json) click to toggle source
# File lib/google_maps_api/directions/response.rb, line 24
def self.build_routes(parsed_json)
  parsed_json['routes'].collect do |r|
    GoogleMapsAPI::Directions::Route.from_hash(r)
  end
end
parse_json(json) click to toggle source
# File lib/google_maps_api/directions/response.rb, line 20
def self.parse_json(json)
  JSON.parse(json)
end