Class: GoogleMapsPlatform::DirectionsGeocodedWaypoint

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

Overview

DirectionsGeocodedWaypoint Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(geocoder_status: SKIP, partial_match: SKIP, place_id: SKIP, types: SKIP, additional_properties: nil) ⇒ DirectionsGeocodedWaypoint



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 127

def initialize(geocoder_status: SKIP, partial_match: SKIP, place_id: SKIP,
               types: SKIP, additional_properties: nil)
  # Add additional model properties to the instance

  additional_properties = {} if additional_properties.nil?

  @geocoder_status = geocoder_status unless geocoder_status == SKIP
  @partial_match = partial_match unless partial_match == SKIP
  @place_id = place_id unless place_id == SKIP
  @types = types unless types == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#geocoder_statusGeocoderStatus

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



15
16
17
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 15

def geocoder_status
  @geocoder_status
end

#partial_matchObject

Indicates that the geocoder did not return an exact match for the original request, though it was able to match part of the requested address. You may wish to examine the original request for misspellings and/or an incomplete address. Partial matches most often occur for street addresses that do not exist within the locality you pass in the request. Partial matches may also be returned when a request matches two or more locations in the same locality. For example, “21 Henr St, Bristol, UK” will return a partial match for both Henry Street and Henrietta Street. Note that if a request includes a misspelled address component, the geocoding service may suggest an alternative address. Suggestions triggered in this way will also be marked as a partial match.



30
31
32
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 30

def partial_match
  @partial_match
end

#place_idString

A unique identifier that can be used with other Google APIs. See the [Place ID overview](developers.google.com/maps/documentation/places/web-serv ice/place-id).



37
38
39
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 37

def place_id
  @place_id
end

#typesArray[Type]

Indicates the address type of the geocoding result used for calculating directions.

  • administrative_area_level_1 indicates a first-order civil entity below

the country level. Within the United States, these administrative levels are states. Not all nations exhibit these administrative levels. In most cases, administrative_area_level_1 short names will closely match ISO 3166-2 subdivisions and other widely circulated lists; however this is not guaranteed as our geocoding results are based on a variety of signals and location data.

  • administrative_area_level_2 indicates a second-order civil entity

below the country level. Within the United States, these administrative levels are counties. Not all nations exhibit these administrative levels.

  • administrative_area_level_3 indicates a third-order civil entity below

the country level. This type indicates a minor civil division. Not all nations exhibit these administrative levels.

  • administrative_area_level_4 indicates a fourth-order civil entity

below the country level. This type indicates a minor civil division. Not all nations exhibit these administrative levels.

  • administrative_area_level_5 indicates a fifth-order civil entity below

the country level. This type indicates a minor civil division. Not all nations exhibit these administrative levels.

  • airport indicates an airport.

  • colloquial_area indicates a commonly-used alternative name for the

entity.

  • country indicates the national political entity, and is typically the

highest order type returned by the Geocoder.

  • intersection indicates a major intersection, usually of two major

roads.

  • locality indicates an incorporated city or town political entity.

  • natural_feature indicates a prominent natural feature.

  • neighborhood indicates a named neighborhood

  • park indicates a named park.

  • plus_code indicates an encoded location reference, derived from

latitude and longitude. Plus codes can be used as a replacement for street addresses in places where they do not exist (where buildings are not numbered or streets are not named). See [plus.codes](https://plus.codes/) for details.

  • point_of_interest indicates a named point of interest. Typically,

these “POI”s are prominent local entities that don’t easily fit in another category, such as “Empire State Building” or “Eiffel Tower”.

  • political indicates a political entity. Usually, this type indicates a

polygon of some civil administration.

  • postal_code indicates a postal code as used to address postal mail

within the country.

  • premise indicates a named location, usually a building or collection

of buildings with a common name

  • route indicates a named route (such as “US 101”).

  • street_address indicates a precise street address.

  • sublocality indicates a first-order civil entity below a locality. For

some locations may receive one of the additional types: sublocality_level_1 to sublocality_level_5. Each sublocality level is a civil entity. Larger numbers indicate a smaller geographic area.

  • subpremise indicates a first-order entity below a named location,

usually a singular building within a collection of buildings with a common name

  • tourist_attraction indicates a tourist attraction.

  • train_station indicates a train station.

  • transit_station indicates a transit station.

An empty list of types indicates there are no known types for the particular address component, for example, Lieu-dit in France.



100
101
102
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 100

def types
  @types
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 140

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  geocoder_status =
    hash.key?('geocoder_status') ? hash['geocoder_status'] : SKIP
  partial_match = hash.key?('partial_match') ? hash['partial_match'] : SKIP
  place_id = hash.key?('place_id') ? hash['place_id'] : SKIP
  types = hash.key?('types') ? hash['types'] : SKIP

  # Create a new hash for additional properties, removing known properties.

  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.

  DirectionsGeocodedWaypoint.new(geocoder_status: geocoder_status,
                                 partial_match: partial_match,
                                 place_id: place_id,
                                 types: types,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



103
104
105
106
107
108
109
110
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 103

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['geocoder_status'] = 'geocoder_status'
  @_hash['partial_match'] = 'partial_match'
  @_hash['place_id'] = 'place_id'
  @_hash['types'] = 'types'
  @_hash
end

.nullablesObject

An array for nullable fields



123
124
125
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 123

def self.nullables
  []
end

.optionalsObject

An array for optional fields



113
114
115
116
117
118
119
120
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 113

def self.optionals
  %w[
    geocoder_status
    partial_match
    place_id
    types
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



174
175
176
177
178
179
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 174

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} geocoder_status: #{@geocoder_status.inspect}, partial_match:"\
  " #{@partial_match.inspect}, place_id: #{@place_id.inspect}, types: #{@types.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



166
167
168
169
170
171
# File 'lib/google_maps_platform/models/directions_geocoded_waypoint.rb', line 166

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} geocoder_status: #{@geocoder_status}, partial_match: #{@partial_match},"\
  " place_id: #{@place_id}, types: #{@types}, additional_properties:"\
  " #{@additional_properties}>"
end