Class: Google::Apis::SurveysV2::SurveysService

Inherits:
Core::BaseService show all
Defined in:
generated/google/apis/surveys_v2/service.rb

Overview

Surveys API

Creates and conducts surveys, lists the surveys that an authenticated user owns, and retrieves survey results and information about specified surveys.

Examples:

require 'google/apis/surveys_v2'

Surveys = Google::Apis::SurveysV2 # Alias the module
service = Surveys::SurveysService.new

Instance Attribute Summary collapse

Attributes inherited from Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Core::Logging

#logger

Constructor Details

#initializeSurveysService

Returns a new instance of SurveysService



49
50
51
52
# File 'generated/google/apis/surveys_v2/service.rb', line 49

def initialize
  super('https://www.googleapis.com/', 'surveys/v2/')
  @batch_path = 'batch/surveys/v2'
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 'generated/google/apis/surveys_v2/service.rb', line 38

def key
  @key
end

#quota_userString

Returns An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

Returns:

  • (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.



43
44
45
# File 'generated/google/apis/surveys_v2/service.rb', line 43

def quota_user
  @quota_user
end

#user_ipString

Returns Deprecated. Please use quotaUser instead.

Returns:

  • (String)

    Deprecated. Please use quotaUser instead.



47
48
49
# File 'generated/google/apis/surveys_v2/service.rb', line 47

def user_ip
  @user_ip
end

Instance Method Details

#delete_survey(survey_url_id, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::SurveysDeleteResponse

Removes a survey from view in all user GET requests.

Parameters:

  • survey_url_id (String)

    External URL ID for the survey.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



121
122
123
124
125
126
127
128
129
130
# File 'generated/google/apis/surveys_v2/service.rb', line 121

def delete_survey(survey_url_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:delete, 'surveys/{surveyUrlId}', options)
  command.response_representation = Google::Apis::SurveysV2::SurveysDeleteResponse::Representation
  command.response_class = Google::Apis::SurveysV2::SurveysDeleteResponse
  command.params['surveyUrlId'] = survey_url_id unless survey_url_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#get_result(survey_url_id, results_get_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, download_dest: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::SurveyResults

Retrieves any survey results that have been produced so far. Results are formatted as an Excel file. You must add "?alt=media" to the URL as an argument to get results.

Parameters:

  • survey_url_id (String)

    External URL ID for the survey.

  • results_get_request_object (Google::Apis::SurveysV2::ResultsGetRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • download_dest (IO, String)

    IO stream or filename to receive content download

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'generated/google/apis/surveys_v2/service.rb', line 81

def get_result(survey_url_id, results_get_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, download_dest: nil, options: nil, &block)
  if download_dest.nil?
    command =  make_simple_command(:get, 'surveys/{surveyUrlId}/results', options)
  else
    command = make_download_command(:get, 'surveys/{surveyUrlId}/results', options)
    command.download_dest = download_dest
  end
  command.request_representation = Google::Apis::SurveysV2::ResultsGetRequest::Representation
  command.request_object = results_get_request_object
  command.response_representation = Google::Apis::SurveysV2::SurveyResults::Representation
  command.response_class = Google::Apis::SurveysV2::SurveyResults
  command.params['surveyUrlId'] = survey_url_id unless survey_url_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#get_survey(survey_url_id, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::Survey

Retrieves information about the specified survey.

Parameters:

  • survey_url_id (String)

    External URL ID for the survey.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



154
155
156
157
158
159
160
161
162
163
# File 'generated/google/apis/surveys_v2/service.rb', line 154

def get_survey(survey_url_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'surveys/{surveyUrlId}', options)
  command.response_representation = Google::Apis::SurveysV2::Survey::Representation
  command.response_class = Google::Apis::SurveysV2::Survey
  command.params['surveyUrlId'] = survey_url_id unless survey_url_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#insert_survey(survey_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::Survey

Creates a survey.

Parameters:

  • survey_object (Google::Apis::SurveysV2::Survey) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



186
187
188
189
190
191
192
193
194
195
196
# File 'generated/google/apis/surveys_v2/service.rb', line 186

def insert_survey(survey_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:post, 'surveys', options)
  command.request_representation = Google::Apis::SurveysV2::Survey::Representation
  command.request_object = survey_object
  command.response_representation = Google::Apis::SurveysV2::Survey::Representation
  command.response_class = Google::Apis::SurveysV2::Survey
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_surveys(max_results: nil, start_index: nil, token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::SurveysListResponse

Lists the surveys owned by the authenticated user.

Parameters:

  • max_results (Fixnum)
  • start_index (Fixnum)
  • token (String)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



221
222
223
224
225
226
227
228
229
230
231
232
# File 'generated/google/apis/surveys_v2/service.rb', line 221

def list_surveys(max_results: nil, start_index: nil, token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'surveys', options)
  command.response_representation = Google::Apis::SurveysV2::SurveysListResponse::Representation
  command.response_class = Google::Apis::SurveysV2::SurveysListResponse
  command.query['maxResults'] = max_results unless max_results.nil?
  command.query['startIndex'] = start_index unless start_index.nil?
  command.query['token'] = token unless token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#start_survey(resource_id, surveys_start_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::SurveysStartResponse

Begins running a survey.

Parameters:

  • resource_id (String)
  • surveys_start_request_object (Google::Apis::SurveysV2::SurveysStartRequest) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



256
257
258
259
260
261
262
263
264
265
266
267
# File 'generated/google/apis/surveys_v2/service.rb', line 256

def start_survey(resource_id, surveys_start_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:post, 'surveys/{resourceId}/start', options)
  command.request_representation = Google::Apis::SurveysV2::SurveysStartRequest::Representation
  command.request_object = surveys_start_request_object
  command.response_representation = Google::Apis::SurveysV2::SurveysStartResponse::Representation
  command.response_class = Google::Apis::SurveysV2::SurveysStartResponse
  command.params['resourceId'] = resource_id unless resource_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#stop_survey(resource_id, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::SurveysStopResponse

Stops a running survey.

Parameters:

  • resource_id (String)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



290
291
292
293
294
295
296
297
298
299
# File 'generated/google/apis/surveys_v2/service.rb', line 290

def stop_survey(resource_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:post, 'surveys/{resourceId}/stop', options)
  command.response_representation = Google::Apis::SurveysV2::SurveysStopResponse::Representation
  command.response_class = Google::Apis::SurveysV2::SurveysStopResponse
  command.params['resourceId'] = resource_id unless resource_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#update_survey(survey_url_id, survey_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::Survey

Updates a survey. Currently the only property that can be updated is the owners property.

Parameters:

  • survey_url_id (String)

    External URL ID for the survey.

  • survey_object (Google::Apis::SurveysV2::Survey) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    An opaque string that represents a user for quota purposes. Must not exceed 40 characters.

  • user_ip (String)

    Deprecated. Please use quotaUser instead.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



325
326
327
328
329
330
331
332
333
334
335
336
# File 'generated/google/apis/surveys_v2/service.rb', line 325

def update_survey(survey_url_id, survey_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:put, 'surveys/{surveyUrlId}', options)
  command.request_representation = Google::Apis::SurveysV2::Survey::Representation
  command.request_object = survey_object
  command.response_representation = Google::Apis::SurveysV2::Survey::Representation
  command.response_class = Google::Apis::SurveysV2::Survey
  command.params['surveyUrlId'] = survey_url_id unless survey_url_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end