Class: GoogleMapsAPI::Directions::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/google_maps_api/directions/response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(routes, status) ⇒ Response

Returns a new instance of Response.



7
8
9
10
# File 'lib/google_maps_api/directions/response.rb', line 7

def initialize(routes, status)
  @routes = routes
  @status = status
end

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



5
6
7
# File 'lib/google_maps_api/directions/response.rb', line 5

def routes
  @routes
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/google_maps_api/directions/response.rb', line 5

def status
  @status
end

Class Method Details

.from_json(json) ⇒ Object



12
13
14
15
16
# 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