Class: GoogleMapsPlatform::ResultType

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

Overview

result_type.

Constant Summary collapse

RESULT_TYPE =
[
  # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_1

  ADMINISTRATIVE_AREA_LEVEL_1 = 'administrative_area_level_1'.freeze,

  # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_2

  ADMINISTRATIVE_AREA_LEVEL_2 = 'administrative_area_level_2'.freeze,

  # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_3

  ADMINISTRATIVE_AREA_LEVEL_3 = 'administrative_area_level_3'.freeze,

  # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_4

  ADMINISTRATIVE_AREA_LEVEL_4 = 'administrative_area_level_4'.freeze,

  # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_5

  ADMINISTRATIVE_AREA_LEVEL_5 = 'administrative_area_level_5'.freeze,

  # TODO: Write general description for AIRPORT

  AIRPORT = 'airport'.freeze,

  # TODO: Write general description for COLLOQUIAL_AREA

  COLLOQUIAL_AREA = 'colloquial_area'.freeze,

  # TODO: Write general description for COUNTRY

  COUNTRY = 'country'.freeze,

  # TODO: Write general description for INTERSECTION

  INTERSECTION = 'intersection'.freeze,

  # TODO: Write general description for LOCALITY

  LOCALITY = 'locality'.freeze,

  # TODO: Write general description for NATURAL_FEATURE

  NATURAL_FEATURE = 'natural_feature'.freeze,

  # TODO: Write general description for NEIGHBORHOOD

  NEIGHBORHOOD = 'neighborhood'.freeze,

  # TODO: Write general description for PARK

  PARK = 'park'.freeze,

  # TODO: Write general description for PLUS_CODE

  PLUS_CODE = 'plus_code'.freeze,

  # TODO: Write general description for POLITICAL

  POLITICAL = 'political'.freeze,

  # TODO: Write general description for POSTAL_CODE

  POSTAL_CODE = 'postal_code'.freeze,

  # TODO: Write general description for PREMISE

  PREMISE = 'premise'.freeze,

  # TODO: Write general description for ROUTE

  ROUTE = 'route'.freeze,

  # TODO: Write general description for STREET_ADDRESS

  STREET_ADDRESS = 'street_address'.freeze,

  # TODO: Write general description for SUBLOCALITY

  SUBLOCALITY = 'sublocality'.freeze,

  # TODO: Write general description for SUBPREMISE

  SUBPREMISE = 'subpremise'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ADMINISTRATIVE_AREA_LEVEL_1) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/google_maps_platform/models/result_type.rb', line 80

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

  str = value.to_s.strip

  case str.downcase
  when 'administrative_area_level_1' then ADMINISTRATIVE_AREA_LEVEL_1
  when 'administrative_area_level_2' then ADMINISTRATIVE_AREA_LEVEL_2
  when 'administrative_area_level_3' then ADMINISTRATIVE_AREA_LEVEL_3
  when 'administrative_area_level_4' then ADMINISTRATIVE_AREA_LEVEL_4
  when 'administrative_area_level_5' then ADMINISTRATIVE_AREA_LEVEL_5
  when 'airport' then AIRPORT
  when 'colloquial_area' then COLLOQUIAL_AREA
  when 'country' then COUNTRY
  when 'intersection' then INTERSECTION
  when 'locality' then LOCALITY
  when 'natural_feature' then NATURAL_FEATURE
  when 'neighborhood' then NEIGHBORHOOD
  when 'park' then PARK
  when 'plus_code' then PLUS_CODE
  when 'political' then POLITICAL
  when 'postal_code' then POSTAL_CODE
  when 'premise' then PREMISE
  when 'route' then ROUTE
  when 'street_address' then STREET_ADDRESS
  when 'sublocality' then SUBLOCALITY
  when 'subpremise' then SUBPREMISE
  else
    default_value
  end
end

.validate(value) ⇒ Object



74
75
76
77
78
# File 'lib/google_maps_platform/models/result_type.rb', line 74

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

  RESULT_TYPE.include?(value)
end