Class: GoogleMapsPlatform::PlacesTextSearchResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- GoogleMapsPlatform::PlacesTextSearchResponse
- Defined in:
- lib/google_maps_platform/models/places_text_search_response.rb
Overview
PlacesTextSearchResponse Model.
Instance Attribute Summary collapse
-
#error_message ⇒ String
When the service returns a status code other than
OK<, there may be an additionalerror_messagefield within the response object. -
#html_attributions ⇒ Array[String]
May contain a set of attributions about this listing which must be displayed to the user (some listings may not have attribution).
-
#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. -
#next_page_token ⇒ String
Contains a token that can be used to return up to 20 additional results.
-
#results ⇒ Array[Place]
Contains an array of places.
-
#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(html_attributions:, results:, status:, error_message: SKIP, info_messages: SKIP, next_page_token: SKIP, additional_properties: nil) ⇒ PlacesTextSearchResponse
constructor
A new instance of PlacesTextSearchResponse.
-
#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(html_attributions:, results:, status:, error_message: SKIP, info_messages: SKIP, next_page_token: SKIP, additional_properties: nil) ⇒ PlacesTextSearchResponse
Returns a new instance of PlacesTextSearchResponse.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 99 def initialize(html_attributions:, results:, status:, error_message: SKIP, info_messages: SKIP, next_page_token: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @html_attributions = html_attributions @results = results @status = status = unless == SKIP = unless == SKIP @next_page_token = next_page_token unless next_page_token == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#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.
56 57 58 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 56 def end |
#html_attributions ⇒ Array[String]
May contain a set of attributions about this listing which must be displayed to the user (some listings may not have attribution).
15 16 17 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 15 def html_attributions @html_attributions 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.
63 64 65 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 63 def end |
#next_page_token ⇒ String
Contains a token that can be used to return up to 20 additional results. A next_page_token will not be returned if there are no additional results to display. The maximum number of results that can be returned is 60. There is a short delay between when a next_page_token is issued, and when it will become valid.
71 72 73 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 71 def next_page_token @next_page_token end |
#results ⇒ Array[Place]
Contains an array of places. <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>
23 24 25 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 23 def results @results 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.
48 49 50 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 48 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 115 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. html_attributions = hash.key?('html_attributions') ? hash['html_attributions'] : nil # Parameter is an array, so we need to iterate through it results = nil unless hash['results'].nil? results = [] hash['results'].each do |structure| results << (Place.from_hash(structure) if structure) end end results = nil unless hash.key?('results') status = hash.key?('status') ? hash['status'] : nil = hash.key?('error_message') ? hash['error_message'] : SKIP = hash.key?('info_messages') ? hash['info_messages'] : SKIP next_page_token = hash.key?('next_page_token') ? hash['next_page_token'] : 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. PlacesTextSearchResponse.new(html_attributions: html_attributions, results: results, status: status, error_message: , info_messages: , next_page_token: next_page_token, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 74 def self.names @_hash = {} if @_hash.nil? @_hash['html_attributions'] = 'html_attributions' @_hash['results'] = 'results' @_hash['status'] = 'status' @_hash['error_message'] = 'error_message' @_hash['info_messages'] = 'info_messages' @_hash['next_page_token'] = 'next_page_token' @_hash end |
.nullables ⇒ Object
An array for nullable fields
95 96 97 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 95 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
86 87 88 89 90 91 92 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 86 def self.optionals %w[ error_message info_messages next_page_token ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
163 164 165 166 167 168 169 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 163 def inspect class_name = self.class.name.split('::').last "<#{class_name} html_attributions: #{@html_attributions.inspect}, results:"\ " #{@results.inspect}, status: #{@status.inspect}, error_message: #{@error_message.inspect},"\ " info_messages: #{@info_messages.inspect}, next_page_token: #{@next_page_token.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
155 156 157 158 159 160 |
# File 'lib/google_maps_platform/models/places_text_search_response.rb', line 155 def to_s class_name = self.class.name.split('::').last "<#{class_name} html_attributions: #{@html_attributions}, results: #{@results}, status:"\ " #{@status}, error_message: #{@error_message}, info_messages: #{@info_messages},"\ " next_page_token: #{@next_page_token}, additional_properties: #{@additional_properties}>" end |