Class: Google::Apis::PlacesV1::MapsPlacesService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
lib/google/apis/places_v1/service.rb

Overview

Places API (New)

Examples:

require 'google/apis/places_v1'

Places = Google::Apis::PlacesV1 # Alias the module
service = Places::MapsPlacesService.new

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMapsPlacesService

Returns a new instance of MapsPlacesService.



45
46
47
48
49
50
# File 'lib/google/apis/places_v1/service.rb', line 45

def initialize
  super('https://places.googleapis.com/', '',
        client_name: 'google-apis-places_v1',
        client_version: Google::Apis::PlacesV1::GEM_VERSION)
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



38
39
40
# File 'lib/google/apis/places_v1/service.rb', line 38

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



43
44
45
# File 'lib/google/apis/places_v1/service.rb', line 43

def quota_user
  @quota_user
end

Instance Method Details

#get_place(name, language_code: nil, region_code: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PlacesV1::GoogleMapsPlacesV1Place

Get place details with a place id (in a name) string.

Parameters:

  • name (String)

    Required. A place ID returned in a Place (with "places/" prefix), or equivalently the name in the same Place. Format: places/place_id.

  • language_code (String) (defaults to: nil)

    Optional. Place details will be displayed with the preferred language if available. Current list of supported languages: https://developers.google.com/ maps/faq#languagesupport.

  • region_code (String) (defaults to: nil)

    Optional. The Unicode country/region code (CLDR) of the location where the request is coming from. This parameter is used to display the place details, like region-specific place name, if available. The parameter can affect results based on applicable law. For more information, see https://www.unicode. org/cldr/charts/latest/supplemental/territory_language_information.html. Note that 3-digit region codes are not currently supported.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/google/apis/places_v1/service.rb', line 84

def get_place(name, language_code: nil, region_code: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::PlacesV1::GoogleMapsPlacesV1Place::Representation
  command.response_class = Google::Apis::PlacesV1::GoogleMapsPlacesV1Place
  command.params['name'] = name unless name.nil?
  command.query['languageCode'] = language_code unless language_code.nil?
  command.query['regionCode'] = region_code unless region_code.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_place_photo_media(name, max_height_px: nil, max_width_px: nil, skip_http_redirect: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PlacesV1::GoogleMapsPlacesV1PhotoMedia

Get a photo media with a photo reference string.

Parameters:

  • name (String)

    Required. The resource name of a photo media in the format: places/place_id/ photos/photo_reference/media. The resource name of a photo as returned in a Place object's photos.name field comes with the format places/place_id/photos/ photo_reference. You need to append /media at the end of the photo resource to get the photo media resource name.

  • max_height_px (Fixnum) (defaults to: nil)

    Optional. Specifies the maximum desired height, in pixels, of the image. If the image is smaller than the values specified, the original image will be returned. If the image is larger in either dimension, it will be scaled to match the smaller of the two dimensions, restricted to its original aspect ratio. Both the max_height_px and max_width_px properties accept an integer between 1 and 4800, inclusively. If the value is not within the allowed range, an INVALID_ARGUMENT error will be returned. At least one of max_height_px or max_width_px needs to be specified. If neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT error will be returned.

  • max_width_px (Fixnum) (defaults to: nil)

    Optional. Specifies the maximum desired width, in pixels, of the image. If the image is smaller than the values specified, the original image will be returned. If the image is larger in either dimension, it will be scaled to match the smaller of the two dimensions, restricted to its original aspect ratio. Both the max_height_px and max_width_px properties accept an integer between 1 and 4800, inclusively. If the value is not within the allowed range, an INVALID_ARGUMENT error will be returned. At least one of max_height_px or max_width_px needs to be specified. If neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT error will be returned.

  • skip_http_redirect (Boolean) (defaults to: nil)

    Optional. If set, skip the default HTTP redirect behavior and render a text format (for example, in JSON format for HTTP use case) response. If not set, an HTTP redirect will be issued to redirect the call to the image midea. This option is ignored for non-HTTP requests.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/google/apis/places_v1/service.rb', line 205

def get_place_photo_media(name, max_height_px: nil, max_width_px: nil, skip_http_redirect: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::PlacesV1::GoogleMapsPlacesV1PhotoMedia::Representation
  command.response_class = Google::Apis::PlacesV1::GoogleMapsPlacesV1PhotoMedia
  command.params['name'] = name unless name.nil?
  command.query['maxHeightPx'] = max_height_px unless max_height_px.nil?
  command.query['maxWidthPx'] = max_width_px unless max_width_px.nil?
  command.query['skipHttpRedirect'] = skip_http_redirect unless skip_http_redirect.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#search_place_nearby(google_maps_places_v1_search_nearby_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchNearbyResponse

Search for places near locations.

Parameters:

  • google_maps_places_v1_search_nearby_request_object (Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchNearbyRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



115
116
117
118
119
120
121
122
123
124
# File 'lib/google/apis/places_v1/service.rb', line 115

def search_place_nearby(google_maps_places_v1_search_nearby_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/places:searchNearby', options)
  command.request_representation = Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchNearbyRequest::Representation
  command.request_object = google_maps_places_v1_search_nearby_request_object
  command.response_representation = Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchNearbyResponse::Representation
  command.response_class = Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchNearbyResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#search_place_text(google_maps_places_v1_search_text_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchTextResponse

Text query based place search.

Parameters:

  • google_maps_places_v1_search_text_request_object (Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchTextRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



145
146
147
148
149
150
151
152
153
154
# File 'lib/google/apis/places_v1/service.rb', line 145

def search_place_text(google_maps_places_v1_search_text_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/places:searchText', options)
  command.request_representation = Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchTextRequest::Representation
  command.request_object = google_maps_places_v1_search_text_request_object
  command.response_representation = Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchTextResponse::Representation
  command.response_class = Google::Apis::PlacesV1::GoogleMapsPlacesV1SearchTextResponse
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end