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.
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, 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.
Constructor Details
#initialize ⇒ FormsService
Returns a new instance of FormsService.
45 46 47 48 49 50 |
# File 'lib/google/apis/forms_v1/service.rb', line 45 def initialize super('https://forms.googleapis.com/', '', 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.
38 39 40 |
# File 'lib/google/apis/forms_v1/service.rb', line 38 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.
43 44 45 |
# File 'lib/google/apis/forms_v1/service.rb', line 43 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.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/google/apis/forms_v1/service.rb', line 73 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, 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.
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/google/apis/forms_v1/service.rb', line 109 def create_form(form_object = 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['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).
252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/google/apis/forms_v1/service.rb', line 252 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.
286 287 288 289 290 291 292 293 294 295 |
# File 'lib/google/apis/forms_v1/service.rb', line 286 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.
140 141 142 143 144 145 146 147 148 |
# File 'lib/google/apis/forms_v1/service.rb', line 140 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.
172 173 174 175 176 177 178 179 180 181 |
# File 'lib/google/apis/forms_v1/service.rb', line 172 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.
216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/google/apis/forms_v1/service.rb', line 216 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.
319 320 321 322 323 324 325 326 327 |
# File 'lib/google/apis/forms_v1/service.rb', line 319 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
.
356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/google/apis/forms_v1/service.rb', line 356 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 |