flat_api 0.3.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +69 -0
- data/LICENSE +201 -0
- data/README.md +92 -0
- data/lib/flat_api/api/account_api.rb +4 -4
- data/lib/flat_api/api/class_api.rb +281 -63
- data/lib/flat_api/api/collection_api.rb +63 -50
- data/lib/flat_api/api/edu_resources_api.rb +38 -26
- data/lib/flat_api/api/group_api.rb +432 -9
- data/lib/flat_api/api/omr_api.rb +894 -0
- data/lib/flat_api/api/organization_api.rb +307 -35
- data/lib/flat_api/api/score_api.rb +129 -80
- data/lib/flat_api/api/task_api.rb +5 -5
- data/lib/flat_api/api/user_api.rb +45 -14
- data/lib/flat_api/api_client.rb +169 -96
- data/lib/flat_api/api_error.rb +3 -3
- data/lib/flat_api/api_model_base.rb +88 -0
- data/lib/flat_api/client.rb +69 -0
- data/lib/flat_api/configuration.rb +124 -25
- data/lib/flat_api/errors.rb +86 -0
- data/lib/flat_api/models/add_group_user200_response.rb +148 -0
- data/lib/flat_api/models/add_group_user_request.rb +165 -0
- data/lib/flat_api/models/api_access_token.rb +13 -80
- data/lib/flat_api/models/app_scopes.rb +6 -4
- data/lib/flat_api/models/assignment.rb +190 -85
- data/lib/flat_api/models/assignment_capabilities.rb +53 -80
- data/lib/flat_api/models/assignment_capabilities_can_publish_in_class_error.rb +33 -80
- data/lib/flat_api/models/assignment_copy.rb +5 -6
- data/lib/flat_api/models/assignment_copy_response.rb +187 -82
- data/lib/flat_api/models/assignment_copy_to_class.rb +23 -80
- data/lib/flat_api/models/assignment_copy_to_resource_library.rb +23 -80
- data/lib/flat_api/models/assignment_group.rb +232 -0
- data/lib/flat_api/models/assignment_submission.rb +104 -81
- data/lib/flat_api/models/assignment_submission_comment.rb +13 -80
- data/lib/flat_api/models/assignment_submission_comment_creation.rb +23 -80
- data/lib/flat_api/models/assignment_submission_comments.rb +13 -80
- data/lib/flat_api/models/assignment_submission_history.rb +33 -80
- data/lib/flat_api/models/assignment_submission_history_attachment.rb +13 -80
- data/lib/flat_api/models/assignment_submission_history_state.rb +3 -3
- data/lib/flat_api/models/assignment_submission_lti.rb +64 -86
- data/lib/flat_api/models/{assignment_submission_playback_inner.rb → assignment_submission_playback.rb} +36 -83
- data/lib/flat_api/models/assignment_submission_state.rb +3 -3
- data/lib/flat_api/models/assignment_submission_students_mode.rb +40 -0
- data/lib/flat_api/models/assignment_submission_update.rb +25 -81
- data/lib/flat_api/models/assignment_type.rb +5 -4
- data/lib/flat_api/models/assignment_update.rb +218 -87
- data/lib/flat_api/models/class_assignment.rb +219 -82
- data/lib/flat_api/models/class_assignment_all_of_canvas.rb +13 -80
- data/lib/flat_api/models/class_assignment_all_of_lti.rb +13 -80
- data/lib/flat_api/models/class_assignment_all_of_mfc.rb +13 -80
- data/lib/flat_api/models/class_assignment_update.rb +237 -94
- data/lib/flat_api/models/class_assignment_update_all_of_google_classroom.rb +13 -80
- data/lib/flat_api/models/class_assignment_update_all_of_microsoft_graph.rb +13 -80
- data/lib/flat_api/models/class_attachment_creation.rb +51 -86
- data/lib/flat_api/models/class_creation.rb +13 -80
- data/lib/flat_api/models/class_details.rb +85 -81
- data/lib/flat_api/models/class_details_canvas.rb +13 -80
- data/lib/flat_api/models/class_details_clever.rb +13 -80
- data/lib/flat_api/models/class_details_google_classroom.rb +13 -80
- data/lib/flat_api/models/class_details_google_drive.rb +13 -80
- data/lib/flat_api/models/class_details_issues.rb +13 -80
- data/lib/flat_api/models/class_details_issues_sync_inner.rb +15 -82
- data/lib/flat_api/models/class_details_lti.rb +28 -85
- data/lib/flat_api/models/class_details_mfc.rb +13 -80
- data/lib/flat_api/models/class_details_microsoft_graph.rb +13 -80
- data/lib/flat_api/models/class_grade_level.rb +3 -3
- data/lib/flat_api/models/class_roles.rb +3 -3
- data/lib/flat_api/models/class_state.rb +5 -4
- data/lib/flat_api/models/class_update.rb +13 -80
- data/lib/flat_api/models/collection.rb +182 -81
- data/lib/flat_api/models/collection_app.rb +13 -80
- data/lib/flat_api/models/collection_capabilities.rb +63 -80
- data/lib/flat_api/models/collection_contents.rb +166 -0
- data/lib/flat_api/models/collection_creation.rb +20 -99
- data/lib/flat_api/models/collection_modification.rb +17 -82
- data/lib/flat_api/models/collection_privacy.rb +3 -3
- data/lib/flat_api/models/collection_type.rb +7 -6
- data/lib/flat_api/models/credit_transaction.rb +388 -0
- data/lib/flat_api/models/edu_library.rb +63 -82
- data/lib/flat_api/models/edu_resource.rb +101 -84
- data/lib/flat_api/models/edu_resource_assignment_creation.rb +170 -0
- data/lib/flat_api/models/edu_resource_capabilities.rb +27 -84
- data/lib/flat_api/models/edu_resource_copy.rb +23 -80
- data/lib/flat_api/models/edu_resource_creation.rb +96 -86
- data/lib/flat_api/models/edu_resource_folder.rb +39 -84
- data/lib/flat_api/models/edu_resource_lti_link.rb +23 -80
- data/lib/flat_api/models/edu_resource_move.rb +23 -80
- data/lib/flat_api/models/edu_resource_privacy.rb +3 -3
- data/lib/flat_api/models/edu_resource_resource.rb +5 -6
- data/lib/flat_api/models/edu_resource_type.rb +3 -3
- data/lib/flat_api/models/edu_resource_update.rb +101 -86
- data/lib/flat_api/models/edu_resource_use_in_class.rb +23 -80
- data/lib/flat_api/models/flat_error_response.rb +47 -84
- data/lib/flat_api/models/google_classroom_coursework.rb +13 -80
- data/lib/flat_api/models/google_classroom_submission.rb +43 -80
- data/lib/flat_api/models/grade.rb +51 -0
- data/lib/flat_api/models/group.rb +14 -94
- data/lib/flat_api/models/group_creation.rb +238 -0
- data/lib/flat_api/models/group_details.rb +178 -84
- data/lib/flat_api/models/group_type.rb +6 -4
- data/lib/flat_api/models/license_mode.rb +3 -3
- data/lib/flat_api/models/license_sources.rb +3 -3
- data/lib/flat_api/models/lms_name.rb +3 -3
- data/lib/flat_api/models/lti_configuration.rb +56 -0
- data/lib/flat_api/models/lti_configuration1p1.rb +361 -0
- data/lib/flat_api/models/lti_configuration1p1_all_of_tool.rb +199 -0
- data/lib/flat_api/models/lti_configuration1p3.rb +106 -0
- data/lib/flat_api/models/lti_configuration1p3_base.rb +336 -0
- data/lib/flat_api/models/lti_configuration1p3_base_supported_services.rb +166 -0
- data/lib/flat_api/models/lti_configuration1p3_base_supported_services_ags.rb +179 -0
- data/lib/flat_api/models/lti_configuration1p3_base_supported_services_deep_linking.rb +159 -0
- data/lib/flat_api/models/lti_configuration1p3_base_supported_services_nrps.rb +169 -0
- data/lib/flat_api/models/lti_configuration1p3_base_tool.rb +199 -0
- data/lib/flat_api/models/lti_configuration1p3_deployment.rb +529 -0
- data/lib/flat_api/models/lti_configuration1p3_dynamic.rb +530 -0
- data/lib/flat_api/models/lti_configuration1p3_manual.rb +489 -0
- data/lib/flat_api/models/lti_configuration_base.rb +306 -0
- data/lib/flat_api/models/lti_configuration_create.rb +60 -0
- data/lib/flat_api/models/lti_configuration_create1p1.rb +210 -0
- data/lib/flat_api/models/lti_configuration_create1p3_deployment.rb +264 -0
- data/lib/flat_api/models/lti_configuration_create1p3_dynamic.rb +209 -0
- data/lib/flat_api/models/lti_configuration_create1p3_dynamic_platform_info.rb +159 -0
- data/lib/flat_api/models/lti_configuration_create1p3_manual.rb +270 -0
- data/lib/flat_api/models/lti_configuration_update.rb +104 -0
- data/lib/flat_api/models/lti_configuration_update_deployment.rb +169 -0
- data/lib/flat_api/models/lti_configuration_update_standalone.rb +219 -0
- data/lib/flat_api/models/lti_credentials.rb +29 -84
- data/lib/flat_api/models/lti_credentials_creation.rb +23 -80
- data/lib/flat_api/models/media_attachment.rb +43 -88
- data/lib/flat_api/models/media_score_sharing_mode.rb +3 -3
- data/lib/flat_api/models/microsoft_graph_assignment.rb +99 -88
- data/lib/flat_api/models/microsoft_graph_submission.rb +33 -80
- data/lib/flat_api/models/omr_capabilities.rb +480 -0
- data/lib/flat_api/models/omr_details_step_data.rb +228 -0
- data/lib/flat_api/models/omr_details_submission.rb +288 -0
- data/lib/flat_api/models/omr_detected_instrument.rb +260 -0
- data/lib/flat_api/models/omr_imported_metadata.rb +181 -0
- data/lib/flat_api/models/omr_instrument_override.rb +311 -0
- data/lib/flat_api/models/omr_job.rb +394 -0
- data/lib/flat_api/models/omr_job_creation.rb +238 -0
- data/lib/flat_api/models/omr_job_file_metadata.rb +199 -0
- data/lib/flat_api/models/omr_job_file_upload.rb +176 -0
- data/lib/flat_api/models/omr_job_file_upload_result.rb +159 -0
- data/lib/flat_api/models/omr_job_input_file.rb +176 -0
- data/lib/flat_api/models/omr_job_output.rb +40 -0
- data/lib/flat_api/models/omr_job_progress.rb +169 -0
- data/lib/flat_api/models/omr_job_result.rb +161 -0
- data/lib/flat_api/models/omr_job_retention.rb +176 -0
- data/lib/flat_api/models/omr_job_status.rb +44 -0
- data/lib/flat_api/models/omr_locale_details.rb +193 -0
- data/lib/flat_api/models/omr_pending_step.rb +213 -0
- data/lib/flat_api/models/omr_step_name.rb +39 -0
- data/lib/flat_api/models/organization_invitation.rb +54 -81
- data/lib/flat_api/models/organization_invitation_creation.rb +15 -82
- data/lib/flat_api/models/organization_roles.rb +5 -5
- data/lib/flat_api/models/organization_user_access_token_creation.rb +23 -80
- data/lib/flat_api/models/rename_group_request.rb +165 -0
- data/lib/flat_api/models/resource_collaborator.rb +43 -85
- data/lib/flat_api/models/resource_collaborator_creation.rb +13 -80
- data/lib/flat_api/models/resource_rights.rb +43 -85
- data/lib/flat_api/models/score_comment.rb +122 -80
- data/lib/flat_api/models/score_comment_context.rb +73 -80
- data/lib/flat_api/models/score_comment_creation.rb +24 -81
- data/lib/flat_api/models/score_comment_moderation.rb +13 -80
- data/lib/flat_api/models/score_comment_update.rb +18 -85
- data/lib/flat_api/models/score_comments_counts.rb +28 -85
- data/lib/flat_api/models/score_creation.rb +5 -6
- data/lib/flat_api/models/score_creation_builder_data.rb +24 -88
- data/lib/flat_api/models/score_creation_builder_data_all_of_builder_data.rb +23 -80
- data/lib/flat_api/models/score_creation_builder_data_all_of_builder_data_layout_data.rb +13 -80
- data/lib/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data.rb +24 -81
- data/lib/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.rb +33 -80
- data/lib/flat_api/models/score_creation_common.rb +14 -81
- data/lib/flat_api/models/score_creation_file_import.rb +39 -86
- data/lib/flat_api/models/score_creation_google_drive_import.rb +24 -81
- data/lib/flat_api/models/score_creation_type.rb +4 -5
- data/lib/flat_api/models/score_details.rb +180 -89
- data/lib/flat_api/models/score_details_all_of_me.rb +193 -0
- data/lib/flat_api/models/score_fork.rb +14 -83
- data/lib/flat_api/models/score_license.rb +4 -5
- data/lib/flat_api/models/score_likes_counts.rb +28 -106
- data/lib/flat_api/models/score_modification.rb +13 -80
- data/lib/flat_api/models/score_plays_counts.rb +28 -85
- data/lib/flat_api/models/score_privacy.rb +3 -3
- data/lib/flat_api/models/score_revision.rb +81 -87
- data/lib/flat_api/models/score_revision_creation.rb +23 -80
- data/lib/flat_api/models/score_revision_statistics.rb +13 -80
- data/lib/flat_api/models/score_source.rb +13 -80
- data/lib/flat_api/models/score_summary.rb +63 -80
- data/lib/flat_api/models/score_track.rb +94 -88
- data/lib/flat_api/models/score_track_creation.rb +13 -80
- data/lib/flat_api/models/score_track_creation_response.rb +165 -0
- data/lib/flat_api/models/score_track_point.rb +23 -80
- data/lib/flat_api/models/score_track_purpose.rb +3 -3
- data/lib/flat_api/models/score_track_state.rb +3 -3
- data/lib/flat_api/models/score_track_type.rb +3 -3
- data/lib/flat_api/models/score_track_update.rb +25 -81
- data/lib/flat_api/models/score_views_counts.rb +28 -85
- data/lib/flat_api/models/task.rb +62 -87
- data/lib/flat_api/models/task_export_options.rb +13 -80
- data/lib/flat_api/models/task_progress.rb +13 -80
- data/lib/flat_api/models/task_result.rb +13 -80
- data/lib/flat_api/models/teaching_theme.rb +47 -0
- data/lib/flat_api/models/tutteo_product.rb +3 -3
- data/lib/flat_api/models/user_admin_update.rb +17 -95
- data/lib/flat_api/models/user_azure_details.rb +13 -80
- data/lib/flat_api/models/user_basics.rb +43 -80
- data/lib/flat_api/models/user_community_profile_links.rb +13 -80
- data/lib/flat_api/models/user_creation.rb +21 -98
- data/lib/flat_api/models/user_details.rb +101 -96
- data/lib/flat_api/models/user_details_admin.rb +72 -85
- data/lib/flat_api/models/user_details_admin_all_of_license.rb +13 -80
- data/lib/flat_api/models/user_public.rb +89 -94
- data/lib/flat_api/models/user_public_summary.rb +58 -81
- data/lib/flat_api/models/user_signin_link.rb +24 -81
- data/lib/flat_api/models/user_signin_link_creation.rb +13 -80
- data/lib/flat_api/oauth.rb +128 -0
- data/lib/flat_api/pagination.rb +88 -0
- data/lib/flat_api/retry.rb +56 -0
- data/lib/flat_api/version.rb +4 -4
- data/lib/flat_api.rb +70 -5
- metadata +98 -330
- data/lib/flat_api/models/flat_locales.rb +0 -56
- data/spec/api/account_api_spec.rb +0 -47
- data/spec/api/class_api_spec.rb +0 -422
- data/spec/api/collection_api_spec.rb +0 -158
- data/spec/api/edu_resources_api_spec.rb +0 -181
- data/spec/api/group_api_spec.rb +0 -71
- data/spec/api/organization_api_spec.rb +0 -201
- data/spec/api/score_api_spec.rb +0 -440
- data/spec/api/task_api_spec.rb +0 -47
- data/spec/api/user_api_spec.rb +0 -75
- data/spec/models/api_access_token_spec.rb +0 -66
- data/spec/models/app_scopes_spec.rb +0 -30
- data/spec/models/assignment_capabilities_can_publish_in_class_error_spec.rb +0 -42
- data/spec/models/assignment_capabilities_spec.rb +0 -60
- data/spec/models/assignment_copy_response_spec.rb +0 -124
- data/spec/models/assignment_copy_spec.rb +0 -32
- data/spec/models/assignment_copy_to_class_spec.rb +0 -48
- data/spec/models/assignment_copy_to_resource_library_spec.rb +0 -42
- data/spec/models/assignment_spec.rb +0 -118
- data/spec/models/assignment_submission_comment_creation_spec.rb +0 -36
- data/spec/models/assignment_submission_comment_spec.rb +0 -72
- data/spec/models/assignment_submission_comments_spec.rb +0 -42
- data/spec/models/assignment_submission_history_attachment_spec.rb +0 -48
- data/spec/models/assignment_submission_history_spec.rb +0 -112
- data/spec/models/assignment_submission_history_state_spec.rb +0 -30
- data/spec/models/assignment_submission_lti_spec.rb +0 -36
- data/spec/models/assignment_submission_playback_inner_spec.rb +0 -42
- data/spec/models/assignment_submission_spec.rb +0 -144
- data/spec/models/assignment_submission_state_spec.rb +0 -30
- data/spec/models/assignment_submission_update_spec.rb +0 -66
- data/spec/models/assignment_type_spec.rb +0 -30
- data/spec/models/assignment_update_spec.rb +0 -100
- data/spec/models/class_assignment_all_of_canvas_spec.rb +0 -42
- data/spec/models/class_assignment_all_of_lti_spec.rb +0 -36
- data/spec/models/class_assignment_all_of_mfc_spec.rb +0 -42
- data/spec/models/class_assignment_spec.rb +0 -216
- data/spec/models/class_assignment_update_all_of_google_classroom_spec.rb +0 -36
- data/spec/models/class_assignment_update_all_of_microsoft_graph_spec.rb +0 -36
- data/spec/models/class_assignment_update_spec.rb +0 -150
- data/spec/models/class_attachment_creation_spec.rb +0 -76
- data/spec/models/class_creation_spec.rb +0 -64
- data/spec/models/class_details_canvas_spec.rb +0 -42
- data/spec/models/class_details_clever_spec.rb +0 -76
- data/spec/models/class_details_google_classroom_spec.rb +0 -42
- data/spec/models/class_details_google_drive_spec.rb +0 -42
- data/spec/models/class_details_issues_spec.rb +0 -36
- data/spec/models/class_details_issues_sync_inner_spec.rb +0 -52
- data/spec/models/class_details_lti_spec.rb +0 -48
- data/spec/models/class_details_mfc_spec.rb +0 -42
- data/spec/models/class_details_microsoft_graph_spec.rb +0 -36
- data/spec/models/class_details_spec.rb +0 -178
- data/spec/models/class_grade_level_spec.rb +0 -30
- data/spec/models/class_roles_spec.rb +0 -30
- data/spec/models/class_state_spec.rb +0 -30
- data/spec/models/class_update_spec.rb +0 -64
- data/spec/models/collection_app_spec.rb +0 -48
- data/spec/models/collection_capabilities_spec.rb +0 -60
- data/spec/models/collection_creation_spec.rb +0 -42
- data/spec/models/collection_modification_spec.rb +0 -42
- data/spec/models/collection_privacy_spec.rb +0 -30
- data/spec/models/collection_spec.rb +0 -114
- data/spec/models/collection_type_spec.rb +0 -30
- data/spec/models/edu_library_spec.rb +0 -62
- data/spec/models/edu_resource_capabilities_spec.rb +0 -48
- data/spec/models/edu_resource_copy_spec.rb +0 -36
- data/spec/models/edu_resource_creation_spec.rb +0 -48
- data/spec/models/edu_resource_folder_spec.rb +0 -36
- data/spec/models/edu_resource_lti_link_spec.rb +0 -36
- data/spec/models/edu_resource_move_spec.rb +0 -36
- data/spec/models/edu_resource_privacy_spec.rb +0 -30
- data/spec/models/edu_resource_resource_spec.rb +0 -32
- data/spec/models/edu_resource_spec.rb +0 -96
- data/spec/models/edu_resource_type_spec.rb +0 -30
- data/spec/models/edu_resource_update_spec.rb +0 -42
- data/spec/models/edu_resource_use_in_class_spec.rb +0 -42
- data/spec/models/flat_error_response_spec.rb +0 -54
- data/spec/models/flat_locales_spec.rb +0 -30
- data/spec/models/google_classroom_coursework_spec.rb +0 -54
- data/spec/models/google_classroom_submission_spec.rb +0 -48
- data/spec/models/group_details_spec.rb +0 -72
- data/spec/models/group_spec.rb +0 -76
- data/spec/models/group_type_spec.rb +0 -30
- data/spec/models/license_mode_spec.rb +0 -30
- data/spec/models/license_sources_spec.rb +0 -30
- data/spec/models/lms_name_spec.rb +0 -30
- data/spec/models/lti_credentials_creation_spec.rb +0 -42
- data/spec/models/lti_credentials_spec.rb +0 -84
- data/spec/models/media_attachment_spec.rb +0 -166
- data/spec/models/media_score_sharing_mode_spec.rb +0 -30
- data/spec/models/microsoft_graph_assignment_spec.rb +0 -54
- data/spec/models/microsoft_graph_submission_spec.rb +0 -42
- data/spec/models/organization_invitation_creation_spec.rb +0 -46
- data/spec/models/organization_invitation_spec.rb +0 -84
- data/spec/models/organization_roles_spec.rb +0 -30
- data/spec/models/organization_user_access_token_creation_spec.rb +0 -36
- data/spec/models/resource_collaborator_creation_spec.rb +0 -72
- data/spec/models/resource_collaborator_spec.rb +0 -112
- data/spec/models/resource_rights_spec.rb +0 -64
- data/spec/models/score_comment_context_spec.rb +0 -78
- data/spec/models/score_comment_creation_spec.rb +0 -66
- data/spec/models/score_comment_moderation_spec.rb +0 -46
- data/spec/models/score_comment_spec.rb +0 -130
- data/spec/models/score_comment_update_spec.rb +0 -54
- data/spec/models/score_comments_counts_spec.rb +0 -54
- data/spec/models/score_creation_builder_data_all_of_builder_data_layout_data_spec.rb +0 -82
- data/spec/models/score_creation_builder_data_all_of_builder_data_score_data_instruments_spec.rb +0 -60
- data/spec/models/score_creation_builder_data_all_of_builder_data_score_data_spec.rb +0 -66
- data/spec/models/score_creation_builder_data_all_of_builder_data_spec.rb +0 -42
- data/spec/models/score_creation_builder_data_spec.rb +0 -60
- data/spec/models/score_creation_common_spec.rb +0 -54
- data/spec/models/score_creation_file_import_spec.rb +0 -76
- data/spec/models/score_creation_google_drive_import_spec.rb +0 -60
- data/spec/models/score_creation_spec.rb +0 -32
- data/spec/models/score_creation_type_spec.rb +0 -30
- data/spec/models/score_details_spec.rb +0 -240
- data/spec/models/score_fork_spec.rb +0 -48
- data/spec/models/score_license_spec.rb +0 -30
- data/spec/models/score_likes_counts_spec.rb +0 -48
- data/spec/models/score_modification_spec.rb +0 -102
- data/spec/models/score_plays_counts_spec.rb +0 -48
- data/spec/models/score_privacy_spec.rb +0 -30
- data/spec/models/score_revision_creation_spec.rb +0 -58
- data/spec/models/score_revision_spec.rb +0 -78
- data/spec/models/score_revision_statistics_spec.rb +0 -54
- data/spec/models/score_source_spec.rb +0 -36
- data/spec/models/score_summary_spec.rb +0 -66
- data/spec/models/score_track_creation_spec.rb +0 -66
- data/spec/models/score_track_point_spec.rb +0 -52
- data/spec/models/score_track_purpose_spec.rb +0 -30
- data/spec/models/score_track_spec.rb +0 -108
- data/spec/models/score_track_state_spec.rb +0 -30
- data/spec/models/score_track_type_spec.rb +0 -30
- data/spec/models/score_track_update_spec.rb +0 -54
- data/spec/models/score_views_counts_spec.rb +0 -48
- data/spec/models/task_export_options_spec.rb +0 -36
- data/spec/models/task_progress_spec.rb +0 -42
- data/spec/models/task_result_spec.rb +0 -42
- data/spec/models/task_spec.rb +0 -100
- data/spec/models/tutteo_product_spec.rb +0 -30
- data/spec/models/user_admin_update_spec.rb +0 -66
- data/spec/models/user_azure_details_spec.rb +0 -48
- data/spec/models/user_basics_spec.rb +0 -94
- data/spec/models/user_community_profile_links_spec.rb +0 -66
- data/spec/models/user_creation_spec.rb +0 -76
- data/spec/models/user_details_admin_all_of_license_spec.rb +0 -60
- data/spec/models/user_details_admin_spec.rb +0 -142
- data/spec/models/user_details_spec.rb +0 -214
- data/spec/models/user_public_spec.rb +0 -178
- data/spec/models/user_public_summary_spec.rb +0 -118
- data/spec/models/user_signin_link_creation_spec.rb +0 -36
- data/spec/models/user_signin_link_spec.rb +0 -42
- data/spec/spec_helper.rb +0 -111
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Flat API
|
|
3
|
+
|
|
4
|
+
#The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * Browsing, updating, copying, exporting the user's scores (for example in MP3, WAV or MIDI) * Managing educational resources with Flat for Education: creating & updating the organization accounts, the classes, rosters and assignments. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2.26.1
|
|
7
|
+
Contact: developers@flat.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.24.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module FlatApi
|
|
14
|
+
class ApiModelBase
|
|
15
|
+
# Deserializes the data based on type
|
|
16
|
+
# @param string type Data type
|
|
17
|
+
# @param string value Value to be deserialized
|
|
18
|
+
# @return [Object] Deserialized data
|
|
19
|
+
def self._deserialize(type, value)
|
|
20
|
+
case type.to_sym
|
|
21
|
+
when :Time
|
|
22
|
+
Time.parse(value)
|
|
23
|
+
when :Date
|
|
24
|
+
Date.parse(value)
|
|
25
|
+
when :String
|
|
26
|
+
value.to_s
|
|
27
|
+
when :Integer
|
|
28
|
+
value.to_i
|
|
29
|
+
when :Float
|
|
30
|
+
value.to_f
|
|
31
|
+
when :Boolean
|
|
32
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
33
|
+
true
|
|
34
|
+
else
|
|
35
|
+
false
|
|
36
|
+
end
|
|
37
|
+
when :Object
|
|
38
|
+
# generic object (usually a Hash), return directly
|
|
39
|
+
value
|
|
40
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
41
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
42
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
43
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
44
|
+
k_type = Regexp.last_match[:k_type]
|
|
45
|
+
v_type = Regexp.last_match[:v_type]
|
|
46
|
+
{}.tap do |hash|
|
|
47
|
+
value.each do |k, v|
|
|
48
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
else # model
|
|
52
|
+
# models (e.g. Pet) or oneOf
|
|
53
|
+
klass = FlatApi.const_get(type)
|
|
54
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns the string representation of the object
|
|
59
|
+
# @return [String] String presentation of the object
|
|
60
|
+
def to_s
|
|
61
|
+
to_hash.to_s
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
65
|
+
# @return [Hash] Returns the object in the form of hash
|
|
66
|
+
def to_body
|
|
67
|
+
to_hash
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Outputs non-array value in the form of hash
|
|
71
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
72
|
+
# @param [Object] value Any valid value
|
|
73
|
+
# @return [Hash] Returns the value in the form of hash
|
|
74
|
+
def _to_hash(value)
|
|
75
|
+
if value.is_a?(Array)
|
|
76
|
+
value.compact.map { |v| _to_hash(v) }
|
|
77
|
+
elsif value.is_a?(Hash)
|
|
78
|
+
{}.tap do |hash|
|
|
79
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
80
|
+
end
|
|
81
|
+
elsif value.respond_to? :to_hash
|
|
82
|
+
value.to_hash
|
|
83
|
+
else
|
|
84
|
+
value
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module FlatApi
|
|
4
|
+
# One object to start from.
|
|
5
|
+
#
|
|
6
|
+
# client = FlatApi::FlatClient.new(access_token: 'YOUR_TOKEN')
|
|
7
|
+
# client.account.get_authenticated_user
|
|
8
|
+
# client.paginate(:list_collections, parent: 'user').each { |c| puts c.title }
|
|
9
|
+
#
|
|
10
|
+
# It owns one ApiClient, so every API reached through it shares a connection and a
|
|
11
|
+
# configuration. Constructing the generated classes directly still works and is equivalent.
|
|
12
|
+
class FlatClient
|
|
13
|
+
# Short name to generated class. The order matters: paginate resolves an operation by asking
|
|
14
|
+
# each API in turn, and two of them define get_user_scores, so scores wins over users.
|
|
15
|
+
APIS = {
|
|
16
|
+
account: 'AccountApi',
|
|
17
|
+
classes: 'ClassApi',
|
|
18
|
+
collections: 'CollectionApi',
|
|
19
|
+
edu_resources: 'EduResourcesApi',
|
|
20
|
+
groups: 'GroupApi',
|
|
21
|
+
omr: 'OMRApi',
|
|
22
|
+
organization: 'OrganizationApi',
|
|
23
|
+
scores: 'ScoreApi',
|
|
24
|
+
tasks: 'TaskApi',
|
|
25
|
+
users: 'UserApi'
|
|
26
|
+
}.freeze
|
|
27
|
+
|
|
28
|
+
attr_reader :api_client, :config
|
|
29
|
+
|
|
30
|
+
# +config+ defaults to a fresh Configuration rather than Configuration.default: a client built
|
|
31
|
+
# with its own token must not overwrite the token every other client is using.
|
|
32
|
+
def initialize(access_token: nil, config: nil, retry_policy: nil)
|
|
33
|
+
@config = config || Configuration.new
|
|
34
|
+
@config.access_token = access_token unless access_token.nil?
|
|
35
|
+
@config.retry_policy = retry_policy unless retry_policy.nil?
|
|
36
|
+
@api_client = ApiClient.new(@config)
|
|
37
|
+
@apis = {}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
APIS.each_key { |name| define_method(name) { api(name) } }
|
|
41
|
+
|
|
42
|
+
# One generated API by short name, memoised.
|
|
43
|
+
def api(name)
|
|
44
|
+
klass = APIS[name.to_sym]
|
|
45
|
+
raise ArgumentError, "unknown API #{name}, expected one of: #{APIS.keys.join(', ')}" if klass.nil?
|
|
46
|
+
|
|
47
|
+
@apis[name.to_sym] ||= FlatApi.const_get(klass).new(@api_client)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Every item across every page of a cursor-paginated operation, as a lazy Enumerator.
|
|
51
|
+
# Positional arguments are the operation's path parameters; keywords are its query parameters.
|
|
52
|
+
#
|
|
53
|
+
# client.paginate(:list_collections, parent: 'user').each { |c| puts c.title }
|
|
54
|
+
# client.paginate(:get_user_scores, 'me') { |score| puts score.title }
|
|
55
|
+
#
|
|
56
|
+
# An operation that does not paginate yields its single page, so this is always safe to use.
|
|
57
|
+
def paginate(operation, *args, **params, &block)
|
|
58
|
+
method = "#{operation}_with_http_info"
|
|
59
|
+
owner = APIS.keys.find { |name| api(name).respond_to?(method) }
|
|
60
|
+
raise ArgumentError, "no operation #{operation} on any Flat API" if owner.nil?
|
|
61
|
+
|
|
62
|
+
target = api(owner)
|
|
63
|
+
enum = Pagination.paginate(**params) do |page_params|
|
|
64
|
+
target.public_send(method, *args, page_params)
|
|
65
|
+
end
|
|
66
|
+
block ? enum.each(&block) : enum
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Flat API
|
|
3
3
|
|
|
4
|
-
#The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro
|
|
4
|
+
#The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * Browsing, updating, copying, exporting the user's scores (for example in MP3, WAV or MIDI) * Managing educational resources with Flat for Education: creating & updating the organization accounts, the classes, rosters and assignments. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html)
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2.
|
|
6
|
+
The version of the OpenAPI document: 2.26.1
|
|
7
7
|
Contact: developers@flat.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.24.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -79,6 +79,14 @@ module FlatApi
|
|
|
79
79
|
# @return [true, false]
|
|
80
80
|
attr_accessor :debugging
|
|
81
81
|
|
|
82
|
+
# Set this to ignore operation servers for the API client. This is useful when you need to
|
|
83
|
+
# send requests to a different server than the one specified in the OpenAPI document.
|
|
84
|
+
# Will default to the base url defined in the spec but can be overridden by setting
|
|
85
|
+
# `scheme`, `host`, `base_path` directly.
|
|
86
|
+
# Default to false.
|
|
87
|
+
# @return [true, false]
|
|
88
|
+
attr_accessor :ignore_operation_servers
|
|
89
|
+
|
|
82
90
|
# Defines the logger used for debugging.
|
|
83
91
|
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
|
84
92
|
#
|
|
@@ -96,6 +104,10 @@ module FlatApi
|
|
|
96
104
|
# Default to 0 (never times out).
|
|
97
105
|
attr_accessor :timeout
|
|
98
106
|
|
|
107
|
+
# The retry policy applied to every request. Set RetryPolicy.disabled to turn retries off;
|
|
108
|
+
# errors still arrive typed and a rate-limit error still carries its reset.
|
|
109
|
+
attr_accessor :retry_policy
|
|
110
|
+
|
|
99
111
|
# Set this to false to skip client side validation in the operation.
|
|
100
112
|
# Default to true.
|
|
101
113
|
# @return [true, false]
|
|
@@ -108,40 +120,39 @@ module FlatApi
|
|
|
108
120
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
|
109
121
|
#
|
|
110
122
|
# @return [true, false]
|
|
111
|
-
attr_accessor :
|
|
123
|
+
attr_accessor :ssl_verify
|
|
112
124
|
|
|
113
125
|
### TLS/SSL setting
|
|
114
|
-
#
|
|
115
|
-
# Default to true.
|
|
126
|
+
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
|
|
116
127
|
#
|
|
117
128
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
|
118
129
|
#
|
|
119
|
-
|
|
120
|
-
attr_accessor :verify_ssl_host
|
|
130
|
+
attr_accessor :ssl_verify_mode
|
|
121
131
|
|
|
122
132
|
### TLS/SSL setting
|
|
123
133
|
# Set this to customize the certificate file to verify the peer.
|
|
124
134
|
#
|
|
125
135
|
# @return [String] the path to the certificate file
|
|
126
|
-
|
|
127
|
-
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
|
128
|
-
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
|
129
|
-
attr_accessor :ssl_ca_cert
|
|
136
|
+
attr_accessor :ssl_ca_file
|
|
130
137
|
|
|
131
138
|
### TLS/SSL setting
|
|
132
139
|
# Client certificate file (for client certificate)
|
|
133
|
-
attr_accessor :
|
|
140
|
+
attr_accessor :ssl_client_cert
|
|
134
141
|
|
|
135
142
|
### TLS/SSL setting
|
|
136
143
|
# Client private key file (for client certificate)
|
|
137
|
-
attr_accessor :
|
|
144
|
+
attr_accessor :ssl_client_key
|
|
138
145
|
|
|
139
|
-
|
|
140
|
-
#
|
|
146
|
+
### Proxy setting
|
|
147
|
+
# HTTP Proxy settings
|
|
148
|
+
attr_accessor :proxy
|
|
149
|
+
|
|
150
|
+
# Set this to customize parameters encoder of array parameter.
|
|
151
|
+
# Default to nil. Faraday uses NestedParamsEncoder when nil.
|
|
141
152
|
#
|
|
142
|
-
# @see The
|
|
143
|
-
# https://github.com/
|
|
144
|
-
attr_accessor :
|
|
153
|
+
# @see The params_encoder option of Faraday. Related source code:
|
|
154
|
+
# https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
|
|
155
|
+
attr_accessor :params_encoder
|
|
145
156
|
|
|
146
157
|
|
|
147
158
|
attr_accessor :inject_format
|
|
@@ -159,13 +170,20 @@ module FlatApi
|
|
|
159
170
|
@api_key = {}
|
|
160
171
|
@api_key_prefix = {}
|
|
161
172
|
@client_side_validation = true
|
|
162
|
-
@
|
|
163
|
-
@
|
|
164
|
-
@
|
|
165
|
-
@
|
|
166
|
-
@
|
|
167
|
-
@
|
|
173
|
+
@ssl_verify = true
|
|
174
|
+
@ssl_verify_mode = nil
|
|
175
|
+
@ssl_ca_file = nil
|
|
176
|
+
@ssl_client_cert = nil
|
|
177
|
+
@ssl_client_key = nil
|
|
178
|
+
@middlewares = Hash.new { |h, k| h[k] = [] }
|
|
179
|
+
@configure_connection_blocks = []
|
|
180
|
+
@timeout = 60
|
|
181
|
+
@retry_policy = RetryPolicy.new
|
|
182
|
+
# return data as binary instead of file
|
|
183
|
+
@return_binary_data = false
|
|
184
|
+
@params_encoder = nil
|
|
168
185
|
@debugging = false
|
|
186
|
+
@ignore_operation_servers = false
|
|
169
187
|
@inject_format = false
|
|
170
188
|
@force_ending_format = false
|
|
171
189
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
|
@@ -200,6 +218,7 @@ module FlatApi
|
|
|
200
218
|
|
|
201
219
|
# Returns base URL for specified operation based on server settings
|
|
202
220
|
def base_url(operation = nil)
|
|
221
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
|
|
203
222
|
if operation_server_settings.key?(operation) then
|
|
204
223
|
index = server_operation_index.fetch(operation, server_index)
|
|
205
224
|
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
|
@@ -293,6 +312,86 @@ module FlatApi
|
|
|
293
312
|
url
|
|
294
313
|
end
|
|
295
314
|
|
|
315
|
+
# Configure Faraday connection directly.
|
|
316
|
+
#
|
|
317
|
+
# ```
|
|
318
|
+
# c.configure_faraday_connection do |conn|
|
|
319
|
+
# conn.use Faraday::HttpCache, shared_cache: false, logger: logger
|
|
320
|
+
# conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
|
|
321
|
+
# logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
|
|
322
|
+
# end
|
|
323
|
+
# end
|
|
324
|
+
#
|
|
325
|
+
# c.configure_faraday_connection do |conn|
|
|
326
|
+
# conn.adapter :typhoeus
|
|
327
|
+
# end
|
|
328
|
+
# ```
|
|
329
|
+
#
|
|
330
|
+
# @param block [Proc] `#call`able object that takes one arg, the connection
|
|
331
|
+
def configure_faraday_connection(&block)
|
|
332
|
+
@configure_connection_blocks << block
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def configure_connection(conn)
|
|
336
|
+
@configure_connection_blocks.each do |block|
|
|
337
|
+
block.call(conn)
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
# Adds middleware to the stack
|
|
342
|
+
def use(*middleware)
|
|
343
|
+
set_faraday_middleware(:use, *middleware)
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Adds request middleware to the stack
|
|
347
|
+
def request(*middleware)
|
|
348
|
+
set_faraday_middleware(:request, *middleware)
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
# Adds response middleware to the stack
|
|
352
|
+
def response(*middleware)
|
|
353
|
+
set_faraday_middleware(:response, *middleware)
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
# Adds Faraday middleware setting information to the stack
|
|
357
|
+
#
|
|
358
|
+
# @example Use the `set_faraday_middleware` method to set middleware information
|
|
359
|
+
# config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
|
|
360
|
+
# config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
|
|
361
|
+
# config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
|
|
362
|
+
# config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
|
|
363
|
+
# config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
|
|
364
|
+
# config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
|
|
365
|
+
#
|
|
366
|
+
# @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
|
|
367
|
+
def set_faraday_middleware(operation, key, *args, &block)
|
|
368
|
+
unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
|
|
369
|
+
fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
|
|
370
|
+
" :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
@middlewares[operation] << [key, args, block]
|
|
374
|
+
end
|
|
375
|
+
ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
|
|
376
|
+
|
|
377
|
+
# Set up middleware on the connection
|
|
378
|
+
def configure_middleware(connection)
|
|
379
|
+
return if @middlewares.empty?
|
|
380
|
+
|
|
381
|
+
[:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
|
|
382
|
+
next unless @middlewares.key?(operation)
|
|
383
|
+
|
|
384
|
+
@middlewares[operation].each do |key, args, block|
|
|
385
|
+
connection.builder.send(operation, key, *args, &block)
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
if @middlewares.key?(:delete)
|
|
390
|
+
@middlewares[:delete].each do |key, _args, _block|
|
|
391
|
+
connection.builder.delete(key)
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
end
|
|
296
395
|
|
|
297
396
|
end
|
|
298
397
|
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Typed errors for the Flat API.
|
|
4
|
+
#
|
|
5
|
+
# Rescue the error class, not the status code: rate limiting and authorization failures both return
|
|
6
|
+
# HTTP 403 and are separated only by the response body's +code+.
|
|
7
|
+
module FlatApi
|
|
8
|
+
RATE_LIMIT_CODE = 'API_RATE_LIMIT_EXCEEDED'
|
|
9
|
+
QUOTA_CODES = %w[QUOTA_EXCEEDED CREDITS_EXHAUSTED OMR_CREDITS_EXHAUSTED].freeze
|
|
10
|
+
|
|
11
|
+
class FlatError < StandardError
|
|
12
|
+
attr_reader :status, :code, :request_id, :headers, :body
|
|
13
|
+
|
|
14
|
+
def initialize(message, status: nil, code: nil, request_id: nil, headers: nil, body: nil)
|
|
15
|
+
super(message)
|
|
16
|
+
@status = status
|
|
17
|
+
@code = code
|
|
18
|
+
# Present only for internal and backend errors, so treat it as optional.
|
|
19
|
+
@request_id = request_id
|
|
20
|
+
@headers = headers || {}
|
|
21
|
+
@body = body
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def to_s
|
|
25
|
+
parts = [super]
|
|
26
|
+
parts << "code=#{code}" if code
|
|
27
|
+
parts << "status=#{status}" if status
|
|
28
|
+
parts << "id=#{request_id}" if request_id
|
|
29
|
+
parts.join(' ')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# The token is missing, invalid or expired, or a refresh failed. Re-authorize.
|
|
34
|
+
class FlatAuthenticationError < FlatError; end
|
|
35
|
+
# Authenticated but not permitted: a missing scope or insufficient permission.
|
|
36
|
+
class FlatAuthorizationError < FlatError; end
|
|
37
|
+
# The request body or parameters failed validation.
|
|
38
|
+
class FlatValidationError < FlatError; end
|
|
39
|
+
# The resource does not exist, or is not visible to this token.
|
|
40
|
+
class FlatNotFoundError < FlatError; end
|
|
41
|
+
# A metered resource, such as OMR credits, is exhausted.
|
|
42
|
+
class FlatQuotaError < FlatError; end
|
|
43
|
+
# An internal or backend error. +request_id+ is normally set here.
|
|
44
|
+
class FlatServerError < FlatError; end
|
|
45
|
+
|
|
46
|
+
# The account or IP exceeded its request quota. Returned as HTTP 403, not 429.
|
|
47
|
+
class FlatRateLimitError < FlatError
|
|
48
|
+
attr_reader :limit, :remaining, :reset
|
|
49
|
+
|
|
50
|
+
def initialize(message, **kwargs)
|
|
51
|
+
super
|
|
52
|
+
@limit = int_header('X-RateLimit-Limit')
|
|
53
|
+
@remaining = int_header('X-RateLimit-Remaining')
|
|
54
|
+
# UTC epoch seconds at which the window resets. Flat sends no Retry-After header.
|
|
55
|
+
@reset = int_header('X-RateLimit-Reset')
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
def int_header(name)
|
|
61
|
+
pair = headers.find { |k, _| k.to_s.downcase == name.downcase }
|
|
62
|
+
pair && Integer(pair[1], exception: false)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Build the right error for a non-2xx response.
|
|
67
|
+
def self.error_from_response(status, body, headers = {})
|
|
68
|
+
payload = body.is_a?(Hash) ? body : {}
|
|
69
|
+
code = payload['code'] || payload[:code]
|
|
70
|
+
message = payload['message'] || payload[:message] || "HTTP #{status}"
|
|
71
|
+
opts = {
|
|
72
|
+
status: status, code: code, request_id: payload['id'] || payload[:id],
|
|
73
|
+
headers: headers, body: body
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return FlatRateLimitError.new(message, **opts) if status == 403 && code == RATE_LIMIT_CODE
|
|
77
|
+
return FlatQuotaError.new(message, **opts) if QUOTA_CODES.include?(code)
|
|
78
|
+
return FlatAuthenticationError.new(message, **opts) if status == 401
|
|
79
|
+
return FlatAuthorizationError.new(message, **opts) if status == 403
|
|
80
|
+
return FlatNotFoundError.new(message, **opts) if status == 404
|
|
81
|
+
return FlatValidationError.new(message, **opts) if [400, 422].include?(status)
|
|
82
|
+
return FlatServerError.new(message, **opts) if status >= 500
|
|
83
|
+
|
|
84
|
+
FlatError.new(message, **opts)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Flat API
|
|
3
|
+
|
|
4
|
+
#The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro, MuseScore, ABC notation, and many other formats * Browsing, updating, copying, exporting the user's scores (for example in MP3, WAV or MIDI) * Managing educational resources with Flat for Education: creating & updating the organization accounts, the classes, rosters and assignments. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2.26.1
|
|
7
|
+
Contact: developers@flat.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.24.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module FlatApi
|
|
17
|
+
class AddGroupUser200Response < ApiModelBase
|
|
18
|
+
# User ID that was added
|
|
19
|
+
attr_accessor :user
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'user' => :'user'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns attribute mapping this model knows about
|
|
29
|
+
def self.acceptable_attribute_map
|
|
30
|
+
attribute_map
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns all the JSON keys this model knows about
|
|
34
|
+
def self.acceptable_attributes
|
|
35
|
+
acceptable_attribute_map.values
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Attribute type mapping.
|
|
39
|
+
def self.openapi_types
|
|
40
|
+
{
|
|
41
|
+
:'user' => :'String'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# List of attributes with nullable: true
|
|
46
|
+
def self.openapi_nullable
|
|
47
|
+
Set.new([
|
|
48
|
+
])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Initializes the object
|
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
53
|
+
def initialize(attributes = {})
|
|
54
|
+
if (!attributes.is_a?(Hash))
|
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `FlatApi::AddGroupUser200Response` initialize method"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
59
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
60
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
61
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
62
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `FlatApi::AddGroupUser200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
63
|
+
end
|
|
64
|
+
h[k.to_sym] = v
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if attributes.key?(:'user')
|
|
68
|
+
self.user = attributes[:'user']
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
73
|
+
# @return Array for valid properties with the reasons
|
|
74
|
+
def list_invalid_properties
|
|
75
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
76
|
+
invalid_properties = Array.new
|
|
77
|
+
invalid_properties
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Check to see if the all the properties in the model are valid
|
|
81
|
+
# @return true if the model is valid
|
|
82
|
+
def valid?
|
|
83
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
84
|
+
true
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Checks equality by comparing each attribute.
|
|
88
|
+
# @param [Object] Object to be compared
|
|
89
|
+
def ==(o)
|
|
90
|
+
return true if self.equal?(o)
|
|
91
|
+
self.class == o.class &&
|
|
92
|
+
user == o.user
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @see the `==` method
|
|
96
|
+
# @param [Object] Object to be compared
|
|
97
|
+
def eql?(o)
|
|
98
|
+
self == o
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Calculates hash code according to all attributes.
|
|
102
|
+
# @return [Integer] Hash code
|
|
103
|
+
def hash
|
|
104
|
+
[user].hash
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Builds the object from hash
|
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
109
|
+
# @return [Object] Returns the model itself
|
|
110
|
+
def self.build_from_hash(attributes)
|
|
111
|
+
return nil unless attributes.is_a?(Hash)
|
|
112
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
113
|
+
transformed_hash = {}
|
|
114
|
+
openapi_types.each_pair do |key, type|
|
|
115
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
116
|
+
transformed_hash["#{key}"] = nil
|
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
118
|
+
# check to ensure the input is an array given that the attribute
|
|
119
|
+
# is documented as an array but the input is not
|
|
120
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
121
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
122
|
+
end
|
|
123
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
124
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
new(transformed_hash)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Returns the object in the form of hash
|
|
131
|
+
# @return [Hash] Returns the object in the form of hash
|
|
132
|
+
def to_hash
|
|
133
|
+
hash = {}
|
|
134
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
135
|
+
value = self.send(attr)
|
|
136
|
+
if value.nil?
|
|
137
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
138
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
hash[param] = _to_hash(value)
|
|
142
|
+
end
|
|
143
|
+
hash
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|