Class: Google::Apis::ClassroomV1beta1::ClassroomService

Inherits:
Google::Apis::Core::BaseService show all
Defined in:
generated/google/apis/classroom_v1beta1/service.rb

Overview

Google Classroom API

Google Classroom API

Examples:

require 'google/apis/classroom_v1beta1'

Classroom = Google::Apis::ClassroomV1beta1 # Alias the module
service = Classroom::ClassroomService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Google::Apis::Core::BaseService

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

Instance Method Summary collapse

Methods inherited from Google::Apis::Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Constructor Details

#initializeClassroomService


45
46
47
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 45

def initialize
  super('https://classroom.googleapis.com/', '')
end

Instance Attribute Details

#keyString


38
39
40
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 38

def key
  @key
end

#quota_userString


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

def quota_user
  @quota_user
end

Instance Method Details

#create_course(course_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Course

Creates a course. The user specified as the primary teacher in primary_teacher_id is the owner of the created course and added as a teacher. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to create courses. * NOT_FOUND if the primary teacher is not a valid user. * ALREADY_EXISTS if an alias was specified and already exists.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


73
74
75
76
77
78
79
80
81
82
83
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 73

def create_course(course_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses'
  command =  make_simple_command(:post, path, options)
  command.request_representation = Google::Apis::ClassroomV1beta1::Course::Representation
  command.request_object = course_object
  command.response_representation = Google::Apis::ClassroomV1beta1::Course::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Course
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_course_alias(course_id, course_alias_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::CourseAlias

Creates an alias to a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to create the alias. * NOT_FOUND if the course does not exist. * ALREADY_EXISTS if the alias already exists.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


316
317
318
319
320
321
322
323
324
325
326
327
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 316

def create_course_alias(course_id, course_alias_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/aliases'
  command =  make_simple_command(:post, path, options)
  command.request_representation = Google::Apis::ClassroomV1beta1::CourseAlias::Representation
  command.request_object = course_alias_object
  command.response_representation = Google::Apis::ClassroomV1beta1::CourseAlias::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::CourseAlias
  command.params['courseId'] = course_id unless course_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_course_student(course_id, student_object = nil, enrollment_code: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Student

Adds a user as a student of a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to create students in this course. * NOT_FOUND if the requested course ID does not exist. * ALREADY_EXISTS if the user is already a student or student in the course.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 609

def create_course_student(course_id, student_object = nil, enrollment_code: nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/students'
  command =  make_simple_command(:post, path, options)
  command.request_representation = Google::Apis::ClassroomV1beta1::Student::Representation
  command.request_object = student_object
  command.response_representation = Google::Apis::ClassroomV1beta1::Student::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Student
  command.params['courseId'] = course_id unless course_id.nil?
  command.query['enrollmentCode'] = enrollment_code unless enrollment_code.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_course_teacher(course_id, teacher_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Teacher

Creates a teacher of a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to create teachers in this course. * NOT_FOUND if the requested course ID does not exist. * ALREADY_EXISTS if the user is already a teacher or student in the course.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


440
441
442
443
444
445
446
447
448
449
450
451
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 440

def create_course_teacher(course_id, teacher_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/teachers'
  command =  make_simple_command(:post, path, options)
  command.request_representation = Google::Apis::ClassroomV1beta1::Teacher::Representation
  command.request_object = teacher_object
  command.response_representation = Google::Apis::ClassroomV1beta1::Teacher::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Teacher
  command.params['courseId'] = course_id unless course_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_course(id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Empty

Deletes a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to delete the requested course. * NOT_FOUND if no course exists with the requested ID.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


225
226
227
228
229
230
231
232
233
234
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 225

def delete_course(id, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{id}'
  command =  make_simple_command(:delete, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::Empty::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Empty
  command.params['id'] = id unless 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_course_alias(course_id, alias_, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Empty

Deletes an alias of a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to remove the alias. * NOT_FOUND if the alias does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


355
356
357
358
359
360
361
362
363
364
365
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 355

def delete_course_alias(course_id, alias_, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/aliases/{alias}'
  command =  make_simple_command(:delete, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::Empty::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Empty
  command.params['courseId'] = course_id unless course_id.nil?
  command.params['alias'] = alias_ unless alias_.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_course_student(course_id, user_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Empty

Deletes a student of a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to delete students of this course. * NOT_FOUND if no student of this course has the requested ID or if the course does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


691
692
693
694
695
696
697
698
699
700
701
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 691

def delete_course_student(course_id, user_id, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/students/{userId}'
  command =  make_simple_command(:delete, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::Empty::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Empty
  command.params['courseId'] = course_id unless course_id.nil?
  command.params['userId'] = user_id unless user_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_course_teacher(course_id, user_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Empty

Deletes a teacher of a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to delete teachers of this course. * NOT_FOUND if no teacher of this course has the requested ID or if the course does not exist. * FAILED_PRECONDITION if the requested ID belongs to the primary teacher of this course.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


522
523
524
525
526
527
528
529
530
531
532
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 522

def delete_course_teacher(course_id, user_id, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/teachers/{userId}'
  command =  make_simple_command(:delete, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::Empty::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Empty
  command.params['courseId'] = course_id unless course_id.nil?
  command.params['userId'] = user_id unless user_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_course(id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Course

Returns a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to access the requested course. * NOT_FOUND if no course exists with the requested ID.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


108
109
110
111
112
113
114
115
116
117
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 108

def get_course(id, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{id}'
  command =  make_simple_command(:get, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::Course::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Course
  command.params['id'] = id unless 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_course_student(course_id, user_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Student

Returns a student of a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to view students of this course. * NOT_FOUND if no student of this course has the requested ID or if the course does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


651
652
653
654
655
656
657
658
659
660
661
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 651

def get_course_student(course_id, user_id, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/students/{userId}'
  command =  make_simple_command(:get, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::Student::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Student
  command.params['courseId'] = course_id unless course_id.nil?
  command.params['userId'] = user_id unless user_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_course_teacher(course_id, user_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Teacher

Returns a teacher of a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to view teachers of this course. * NOT_FOUND if no teacher of this course has the requested ID or if the course does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


481
482
483
484
485
486
487
488
489
490
491
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 481

def get_course_teacher(course_id, user_id, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/teachers/{userId}'
  command =  make_simple_command(:get, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::Teacher::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Teacher
  command.params['courseId'] = course_id unless course_id.nil?
  command.params['userId'] = user_id unless user_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_user_profile(user_id, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::UserProfile

Returns a user profile. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to access this user profile. * NOT_FOUND if the profile does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


771
772
773
774
775
776
777
778
779
780
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 771

def (user_id, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/userProfiles/{userId}'
  command =  make_simple_command(:get, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::UserProfile::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::UserProfile
  command.params['userId'] = user_id unless user_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_course_aliases(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::ListCourseAliasesResponse

Lists the aliases of a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to access the course. * NOT_FOUND if the course does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


401
402
403
404
405
406
407
408
409
410
411
412
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 401

def list_course_aliases(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/aliases'
  command =  make_simple_command(:get, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::ListCourseAliasesResponse::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::ListCourseAliasesResponse
  command.params['courseId'] = course_id unless course_id.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_course_students(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::ListStudentsResponse

Returns a list of students of this course that the requester is permitted to view. Fails with NOT_FOUND if the course does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


734
735
736
737
738
739
740
741
742
743
744
745
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 734

def list_course_students(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/students'
  command =  make_simple_command(:get, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::ListStudentsResponse::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::ListStudentsResponse
  command.params['courseId'] = course_id unless course_id.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_course_teachers(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::ListTeachersResponse

Returns a list of teachers of this course that the requester is permitted to view. Fails with NOT_FOUND if the course does not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


565
566
567
568
569
570
571
572
573
574
575
576
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 565

def list_course_teachers(course_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{courseId}/teachers'
  command =  make_simple_command(:get, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::ListTeachersResponse::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::ListTeachersResponse
  command.params['courseId'] = course_id unless course_id.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_courses(student_id: nil, teacher_id: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::ListCoursesResponse

Returns a list of courses that the requesting user is permitted to view, restricted to those that match the request. This method returns the following error codes: * INVALID_ARGUMENT if the query argument is malformed. * NOT_FOUND if any users specified in the query arguments do not exist.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 277

def list_courses(student_id: nil, teacher_id: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses'
  command =  make_simple_command(:get, path, options)
  command.response_representation = Google::Apis::ClassroomV1beta1::ListCoursesResponse::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::ListCoursesResponse
  command.query['studentId'] = student_id unless student_id.nil?
  command.query['teacherId'] = teacher_id unless teacher_id.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_course(id, course_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Course

Updates one or more fields a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to modify the requested course. * NOT_FOUND if no course exists with the requested ID.

  • INVALID_ARGUMENT if invalid fields are specified in the update mask or if no update mask is supplied.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 188

def patch_course(id, course_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{id}'
  command =  make_simple_command(:patch, path, options)
  command.request_representation = Google::Apis::ClassroomV1beta1::Course::Representation
  command.request_object = course_object
  command.response_representation = Google::Apis::ClassroomV1beta1::Course::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Course
  command.params['id'] = id unless id.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

#update_course(id, course_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ClassroomV1beta1::Course

Updates a course. This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to modify the requested course. * NOT_FOUND if no course exists with the requested ID.

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Raises:


143
144
145
146
147
148
149
150
151
152
153
154
# File 'generated/google/apis/classroom_v1beta1/service.rb', line 143

def update_course(id, course_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  path = 'v1beta1/courses/{id}'
  command =  make_simple_command(:put, path, options)
  command.request_representation = Google::Apis::ClassroomV1beta1::Course::Representation
  command.request_object = course_object
  command.response_representation = Google::Apis::ClassroomV1beta1::Course::Representation
  command.response_class = Google::Apis::ClassroomV1beta1::Course
  command.params['id'] = id unless 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