class Google::Apis::MybusinessqandaV1::MyBusinessQAService

My Business Q&A API

The My Business Q&A API allows questions and answers to be posted for specific

listings.

@example

require 'google/apis/mybusinessqanda_v1'

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

@see developers.google.com/my-business/

Attributes

key[RW]

@return [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.
quota_user[RW]

@return [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.

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/google/apis/mybusinessqanda_v1/service.rb, line 46
def initialize
  super('https://mybusinessqanda.googleapis.com/', '',
        client_name: 'google-apis-mybusinessqanda_v1',
        client_version: Google::Apis::MybusinessqandaV1::GEM_VERSION)
  @batch_path = 'batch'
end

Public Instance Methods

create_location_question(parent, question_object = nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Adds a question for the specified location. @param [String] parent

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

@param [Google::Apis::MybusinessqandaV1::Question] question_object @param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

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.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::MybusinessqandaV1::Question] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::MybusinessqandaV1::Question]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/mybusinessqanda_v1/service.rb, line 74
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, &block) click to toggle source

Deletes a specific question written by the current user. @param [String] name

Required. The name of the question to delete.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

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.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::MybusinessqandaV1::Empty] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::MybusinessqandaV1::Empty]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/mybusinessqanda_v1/service.rb, line 106
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, &block) click to toggle source

Deletes the answer written by the current user to a question. @param [String] name

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

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

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.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::MybusinessqandaV1::Empty] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::MybusinessqandaV1::Empty]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/mybusinessqanda_v1/service.rb, line 226
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, &block) click to toggle source

Returns the paginated list of answers for a specified question. @param [String] parent

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

@param [String] order_by

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'.

@param [Fixnum] page_size

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

@param [String] page_token

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

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

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.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::MybusinessqandaV1::ListAnswersResponse] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::MybusinessqandaV1::ListAnswersResponse]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/mybusinessqanda_v1/service.rb, line 266
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, &block) click to toggle source

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. @param [String] parent

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

@param [Fixnum] answers_per_question

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

@param [String] filter

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

@param [String] order_by

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'.

@param [Fixnum] page_size

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

@param [String] page_token

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

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

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.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::MybusinessqandaV1::ListQuestionsResponse] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::MybusinessqandaV1::ListQuestionsResponse]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/mybusinessqanda_v1/service.rb, line 154
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, &block) click to toggle source

Updates a specific question written by the current user. @param [String] name

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

@param [Google::Apis::MybusinessqandaV1::Question] question_object @param [String] update_mask

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

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

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.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::MybusinessqandaV1::Question] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::MybusinessqandaV1::Question]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/mybusinessqanda_v1/service.rb, line 193
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, &block) click to toggle source

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. @param [String] parent

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

@param [Google::Apis::MybusinessqandaV1::UpsertAnswerRequest] upsert_answer_request_object @param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

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.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::MybusinessqandaV1::Answer] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::MybusinessqandaV1::Answer]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/mybusinessqanda_v1/service.rb, line 301
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

Protected Instance Methods

apply_command_defaults(command) click to toggle source
# File lib/google/apis/mybusinessqanda_v1/service.rb, line 315
def apply_command_defaults(command)
  command.query['key'] = key unless key.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
end