Class: GoogleMapsPlatform::Type

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

Overview

Type.

Constant Summary collapse

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 AMUSEMENT_PARK
  AMUSEMENT_PARK = 'amusement_park'.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 ESTABLISHMENT
  ESTABLISHMENT = 'establishment'.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 POINT_OF_INTEREST
  POINT_OF_INTEREST = 'point_of_interest'.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 SUBLOCALITY_LEVEL_1
  SUBLOCALITY_LEVEL_1 = 'sublocality_level_1'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ADMINISTRATIVE_AREA_LEVEL_1) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/google_maps_platform/models/type.rb', line 101

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 'amusement_park' then AMUSEMENT_PARK
  when 'airport' then AIRPORT
  when 'colloquial_area' then COLLOQUIAL_AREA
  when 'country' then COUNTRY
  when 'establishment' then ESTABLISHMENT
  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 'point_of_interest' then POINT_OF_INTEREST
  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 'sublocality_level_1' then SUBLOCALITY_LEVEL_1
  when 'subpremise' then SUBPREMISE
  when 'tourist_attraction' then TOURIST_ATTRACTION
  when 'train_station' then TRAIN_STATION
  when 'transit_station' then TRANSIT_STATION
  else
    default_value
  end
end

.validate(value) ⇒ Object



95
96
97
98
99
# File 'lib/google_maps_platform/models/type.rb', line 95

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

  TYPE.include?(value)
end