Class: GoogleMapsPlatform::GeocoderStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/google_maps_platform/models/geocoder_status.rb

Overview

Indicates the status code resulting from the geocoding operation. This field may contain the following values.

Constant Summary collapse

GEOCODER_STATUS =
[
  # TODO: Write general description for OK

  OK = 'OK'.freeze,

  # TODO: Write general description for ZERO_RESULTS

  ZERO_RESULTS = 'ZERO_RESULTS'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OK) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/google_maps_platform/models/geocoder_status.rb', line 24

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
  else
    default_value
  end
end

.validate(value) ⇒ Object



18
19
20
21
22
# File 'lib/google_maps_platform/models/geocoder_status.rb', line 18

def self.validate(value)
  return false if value.nil?

  GEOCODER_STATUS.include?(value)
end