Class: Google::Apis::FormsV1::FormsService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::FormsV1::FormsService
- Defined in:
- lib/google/apis/forms_v1/service.rb
Overview
Google Forms API
Reads and writes Google Forms and responses.
Constant Summary collapse
- DEFAULT_ENDPOINT_TEMPLATE =
"https://forms.$UNIVERSE_DOMAIN$/"
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Instance Method Summary collapse
-
#batch_update_form(form_id, batch_update_form_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::BatchUpdateFormResponse
Change the form with a batch of updates.
-
#create_form(form_object = nil, unpublished: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Form
Create a new form using the title given in the provided form message in the request.
-
#create_watch(form_id, create_watch_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Watch
Create a new watch.
-
#delete_form_watch(form_id, watch_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Empty
Delete a watch.
-
#get_form(form_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Form
Get a form.
-
#get_form_response(form_id, response_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::FormResponse
Get one response from the form.
-
#initialize ⇒ FormsService
constructor
A new instance of FormsService.
-
#list_form_responses(form_id, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::ListFormResponsesResponse
List a form's responses.
-
#list_form_watches(form_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::ListWatchesResponse
Return a list of the watches owned by the invoking project.
-
#renew_watch(form_id, watch_id, renew_watch_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Watch
Renew an existing watch for seven days.
-
#set_form_publish_settings(form_id, set_publish_settings_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::SetPublishSettingsResponse
Updates the publish settings of a form.
Constructor Details
#initialize ⇒ FormsService
Returns a new instance of FormsService.
47 48 49 50 51 52 |
# File 'lib/google/apis/forms_v1/service.rb', line 47 def initialize super(DEFAULT_ENDPOINT_TEMPLATE, '', client_name: 'google-apis-forms_v1', client_version: Google::Apis::FormsV1::GEM_VERSION) @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
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.
40 41 42 |
# File 'lib/google/apis/forms_v1/service.rb', line 40 def key @key end |
#quota_user ⇒ String
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.
45 46 47 |
# File 'lib/google/apis/forms_v1/service.rb', line 45 def quota_user @quota_user end |
Instance Method Details
#batch_update_form(form_id, batch_update_form_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::BatchUpdateFormResponse
Change the form with a batch of updates.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/google/apis/forms_v1/service.rb', line 75 def batch_update_form(form_id, batch_update_form_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/forms/{formId}:batchUpdate', ) command.request_representation = Google::Apis::FormsV1::BatchUpdateFormRequest::Representation command.request_object = batch_update_form_request_object command.response_representation = Google::Apis::FormsV1::BatchUpdateFormResponse::Representation command.response_class = Google::Apis::FormsV1::BatchUpdateFormResponse command.params['formId'] = form_id unless form_id.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#create_form(form_object = nil, unpublished: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Form
Create a new form using the title given in the provided form message in the request. Important: Only the form.info.title and form.info.document_title fields are copied to the new form. All other fields including the form description, items and settings are disallowed. To create a new form and add items, you must first call forms.create to create an empty form with a title and (optional) document title, and then call forms.update to add the items.
115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/google/apis/forms_v1/service.rb', line 115 def create_form(form_object = nil, unpublished: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/forms', ) command.request_representation = Google::Apis::FormsV1::Form::Representation command.request_object = form_object command.response_representation = Google::Apis::FormsV1::Form::Representation command.response_class = Google::Apis::FormsV1::Form command.query['unpublished'] = unpublished unless unpublished.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#create_watch(form_id, create_watch_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Watch
Create a new watch. If a watch ID is provided, it must be unused. For each invoking project, the per form limit is one watch per Watch.EventType. A watch expires seven days after it is created (see Watch.expire_time).
293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/google/apis/forms_v1/service.rb', line 293 def create_watch(form_id, create_watch_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/forms/{formId}/watches', ) command.request_representation = Google::Apis::FormsV1::CreateWatchRequest::Representation command.request_object = create_watch_request_object command.response_representation = Google::Apis::FormsV1::Watch::Representation command.response_class = Google::Apis::FormsV1::Watch command.params['formId'] = form_id unless form_id.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_form_watch(form_id, watch_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Empty
Delete a watch.
327 328 329 330 331 332 333 334 335 336 |
# File 'lib/google/apis/forms_v1/service.rb', line 327 def delete_form_watch(form_id, watch_id, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:delete, 'v1/forms/{formId}/watches/{watchId}', ) command.response_representation = Google::Apis::FormsV1::Empty::Representation command.response_class = Google::Apis::FormsV1::Empty command.params['formId'] = form_id unless form_id.nil? command.params['watchId'] = watch_id unless watch_id.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_form(form_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Form
Get a form.
147 148 149 150 151 152 153 154 155 |
# File 'lib/google/apis/forms_v1/service.rb', line 147 def get_form(form_id, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/forms/{formId}', ) command.response_representation = Google::Apis::FormsV1::Form::Representation command.response_class = Google::Apis::FormsV1::Form command.params['formId'] = form_id unless form_id.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_form_response(form_id, response_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::FormResponse
Get one response from the form.
213 214 215 216 217 218 219 220 221 222 |
# File 'lib/google/apis/forms_v1/service.rb', line 213 def get_form_response(form_id, response_id, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/forms/{formId}/responses/{responseId}', ) command.response_representation = Google::Apis::FormsV1::FormResponse::Representation command.response_class = Google::Apis::FormsV1::FormResponse command.params['formId'] = form_id unless form_id.nil? command.params['responseId'] = response_id unless response_id.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_form_responses(form_id, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::ListFormResponsesResponse
List a form's responses.
257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/google/apis/forms_v1/service.rb', line 257 def list_form_responses(form_id, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/forms/{formId}/responses', ) command.response_representation = Google::Apis::FormsV1::ListFormResponsesResponse::Representation command.response_class = Google::Apis::FormsV1::ListFormResponsesResponse command.params['formId'] = form_id unless form_id.nil? command.query['filter'] = filter unless filter.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_form_watches(form_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::ListWatchesResponse
Return a list of the watches owned by the invoking project. The maximum number of watches is two: For each invoker, the limit is one for each event type per form.
360 361 362 363 364 365 366 367 368 |
# File 'lib/google/apis/forms_v1/service.rb', line 360 def list_form_watches(form_id, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v1/forms/{formId}/watches', ) command.response_representation = Google::Apis::FormsV1::ListWatchesResponse::Representation command.response_class = Google::Apis::FormsV1::ListWatchesResponse command.params['formId'] = form_id unless form_id.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#renew_watch(form_id, watch_id, renew_watch_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::Watch
Renew an existing watch for seven days. The state of the watch after renewal
is ACTIVE, and the expire_time is seven days from the renewal. Renewing a
watch in an error state (e.g. SUSPENDED) succeeds if the error is no longer
present, but fail otherwise. After a watch has expired, RenewWatch returns
NOT_FOUND.
397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/google/apis/forms_v1/service.rb', line 397 def renew_watch(form_id, watch_id, renew_watch_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/forms/{formId}/watches/{watchId}:renew', ) command.request_representation = Google::Apis::FormsV1::RenewWatchRequest::Representation command.request_object = renew_watch_request_object command.response_representation = Google::Apis::FormsV1::Watch::Representation command.response_class = Google::Apis::FormsV1::Watch command.params['formId'] = form_id unless form_id.nil? command.params['watchId'] = watch_id unless watch_id.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#set_form_publish_settings(form_id, set_publish_settings_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::FormsV1::SetPublishSettingsResponse
Updates the publish settings of a form. Legacy forms aren't supported because
they don't have the publish_settings field.
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/google/apis/forms_v1/service.rb', line 179 def set_form_publish_settings(form_id, set_publish_settings_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/forms/{formId}:setPublishSettings', ) command.request_representation = Google::Apis::FormsV1::SetPublishSettingsRequest::Representation command.request_object = set_publish_settings_request_object command.response_representation = Google::Apis::FormsV1::SetPublishSettingsResponse::Representation command.response_class = Google::Apis::FormsV1::SetPublishSettingsResponse command.params['formId'] = form_id unless form_id.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |