Class: GoogleMapsPlatform::DirectionsStatus
- Inherits:
-
Object
- Object
- GoogleMapsPlatform::DirectionsStatus
- Defined in:
- lib/google_maps_platform/models/directions_status.rb
Overview
The status field within the Directions response object contains the status of the request, and may contain debugging information to help you track down why the Directions service failed. The status field may contain the following values: - OK indicates the response contains a valid result. - NOT_FOUND indicates at least one of the locations specified in the request’s origin, destination, or waypoints could not be geocoded. - ZERO_RESULTS indicates no route could be found between the origin and destination. - MAX_WAYPOINTS_EXCEEDED indicates that too many waypoints were provided in the request. For applications using the Directions API as a web service, or the directions service in the Maps JavaScript API, the maximum allowed number of waypoints is 25, plus the origin and destination.
-
MAX_ROUTE_LENGTH_EXCEEDEDindicates the requested route is too long and
cannot be processed. This error occurs when more complex directions are returned. Try reducing the number of waypoints, turns, or instructions. - INVALID_REQUEST indicates that the provided request was invalid. Common causes of this status include an invalid parameter or parameter value. - OVER_DAILY_LIMIT indicates any of the following: - The API key is missing or invalid. - Billing has not been enabled on your account.
-
A self-imposed usage cap has been exceeded. - The provided method of
payment is no longer valid (for example, a credit card has expired). See the [Maps FAQ](developers.google.com/maps/faq#over-limit-key-error) to learn how to fix this. - OVER_QUERY_LIMIT indicates the service has received too many requests from your application within the allowed time period. - REQUEST_DENIED indicates that the service denied use of the directions service by your application. - UNKNOWN_ERROR indicates a directions request could not be processed due to a server error. The request may succeed if you try again.
Constant Summary collapse
- DIRECTIONS_STATUS =
[ # TODO: Write general description for OK OK = 'OK'.freeze, # TODO: Write general description for NOT_FOUND NOT_FOUND = 'NOT_FOUND'.freeze, # TODO: Write general description for ZERO_RESULTS ZERO_RESULTS = 'ZERO_RESULTS'.freeze, # TODO: Write general description for MAX_WAYPOINTS_EXCEEDED MAX_WAYPOINTS_EXCEEDED = 'MAX_WAYPOINTS_EXCEEDED'.freeze, # TODO: Write general description for MAX_ROUTE_LENGTH_EXCEEDED MAX_ROUTE_LENGTH_EXCEEDED = 'MAX_ROUTE_LENGTH_EXCEEDED'.freeze, # TODO: Write general description for INVALID_REQUEST INVALID_REQUEST = 'INVALID_REQUEST'.freeze, # TODO: Write general description for OVER_DAILY_LIMIT OVER_DAILY_LIMIT = 'OVER_DAILY_LIMIT'.freeze, # TODO: Write general description for OVER_QUERY_LIMIT OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT'.freeze, # TODO: Write general description for REQUEST_DENIED REQUEST_DENIED = 'REQUEST_DENIED'.freeze, # TODO: Write general description for UNKNOWN_ERROR UNKNOWN_ERROR = 'UNKNOWN_ERROR'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = OK) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/google_maps_platform/models/directions_status.rb', line 73 def self.from_value(value, default_value = OK) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'ok' then OK when 'not_found' then NOT_FOUND when 'zero_results' then ZERO_RESULTS when 'max_waypoints_exceeded' then MAX_WAYPOINTS_EXCEEDED when 'max_route_length_exceeded' then MAX_ROUTE_LENGTH_EXCEEDED when 'invalid_request' then INVALID_REQUEST when 'over_daily_limit' then OVER_DAILY_LIMIT when 'over_query_limit' then OVER_QUERY_LIMIT when 'request_denied' then REQUEST_DENIED when 'unknown_error' then UNKNOWN_ERROR else default_value end end |
.validate(value) ⇒ Object
67 68 69 70 71 |
# File 'lib/google_maps_platform/models/directions_status.rb', line 67 def self.validate(value) return false if value.nil? DIRECTIONS_STATUS.include?(value) end |