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



51
52
53
54
# File 'generated/google/apis/surveys_v2/service.rb', line 51

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 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. Overrides userIp if both are provided.

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. Overrides userIp if both are provided.



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

def quota_user
  @quota_user
end

#user_ipString

Returns IP address of the site where the request originates. Use this if you want to enforce per-user limits.

Returns:

  • (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.



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

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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



239
240
241
242
243
244
245
246
247
248
# File 'generated/google/apis/surveys_v2/service.rb', line 239

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_mobileapppanel(panel_id, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::MobileAppPanel

Retrieves a MobileAppPanel that is available to the authenticated user.

Parameters:

  • panel_id (String)

    External URL ID for the panel.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



80
81
82
83
84
85
86
87
88
89
# File 'generated/google/apis/surveys_v2/service.rb', line 80

def get_mobileapppanel(panel_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'mobileAppPanels/{panelId}', options)
  command.response_representation = Google::Apis::SurveysV2::MobileAppPanel::Representation
  command.response_class = Google::Apis::SurveysV2::MobileAppPanel
  command.params['panelId'] = panel_id unless panel_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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • 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:



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'generated/google/apis/surveys_v2/service.rb', line 197

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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



274
275
276
277
278
279
280
281
282
283
# File 'generated/google/apis/surveys_v2/service.rb', line 274

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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



308
309
310
311
312
313
314
315
316
317
318
# File 'generated/google/apis/surveys_v2/service.rb', line 308

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_mobileapppanels(max_results: nil, start_index: nil, token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::MobileAppPanelsListResponse

Lists the MobileAppPanels available to 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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



116
117
118
119
120
121
122
123
124
125
126
127
# File 'generated/google/apis/surveys_v2/service.rb', line 116

def list_mobileapppanels(max_results: nil, start_index: nil, token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'mobileAppPanels', options)
  command.response_representation = Google::Apis::SurveysV2::MobileAppPanelsListResponse::Representation
  command.response_class = Google::Apis::SurveysV2::MobileAppPanelsListResponse
  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

#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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



345
346
347
348
349
350
351
352
353
354
355
356
# File 'generated/google/apis/surveys_v2/service.rb', line 345

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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



382
383
384
385
386
387
388
389
390
391
392
393
# File 'generated/google/apis/surveys_v2/service.rb', line 382

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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



418
419
420
421
422
423
424
425
426
427
# File 'generated/google/apis/surveys_v2/service.rb', line 418

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_mobileapppanel(panel_id, mobile_app_panel_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::SurveysV2::MobileAppPanel

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

Parameters:

  • panel_id (String)

    External URL ID for the panel.

  • mobile_app_panel_object (Google::Apis::SurveysV2::MobileAppPanel) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



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

def update_mobileapppanel(panel_id, mobile_app_panel_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:put, 'mobileAppPanels/{panelId}', options)
  command.request_representation = Google::Apis::SurveysV2::MobileAppPanel::Representation
  command.request_object = mobile_app_panel_object
  command.response_representation = Google::Apis::SurveysV2::MobileAppPanel::Representation
  command.response_class = Google::Apis::SurveysV2::MobileAppPanel
  command.params['panelId'] = panel_id unless panel_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)

    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. Overrides userIp if both are provided.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



455
456
457
458
459
460
461
462
463
464
465
466
# File 'generated/google/apis/surveys_v2/service.rb', line 455

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