Class: GoogleMapsPlatform::PlacesAutocompleteStatus
- Inherits:
-
Object
- Object
- GoogleMapsPlatform::PlacesAutocompleteStatus
- Defined in:
- lib/google_maps_platform/models/places_autocomplete_status.rb
Overview
Status codes returned by service. - OK indicating the API request was successful. - ZERO_RESULTS indicating that the search was successful but returned no results. This may occur if the search was passed a bounds in a remote location. - INVALID_REQUEST indicating the API request was malformed, generally due to the missing input parameter. - OVER_QUERY_LIMIT indicating any of the following: - You have exceeded the QPS limits. - Billing has not been enabled on your account. - The monthly $200 credit, or 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) for more information about how to resolve this error. - REQUEST_DENIED indicating that your request was denied, generally because: - The request is missing an API key. - The key parameter is invalid. - UNKNOWN_ERROR indicating an unknown error.
Constant Summary collapse
- PLACES_AUTOCOMPLETE_STATUS =
[ # TODO: Write general description for OK OK = 'OK'.freeze, # TODO: Write general description for ZERO_RESULTS ZERO_RESULTS = 'ZERO_RESULTS'.freeze, # TODO: Write general description for INVALID_REQUEST INVALID_REQUEST = 'INVALID_REQUEST'.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
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/google_maps_platform/models/places_autocomplete_status.rb', line 49 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 'zero_results' then ZERO_RESULTS when 'invalid_request' then INVALID_REQUEST 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
43 44 45 46 47 |
# File 'lib/google_maps_platform/models/places_autocomplete_status.rb', line 43 def self.validate(value) return false if value.nil? PLACES_AUTOCOMPLETE_STATUS.include?(value) end |