This question is from a few years ago, but I just tried the following and it works perfectly:
function guar (){
var gi = {invitedEmailAddress: 'user@gmail.com'};
Classroom.UserProfiles.GuardianInvitations.create(gi, 'user@school.edu.mx');
}
But, before it will work you must go to Resources, then Advanced Google Services, and activate the Admin Directory API, then the Google Classroom API, and then the Groups Settings API, and then you must go to the part below where it says "These services must also be enabled in the Google Cloud Platform API Dashboard." and then you must activate these same three (Admin SDK, Groups Settings API, Google Classroom API). Then it should work just fine.