Class: GoogleMapsPlatform::LocationType

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

Overview

Stores additional data about the specified location. The following values are currently supported: - “ROOFTOP” indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision. - “RANGE_INTERPOLATED” indicates that the returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address. - “GEOMETRIC_CENTER” indicates that the returned result is the geometric center of a result such as a polyline (for example, a street) or polygon (region). - “APPROXIMATE” indicates that the returned result is approximate.

Constant Summary collapse

LOCATION_TYPE =
[
  # TODO: Write general description for ROOFTOP
  ROOFTOP = 'ROOFTOP'.freeze,

  # TODO: Write general description for RANGE_INTERPOLATED
  RANGE_INTERPOLATED = 'RANGE_INTERPOLATED'.freeze,

  # TODO: Write general description for GEOMETRIC_CENTER
  GEOMETRIC_CENTER = 'GEOMETRIC_CENTER'.freeze,

  # TODO: Write general description for APPROXIMATE
  APPROXIMATE = 'APPROXIMATE'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ROOFTOP) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/google_maps_platform/models/location_type.rb', line 39

def self.from_value(value, default_value = ROOFTOP)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'rooftop' then ROOFTOP
  when 'range_interpolated' then RANGE_INTERPOLATED
  when 'geometric_center' then GEOMETRIC_CENTER
  when 'approximate' then APPROXIMATE
  else
    default_value
  end
end

.validate(value) ⇒ Object



33
34
35
36
37
# File 'lib/google_maps_platform/models/location_type.rb', line 33

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

  LOCATION_TYPE.include?(value)
end