class FlatApi::OrganizationApi
Attributes
Public Class Methods
# File lib/flat_api/api/organization_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create a new couple of LTI 1.x credentials Flat for Education is a Certified LTI Provider. You can use these API methods to automate the creation of LTI credentials. You can read more about our LTI implementation, supported components and LTI Endpoints in our [Developer Documentation](flat.io/developers/docs/lti/). @param body @param [Hash] opts the optional parameters @return [LtiCredentials]
# File lib/flat_api/api/organization_api.rb, line 28 def create_lti_credentials(body, opts = {}) data, _status_code, _headers = create_lti_credentials_with_http_info(body, opts) return data end
Create a new couple of LTI 1.x credentials Flat for Education is a Certified LTI Provider. You can use these API methods to automate the creation of LTI credentials. You can read more about our LTI implementation, supported components and LTI Endpoints in our [Developer Documentation](flat.io/developers/docs/lti/). @param body @param [Hash] opts the optional parameters @return [Array<(LtiCredentials
, Fixnum, Hash)>] LtiCredentials
data, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 38 def create_lti_credentials_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.create_lti_credentials ..." end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling OrganizationApi.create_lti_credentials" end # resource path local_var_path = "/organizations/lti/credentials" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'LtiCredentials') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#create_lti_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Create a new invitation to join the organization This method creates and sends invitation for teachers and admins. Invitations can only be used by new Flat users or users who are not part of the organization yet. If the email of the user is already associated to a user of your organization, the API will simply update the role of the existing user and won't send an invitation. In this case, the property `usedBy` will be directly filled with the uniquer identifier of the corresponding user. @param [Hash] opts the optional parameters @option opts [OrganizationInvitationCreation] :body @return [OrganizationInvitation]
# File lib/flat_api/api/organization_api.rb, line 83 def create_organization_invitation(opts = {}) data, _status_code, _headers = create_organization_invitation_with_http_info(opts) return data end
Create a new invitation to join the organization This method creates and sends invitation for teachers and admins. Invitations can only be used by new Flat users or users who are not part of the organization yet. If the email of the user is already associated to a user of your organization, the API will simply update the role of the existing user and won't send an invitation. In this case, the property `usedBy` will be directly filled with the uniquer identifier of the corresponding user. @param [Hash] opts the optional parameters @option opts [OrganizationInvitationCreation] :body @return [Array<(OrganizationInvitation
, Fixnum, Hash)>] OrganizationInvitation
data, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 93 def create_organization_invitation_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.create_organization_invitation ..." end # resource path local_var_path = "/organizations/invitations" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'OrganizationInvitation') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#create_organization_invitation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Create a new user account
@param [Hash] opts the optional parameters @option opts [UserCreation] :body @return [UserDetailsAdmin]
# File lib/flat_api/api/organization_api.rb, line 134 def create_organization_user(opts = {}) data, _status_code, _headers = create_organization_user_with_http_info(opts) return data end
Create a new user account
@param [Hash] opts the optional parameters @option opts [UserCreation] :body @return [Array<(UserDetailsAdmin
, Fixnum, Hash)>] UserDetailsAdmin
data, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 144 def create_organization_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.create_organization_user ..." end # resource path local_var_path = "/organizations/users" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserDetailsAdmin') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#create_organization_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List LTI 1.x credentials
@param [Hash] opts the optional parameters @return [Array<LtiCredentials>]
# File lib/flat_api/api/organization_api.rb, line 184 def list_lti_credentials(opts = {}) data, _status_code, _headers = list_lti_credentials_with_http_info(opts) return data end
List LTI 1.x credentials
@param [Hash] opts the optional parameters @return [Array<(Array<LtiCredentials>, Fixnum, Hash)>] Array<LtiCredentials> data, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 193 def list_lti_credentials_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.list_lti_credentials ..." end # resource path local_var_path = "/organizations/lti/credentials" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<LtiCredentials>') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#list_lti_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List the organization invitations
@param [Hash] opts the optional parameters @option opts [String] :role Filter users by role @option opts [Integer] :limit This is the maximum number of objects that may be returned (default to 50) @option opts [String] :_next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. @option opts [String] :previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. @return [Array<OrganizationInvitation>]
# File lib/flat_api/api/organization_api.rb, line 237 def list_organization_invitations(opts = {}) data, _status_code, _headers = list_organization_invitations_with_http_info(opts) return data end
List the organization invitations
@param [Hash] opts the optional parameters @option opts [String] :role Filter users by role @option opts [Integer] :limit This is the maximum number of objects that may be returned @option opts [String] :_next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. @option opts [String] :previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. @return [Array<(Array<OrganizationInvitation>, Fixnum, Hash)>] Array<OrganizationInvitation> data, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 250 def list_organization_invitations_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.list_organization_invitations ..." end if @api_client.config.client_side_validation && opts[:'role'] && !['user', 'teacher', 'admin'].include?(opts[:'role']) fail ArgumentError, 'invalid value for "role", must be one of user, teacher, admin' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationApi.list_organization_invitations, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationApi.list_organization_invitations, must be greater than or equal to 1.' end # resource path local_var_path = "/organizations/invitations" # query parameters query_params = {} query_params[:'role'] = opts[:'role'] if !opts[:'role'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<OrganizationInvitation>') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#list_organization_invitations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List the organization users
@param [Hash] opts the optional parameters @option opts [String] :role Filter users by role @option opts [Integer] :limit This is the maximum number of objects that may be returned (default to 50) @option opts [String] :_next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. @option opts [String] :previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. @return [Array<UserDetailsAdmin>]
# File lib/flat_api/api/organization_api.rb, line 309 def list_organization_users(opts = {}) data, _status_code, _headers = list_organization_users_with_http_info(opts) return data end
List the organization users
@param [Hash] opts the optional parameters @option opts [String] :role Filter users by role @option opts [Integer] :limit This is the maximum number of objects that may be returned @option opts [String] :_next An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. @option opts [String] :previous An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the `Link` header when requesting the API. These URLs will contain a `next` and `previous` cursor based on the available data. @return [Array<(Array<UserDetailsAdmin>, Fixnum, Hash)>] Array<UserDetailsAdmin> data, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 322 def list_organization_users_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.list_organization_users ..." end if @api_client.config.client_side_validation && opts[:'role'] && !['user', 'teacher', 'admin'].include?(opts[:'role']) fail ArgumentError, 'invalid value for "role", must be one of user, teacher, admin' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationApi.list_organization_users, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationApi.list_organization_users, must be greater than or equal to 1.' end # resource path local_var_path = "/organizations/users" # query parameters query_params = {} query_params[:'role'] = opts[:'role'] if !opts[:'role'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil? query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<UserDetailsAdmin>') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#list_organization_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Remove an organization invitation
@param invitation Unique identifier of the invitation @param [Hash] opts the optional parameters @return [nil]
# File lib/flat_api/api/organization_api.rb, line 378 def remove_organization_invitation(invitation, opts = {}) remove_organization_invitation_with_http_info(invitation, opts) return nil end
Remove an organization invitation
@param invitation Unique identifier of the invitation @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 388 def remove_organization_invitation_with_http_info(invitation, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.remove_organization_invitation ..." end # verify the required parameter 'invitation' is set if @api_client.config.client_side_validation && invitation.nil? fail ArgumentError, "Missing the required parameter 'invitation' when calling OrganizationApi.remove_organization_invitation" end # resource path local_var_path = "/organizations/invitations/{invitation}".sub('{' + 'invitation' + '}', invitation.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#remove_organization_invitation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Remove an account from Flat This operation removes an account from Flat and its data, including: * The music scores created by this user (documents, history, comments, collaboration information) * Education related data (assignments and classroom information) @param user Unique identifier of the Flat account @param [Hash] opts the optional parameters @option opts [BOOLEAN] :convert_to_individual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on flat.io/legal. @return [nil]
# File lib/flat_api/api/organization_api.rb, line 433 def remove_organization_user(user, opts = {}) remove_organization_user_with_http_info(user, opts) return nil end
Remove an account from Flat This operation removes an account from Flat and its data, including: * The music scores created by this user (documents, history, comments, collaboration information) * Education related data (assignments and classroom information) @param user Unique identifier of the Flat account @param [Hash] opts the optional parameters @option opts [BOOLEAN] :convert_to_individual If `true`, the account will be only removed from the organization and converted into an individual account on our public website, flat.io. This operation will remove the education-related data from the account. Before realizing this operation, you need to be sure that the user is at least 13 years old and that this one has read and agreed to the Individual Terms of Services of Flat available on flat.io/legal. @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 444 def remove_organization_user_with_http_info(user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.remove_organization_user ..." end # verify the required parameter 'user' is set if @api_client.config.client_side_validation && user.nil? fail ArgumentError, "Missing the required parameter 'user' when calling OrganizationApi.remove_organization_user" end # resource path local_var_path = "/organizations/users/{user}".sub('{' + 'user' + '}', user.to_s) # query parameters query_params = {} query_params[:'convertToIndividual'] = opts[:'convert_to_individual'] if !opts[:'convert_to_individual'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#remove_organization_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Revoke LTI 1.x credentials
@param credentials Credentials unique identifier @param [Hash] opts the optional parameters @return [nil]
# File lib/flat_api/api/organization_api.rb, line 489 def revoke_lti_credentials(credentials, opts = {}) revoke_lti_credentials_with_http_info(credentials, opts) return nil end
Revoke LTI 1.x credentials
@param credentials Credentials unique identifier @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 499 def revoke_lti_credentials_with_http_info(credentials, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.revoke_lti_credentials ..." end # verify the required parameter 'credentials' is set if @api_client.config.client_side_validation && credentials.nil? fail ArgumentError, "Missing the required parameter 'credentials' when calling OrganizationApi.revoke_lti_credentials" end # resource path local_var_path = "/organizations/lti/credentials/{credentials}".sub('{' + 'credentials' + '}', credentials.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#revoke_lti_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update account information
@param user Unique identifier of the Flat account @param body @param [Hash] opts the optional parameters @return [UserDetailsAdmin]
# File lib/flat_api/api/organization_api.rb, line 544 def update_organization_user(user, body, opts = {}) data, _status_code, _headers = update_organization_user_with_http_info(user, body, opts) return data end
Update account information
@param user Unique identifier of the Flat account @param body @param [Hash] opts the optional parameters @return [Array<(UserDetailsAdmin
, Fixnum, Hash)>] UserDetailsAdmin
data, response status code and response headers
# File lib/flat_api/api/organization_api.rb, line 555 def update_organization_user_with_http_info(user, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrganizationApi.update_organization_user ..." end # verify the required parameter 'user' is set if @api_client.config.client_side_validation && user.nil? fail ArgumentError, "Missing the required parameter 'user' when calling OrganizationApi.update_organization_user" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling OrganizationApi.update_organization_user" end # resource path local_var_path = "/organizations/users/{user}".sub('{' + 'user' + '}', user.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['OAuth2'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserDetailsAdmin') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrganizationApi#update_organization_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end