Class: GoogleMapsPlatform::PlacesFindPlaceFromTextResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- GoogleMapsPlatform::PlacesFindPlaceFromTextResponse
- Defined in:
- lib/google_maps_platform/models/places_find_place_from_text_response.rb
Overview
PlacesFindPlaceFromTextResponse Model.
Instance Attribute Summary collapse
-
#candidates ⇒ Array[Place]
Contains an array of Place candidates.
-
#error_message ⇒ String
When the service returns a status code other than
OK<, there may be an additionalerror_messagefield within the response object. -
#info_messages ⇒ Array[String]
When the service returns additional information about the request specification, there may be an additional
info_messagesfield within the response object. -
#status ⇒ PlacesSearchStatus
Status codes returned by service.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(candidates:, status:, error_message: SKIP, info_messages: SKIP, additional_properties: nil) ⇒ PlacesFindPlaceFromTextResponse
constructor
A new instance of PlacesFindPlaceFromTextResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(candidates:, status:, error_message: SKIP, info_messages: SKIP, additional_properties: nil) ⇒ PlacesFindPlaceFromTextResponse
Returns a new instance of PlacesFindPlaceFromTextResponse.
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 83 def initialize(candidates:, status:, error_message: SKIP, info_messages: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @candidates = candidates @status = status @error_message = unless == SKIP @info_messages = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#candidates ⇒ Array[Place]
Contains an array of Place candidates. <div class=“caution”>Place Search requests return a subset of the fields that are returned by Place Details requests. If the field you want is not returned by Place Search, you can use Place Search to get a place_id, then use that Place ID to make a Place Details request.</div>
18 19 20 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 18 def candidates @candidates end |
#error_message ⇒ String
When the service returns a status code other than OK<, there may be an additional error_message field within the response object. This field contains more detailed information about thereasons behind the given status code. This field is not always returned, and its content is subject to change.
51 52 53 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 51 def @error_message end |
#info_messages ⇒ Array[String]
When the service returns additional information about the request specification, there may be an additional info_messages field within the response object. This field is only returned for successful requests. It may not always be returned, and its content is subject to change.
58 59 60 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 58 def @info_messages end |
#status ⇒ PlacesSearchStatus
Status codes returned by service.
-
OKindicating the API request was successful. -
ZERO_RESULTSindicating that the search was successful but returned no
results. This may occur if the search was passed a latlng in a remote location.
-
INVALID_REQUESTindicating the API request was malformed, generally
due to missing required query parameter (location or radius).
-
OVER_QUERY_LIMITindicating any of the following:-
You have exceeded the QPS limits.
-
Billing has not been enabled on your account.
-
The monthly $200 credit, or a self-imposed usage cap, has been
-
exceeded.
- The provided method of payment is no longer valid (for example, a
credit card has expired).
See the [Maps
FAQ](developers.google.com/maps/faq#over-limit-key-error) for more information about how to resolve this error.
-
REQUEST_DENIEDindicating that your request was denied, generally
because:
- The request is missing an API key.
- The `key` parameter is invalid.
-
UNKNOWN_ERRORindicating an unknown error.
43 44 45 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 43 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
96 97 98 99 100 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 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 96 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it candidates = nil unless hash['candidates'].nil? candidates = [] hash['candidates'].each do |structure| candidates << (Place.from_hash(structure) if structure) end end candidates = nil unless hash.key?('candidates') status = hash.key?('status') ? hash['status'] : nil = hash.key?('error_message') ? hash['error_message'] : SKIP = hash.key?('info_messages') ? hash['info_messages'] : 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. PlacesFindPlaceFromTextResponse.new(candidates: candidates, status: status, error_message: , info_messages: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
61 62 63 64 65 66 67 68 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 61 def self.names @_hash = {} if @_hash.nil? @_hash['candidates'] = 'candidates' @_hash['status'] = 'status' @_hash['error_message'] = 'error_message' @_hash['info_messages'] = 'info_messages' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 79 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
71 72 73 74 75 76 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 71 def self.optionals %w[ error_message info_messages ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
138 139 140 141 142 143 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 138 def inspect class_name = self.class.name.split('::').last "<#{class_name} candidates: #{@candidates.inspect}, status: #{@status.inspect},"\ " error_message: #{@error_message.inspect}, info_messages: #{@info_messages.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
130 131 132 133 134 135 |
# File 'lib/google_maps_platform/models/places_find_place_from_text_response.rb', line 130 def to_s class_name = self.class.name.split('::').last "<#{class_name} candidates: #{@candidates}, status: #{@status}, error_message:"\ " #{@error_message}, info_messages: #{@info_messages}, additional_properties:"\ " #{@additional_properties}>" end |