Class: Google::Apis::BusinessprofileperformanceV1::BusinessProfilePerformanceService

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

Overview

Business Profile Performance API

The Business Profile Performance API allows merchants to fetch performance reports about their business profile on Google. Note - If you have a quota of 0 after enabling the API, please request for GBP API access.

Examples:

require 'google/apis/businessprofileperformance_v1'

Businessprofileperformance = Google::Apis::BusinessprofileperformanceV1 # Alias the module
service = Businessprofileperformance::BusinessProfilePerformanceService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://businessprofileperformance.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBusinessProfilePerformanceService

Returns a new instance of BusinessProfilePerformanceService.



49
50
51
52
53
54
# File 'lib/google/apis/businessprofileperformance_v1/service.rb', line 49

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-businessprofileperformance_v1',
        client_version: Google::Apis::BusinessprofileperformanceV1::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.



42
43
44
# File 'lib/google/apis/businessprofileperformance_v1/service.rb', line 42

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.



47
48
49
# File 'lib/google/apis/businessprofileperformance_v1/service.rb', line 47

def quota_user
  @quota_user
end

Instance Method Details

#fetch_location_multi_daily_metrics_time_series(location, daily_metrics: nil, daily_range_end_date_day: nil, daily_range_end_date_month: nil, daily_range_end_date_year: nil, daily_range_start_date_day: nil, daily_range_start_date_month: nil, daily_range_start_date_year: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BusinessprofileperformanceV1::FetchMultiDailyMetricsTimeSeriesResponse

Returns the values for each date from a given time range and optionally the sub entity type, where applicable, that are associated with the specific daily metrics. Example request: GET https://businessprofileperformance.googleapis. com/v1/locations/12345:fetchMultiDailyMetricsTimeSeries?dailyMetrics= WEBSITE_CLICKS&dailyMetrics=CALL_CLICKS&daily_range.start_date.year=2022& daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range. end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31

Parameters:

  • location (String)

    Required. The location for which the time series should be fetched. Format: locations/location_id where location_id is an unobfuscated listing id.

  • daily_metrics (Array<String>, String) (defaults to: nil)

    Required. The metrics to retrieve time series for.

  • daily_range_end_date_day (Fixnum) (defaults to: nil)

    Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.

  • daily_range_end_date_month (Fixnum) (defaults to: nil)

    Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.

  • daily_range_end_date_year (Fixnum) (defaults to: nil)

    Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.

  • daily_range_start_date_day (Fixnum) (defaults to: nil)

    Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.

  • daily_range_start_date_month (Fixnum) (defaults to: nil)

    Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.

  • daily_range_start_date_year (Fixnum) (defaults to: nil)

    Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.

  • 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



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/google/apis/businessprofileperformance_v1/service.rb', line 103

def fetch_location_multi_daily_metrics_time_series(location, daily_metrics: nil, daily_range_end_date_day: nil, daily_range_end_date_month: nil, daily_range_end_date_year: nil, daily_range_start_date_day: nil, daily_range_start_date_month: nil, daily_range_start_date_year: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+location}:fetchMultiDailyMetricsTimeSeries', options)
  command.response_representation = Google::Apis::BusinessprofileperformanceV1::FetchMultiDailyMetricsTimeSeriesResponse::Representation
  command.response_class = Google::Apis::BusinessprofileperformanceV1::FetchMultiDailyMetricsTimeSeriesResponse
  command.params['location'] = location unless location.nil?
  command.query['dailyMetrics'] = daily_metrics unless daily_metrics.nil?
  command.query['dailyRange.endDate.day'] = daily_range_end_date_day unless daily_range_end_date_day.nil?
  command.query['dailyRange.endDate.month'] = daily_range_end_date_month unless daily_range_end_date_month.nil?
  command.query['dailyRange.endDate.year'] = daily_range_end_date_year unless daily_range_end_date_year.nil?
  command.query['dailyRange.startDate.day'] = daily_range_start_date_day unless daily_range_start_date_day.nil?
  command.query['dailyRange.startDate.month'] = daily_range_start_date_month unless daily_range_start_date_month.nil?
  command.query['dailyRange.startDate.year'] = daily_range_start_date_year unless daily_range_start_date_year.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_location_daily_metrics_time_series(name, daily_metric: nil, daily_range_end_date_day: nil, daily_range_end_date_month: nil, daily_range_end_date_year: nil, daily_range_start_date_day: nil, daily_range_start_date_month: nil, daily_range_start_date_year: nil, daily_sub_entity_type_day_of_week: nil, daily_sub_entity_type_time_of_day_hours: nil, daily_sub_entity_type_time_of_day_minutes: nil, daily_sub_entity_type_time_of_day_nanos: nil, daily_sub_entity_type_time_of_day_seconds: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BusinessprofileperformanceV1::GetDailyMetricsTimeSeriesResponse

Returns the values for each date from a given time range that are associated with the specific daily metric. Example request: GET https:// businessprofileperformance.googleapis.com/v1/locations/12345: getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS&daily_range.start_date. year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1& daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range. end_date.day=31

Parameters:

  • name (String)

    Required. The location for which the time series should be fetched. Format: locations/location_id where location_id is an unobfuscated listing id.

  • daily_metric (String) (defaults to: nil)

    Required. The metric to retrieve time series.

  • daily_range_end_date_day (Fixnum) (defaults to: nil)

    Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.

  • daily_range_end_date_month (Fixnum) (defaults to: nil)

    Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.

  • daily_range_end_date_year (Fixnum) (defaults to: nil)

    Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.

  • daily_range_start_date_day (Fixnum) (defaults to: nil)

    Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.

  • daily_range_start_date_month (Fixnum) (defaults to: nil)

    Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.

  • daily_range_start_date_year (Fixnum) (defaults to: nil)

    Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.

  • daily_sub_entity_type_day_of_week (String) (defaults to: nil)

    Represents the day of the week. Eg: MONDAY. Currently supported DailyMetrics = NONE.

  • daily_sub_entity_type_time_of_day_hours (Fixnum) (defaults to: nil)

    Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.

  • daily_sub_entity_type_time_of_day_minutes (Fixnum) (defaults to: nil)

    Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.

  • daily_sub_entity_type_time_of_day_nanos (Fixnum) (defaults to: nil)

    Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.

  • daily_sub_entity_type_time_of_day_seconds (Fixnum) (defaults to: nil)

    Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap- seconds.

  • 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



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/google/apis/businessprofileperformance_v1/service.rb', line 184

def get_location_daily_metrics_time_series(name, daily_metric: nil, daily_range_end_date_day: nil, daily_range_end_date_month: nil, daily_range_end_date_year: nil, daily_range_start_date_day: nil, daily_range_start_date_month: nil, daily_range_start_date_year: nil, daily_sub_entity_type_day_of_week: nil, daily_sub_entity_type_time_of_day_hours: nil, daily_sub_entity_type_time_of_day_minutes: nil, daily_sub_entity_type_time_of_day_nanos: nil, daily_sub_entity_type_time_of_day_seconds: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}:getDailyMetricsTimeSeries', options)
  command.response_representation = Google::Apis::BusinessprofileperformanceV1::GetDailyMetricsTimeSeriesResponse::Representation
  command.response_class = Google::Apis::BusinessprofileperformanceV1::GetDailyMetricsTimeSeriesResponse
  command.params['name'] = name unless name.nil?
  command.query['dailyMetric'] = daily_metric unless daily_metric.nil?
  command.query['dailyRange.endDate.day'] = daily_range_end_date_day unless daily_range_end_date_day.nil?
  command.query['dailyRange.endDate.month'] = daily_range_end_date_month unless daily_range_end_date_month.nil?
  command.query['dailyRange.endDate.year'] = daily_range_end_date_year unless daily_range_end_date_year.nil?
  command.query['dailyRange.startDate.day'] = daily_range_start_date_day unless daily_range_start_date_day.nil?
  command.query['dailyRange.startDate.month'] = daily_range_start_date_month unless daily_range_start_date_month.nil?
  command.query['dailyRange.startDate.year'] = daily_range_start_date_year unless daily_range_start_date_year.nil?
  command.query['dailySubEntityType.dayOfWeek'] = daily_sub_entity_type_day_of_week unless daily_sub_entity_type_day_of_week.nil?
  command.query['dailySubEntityType.timeOfDay.hours'] = daily_sub_entity_type_time_of_day_hours unless daily_sub_entity_type_time_of_day_hours.nil?
  command.query['dailySubEntityType.timeOfDay.minutes'] = daily_sub_entity_type_time_of_day_minutes unless daily_sub_entity_type_time_of_day_minutes.nil?
  command.query['dailySubEntityType.timeOfDay.nanos'] = daily_sub_entity_type_time_of_day_nanos unless daily_sub_entity_type_time_of_day_nanos.nil?
  command.query['dailySubEntityType.timeOfDay.seconds'] = daily_sub_entity_type_time_of_day_seconds unless daily_sub_entity_type_time_of_day_seconds.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_location_searchkeyword_impression_monthlies(parent, monthly_range_end_month_day: nil, monthly_range_end_month_month: nil, monthly_range_end_month_year: nil, monthly_range_start_month_day: nil, monthly_range_start_month_month: nil, monthly_range_start_month_year: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BusinessprofileperformanceV1::ListSearchKeywordImpressionsMonthlyResponse

Returns the search keywords used to find a business in search or maps. Each search keyword is accompanied by impressions which are aggregated on a monthly basis. Example request: GET https://businessprofileperformance.googleapis.com/ v1/locations/12345/searchkeywords/impressions/monthly?monthly_range. start_month.year=2022&monthly_range.start_month.month=1&monthly_range. end_month.year=2022&monthly_range.end_month.month=3

Parameters:

  • parent (String)

    Required. The location for which the time series should be fetched. Format: locations/location_id where location_id is an unobfuscated listing id.

  • monthly_range_end_month_day (Fixnum) (defaults to: nil)

    Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.

  • monthly_range_end_month_month (Fixnum) (defaults to: nil)

    Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.

  • monthly_range_end_month_year (Fixnum) (defaults to: nil)

    Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.

  • monthly_range_start_month_day (Fixnum) (defaults to: nil)

    Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.

  • monthly_range_start_month_month (Fixnum) (defaults to: nil)

    Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.

  • monthly_range_start_month_year (Fixnum) (defaults to: nil)

    Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.

  • page_size (Fixnum) (defaults to: nil)

    Optional. The number of results requested. The default page size is 100. Page size can be set to a maximum of 100.

  • page_token (String) (defaults to: nil)

    Optional. A token indicating the next paginated result to be returned.

  • 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



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/google/apis/businessprofileperformance_v1/service.rb', line 255

def list_location_searchkeyword_impression_monthlies(parent, monthly_range_end_month_day: nil, monthly_range_end_month_month: nil, monthly_range_end_month_year: nil, monthly_range_start_month_day: nil, monthly_range_start_month_month: nil, monthly_range_start_month_year: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+parent}/searchkeywords/impressions/monthly', options)
  command.response_representation = Google::Apis::BusinessprofileperformanceV1::ListSearchKeywordImpressionsMonthlyResponse::Representation
  command.response_class = Google::Apis::BusinessprofileperformanceV1::ListSearchKeywordImpressionsMonthlyResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['monthlyRange.endMonth.day'] = monthly_range_end_month_day unless monthly_range_end_month_day.nil?
  command.query['monthlyRange.endMonth.month'] = monthly_range_end_month_month unless monthly_range_end_month_month.nil?
  command.query['monthlyRange.endMonth.year'] = monthly_range_end_month_year unless monthly_range_end_month_year.nil?
  command.query['monthlyRange.startMonth.day'] = monthly_range_start_month_day unless monthly_range_start_month_day.nil?
  command.query['monthlyRange.startMonth.month'] = monthly_range_start_month_month unless monthly_range_start_month_month.nil?
  command.query['monthlyRange.startMonth.year'] = monthly_range_start_month_year unless monthly_range_start_month_year.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end