Class: Google::Apis::MybusinessqandaV1::MyBusinessQAService

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

Overview

My Business Q&A API

The My Business Q&A API allows questions and answers to be posted for specific listings. Note - If you have a quota of 0 after enabling the API, please request for GBP API access.

Examples:

require 'google/apis/mybusinessqanda_v1'

Mybusinessqanda = Google::Apis::MybusinessqandaV1 # Alias the module
service = Mybusinessqanda::MyBusinessQAService.new

See Also:

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMyBusinessQAService

Returns a new instance of MyBusinessQAService.



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

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-mybusinessqanda_v1',
        client_version: Google::Apis::MybusinessqandaV1::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/mybusinessqanda_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/mybusinessqanda_v1/service.rb', line 47

def quota_user
  @quota_user
end

Instance Method Details

#create_location_question(parent, question_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MybusinessqandaV1::Question

Adds a question for the specified location.

Parameters:

  • parent (String)

    Required. The name of the location to write a question for.

  • question_object (Google::Apis::MybusinessqandaV1::Question) (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



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/google/apis/mybusinessqanda_v1/service.rb', line 77

def create_location_question(parent, question_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}', options)
  command.request_representation = Google::Apis::MybusinessqandaV1::Question::Representation
  command.request_object = question_object
  command.response_representation = Google::Apis::MybusinessqandaV1::Question::Representation
  command.response_class = Google::Apis::MybusinessqandaV1::Question
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_location_question(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MybusinessqandaV1::Empty

Deletes a specific question written by the current user.

Parameters:

  • name (String)

    Required. The name of the question to delete.

  • 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



109
110
111
112
113
114
115
116
117
# File 'lib/google/apis/mybusinessqanda_v1/service.rb', line 109

def delete_location_question(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v1/{+name}', options)
  command.response_representation = Google::Apis::MybusinessqandaV1::Empty::Representation
  command.response_class = Google::Apis::MybusinessqandaV1::Empty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_location_question_answer(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MybusinessqandaV1::Empty

Deletes the answer written by the current user to a question.

Parameters:

  • name (String)

    Required. The name of the question to delete an answer for.

  • 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



229
230
231
232
233
234
235
236
237
# File 'lib/google/apis/mybusinessqanda_v1/service.rb', line 229

def delete_location_question_answer(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v1/{+name}/answers:delete', options)
  command.response_representation = Google::Apis::MybusinessqandaV1::Empty::Representation
  command.response_class = Google::Apis::MybusinessqandaV1::Empty
  command.params['name'] = name unless name.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_question_answers(parent, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MybusinessqandaV1::ListAnswersResponse

Returns the paginated list of answers for a specified question.

Parameters:

  • parent (String)

    Required. The name of the question to fetch answers for.

  • order_by (String) (defaults to: nil)

    Optional. The order to return the answers. Valid options include 'update_time desc' and 'upvote_count desc', which will return the answers sorted descendingly by the requested field. The default sort order is 'update_time desc'.

  • page_size (Fixnum) (defaults to: nil)

    Optional. How many answers to fetch per page. The default and maximum page_size values are 10.

  • page_token (String) (defaults to: nil)

    Optional. If specified, the next page of answers is retrieved.

  • 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



269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/google/apis/mybusinessqanda_v1/service.rb', line 269

def list_location_question_answers(parent, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+parent}/answers', options)
  command.response_representation = Google::Apis::MybusinessqandaV1::ListAnswersResponse::Representation
  command.response_class = Google::Apis::MybusinessqandaV1::ListAnswersResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['orderBy'] = order_by unless order_by.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

#list_location_questions(parent, answers_per_question: nil, filter: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MybusinessqandaV1::ListQuestionsResponse

Returns the paginated list of questions and some of its answers for a specified location. This operation is only valid if the specified location is verified.

Parameters:

  • parent (String)

    Required. The name of the location to fetch questions for.

  • answers_per_question (Fixnum) (defaults to: nil)

    Optional. How many answers to fetch per question. The default and maximum answers_per_question values are 10.

  • filter (String) (defaults to: nil)

    Optional. A filter constraining the questions to return. The only filter currently supported is "ignore_answered=true"

  • order_by (String) (defaults to: nil)

    Optional. The order to return the questions. Valid options include ' update_time desc' and 'upvote_count desc', which will return the questions sorted descendingly by the requested field. The default sort order is ' update_time desc'.

  • page_size (Fixnum) (defaults to: nil)

    Optional. How many questions to fetch per page. The default and maximum page_size values are 10.

  • page_token (String) (defaults to: nil)

    Optional. If specified, the next page of questions is retrieved.

  • 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



157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/google/apis/mybusinessqanda_v1/service.rb', line 157

def list_location_questions(parent, answers_per_question: nil, filter: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+parent}', options)
  command.response_representation = Google::Apis::MybusinessqandaV1::ListQuestionsResponse::Representation
  command.response_class = Google::Apis::MybusinessqandaV1::ListQuestionsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['answersPerQuestion'] = answers_per_question unless answers_per_question.nil?
  command.query['filter'] = filter unless filter.nil?
  command.query['orderBy'] = order_by unless order_by.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

#patch_location_question(name, question_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MybusinessqandaV1::Question

Updates a specific question written by the current user.

Parameters:

  • name (String)

    Immutable. The unique name for the question. locations//questions/ This field will be ignored if set during question creation.

  • question_object (Google::Apis::MybusinessqandaV1::Question) (defaults to: nil)
  • update_mask (String) (defaults to: nil)

    Required. The specific fields to update. Only question text can be updated.

  • 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



196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/google/apis/mybusinessqanda_v1/service.rb', line 196

def patch_location_question(name, question_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v1/{+name}', options)
  command.request_representation = Google::Apis::MybusinessqandaV1::Question::Representation
  command.request_object = question_object
  command.response_representation = Google::Apis::MybusinessqandaV1::Question::Representation
  command.response_class = Google::Apis::MybusinessqandaV1::Question
  command.params['name'] = name unless name.nil?
  command.query['updateMask'] = update_mask unless update_mask.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#upsert_answer(parent, upsert_answer_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MybusinessqandaV1::Answer

Creates an answer or updates the existing answer written by the user for the specified question. A user can only create one answer per question.

Parameters:

  • parent (String)

    Required. The name of the question to write an answer for.

  • upsert_answer_request_object (Google::Apis::MybusinessqandaV1::UpsertAnswerRequest) (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



304
305
306
307
308
309
310
311
312
313
314
# File 'lib/google/apis/mybusinessqanda_v1/service.rb', line 304

def upsert_answer(parent, upsert_answer_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}/answers:upsert', options)
  command.request_representation = Google::Apis::MybusinessqandaV1::UpsertAnswerRequest::Representation
  command.request_object = upsert_answer_request_object
  command.response_representation = Google::Apis::MybusinessqandaV1::Answer::Representation
  command.response_class = Google::Apis::MybusinessqandaV1::Answer
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end