flat_api 0.2.0 → 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 +5 -5
- data/CHANGELOG.md +60 -8
- data/LICENSE +201 -0
- data/README.md +62 -241
- data/lib/flat_api/api/account_api.rb +32 -22
- data/lib/flat_api/api/class_api.rb +1671 -453
- data/lib/flat_api/api/collection_api.rb +286 -185
- data/lib/flat_api/api/edu_resources_api.rb +863 -0
- data/lib/flat_api/api/group_api.rb +506 -57
- data/lib/flat_api/api/omr_api.rb +894 -0
- data/lib/flat_api/api/organization_api.rb +808 -192
- data/lib/flat_api/api/score_api.rb +1030 -589
- data/lib/flat_api/api/task_api.rb +85 -0
- data/lib/flat_api/api/user_api.rb +151 -82
- data/lib/flat_api/api_client.rb +223 -145
- data/lib/flat_api/api_error.rb +24 -4
- data/lib/flat_api/api_model_base.rb +88 -0
- data/lib/flat_api/client.rb +69 -0
- data/lib/flat_api/configuration.rb +224 -36
- 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 +201 -0
- data/lib/flat_api/models/app_scopes.rb +61 -0
- data/lib/flat_api/models/assignment.rb +362 -166
- data/lib/flat_api/models/assignment_capabilities.rb +256 -0
- data/lib/flat_api/models/assignment_capabilities_can_publish_in_class_error.rb +193 -0
- data/lib/flat_api/models/assignment_copy.rb +79 -169
- data/lib/flat_api/models/assignment_copy_response.rb +535 -0
- data/lib/flat_api/models/assignment_copy_to_class.rb +186 -0
- data/lib/flat_api/models/assignment_copy_to_resource_library.rb +176 -0
- data/lib/flat_api/models/assignment_group.rb +232 -0
- data/lib/flat_api/models/assignment_submission.rb +337 -131
- data/lib/flat_api/models/assignment_submission_comment.rb +209 -0
- data/lib/flat_api/models/assignment_submission_comment_creation.rb +166 -0
- data/lib/flat_api/models/assignment_submission_comments.rb +158 -0
- data/lib/flat_api/models/assignment_submission_history.rb +337 -0
- data/lib/flat_api/models/assignment_submission_history_attachment.rb +168 -0
- data/lib/flat_api/models/assignment_submission_history_state.rb +43 -0
- data/lib/flat_api/models/assignment_submission_lti.rb +200 -0
- data/lib/flat_api/models/assignment_submission_playback.rb +193 -0
- data/lib/flat_api/models/assignment_submission_state.rb +42 -0
- data/lib/flat_api/models/assignment_submission_students_mode.rb +40 -0
- data/lib/flat_api/models/assignment_submission_update.rb +157 -113
- data/lib/flat_api/models/assignment_type.rb +45 -0
- data/lib/flat_api/models/assignment_update.rb +538 -0
- data/lib/flat_api/models/class_assignment.rb +750 -0
- data/lib/flat_api/models/class_assignment_all_of_canvas.rb +159 -0
- data/lib/flat_api/models/class_assignment_all_of_lti.rb +149 -0
- data/lib/flat_api/models/class_assignment_all_of_mfc.rb +159 -0
- data/lib/flat_api/models/class_assignment_update.rb +652 -0
- data/lib/flat_api/models/class_assignment_update_all_of_google_classroom.rb +150 -0
- data/lib/flat_api/models/class_assignment_update_all_of_microsoft_graph.rb +152 -0
- data/lib/flat_api/models/class_attachment_creation.rb +140 -106
- data/lib/flat_api/models/class_creation.rb +142 -108
- data/lib/flat_api/models/class_details.rb +244 -125
- data/lib/flat_api/models/class_details_canvas.rb +59 -99
- data/lib/flat_api/models/class_details_clever.rb +74 -113
- data/lib/flat_api/models/class_details_google_classroom.rb +64 -124
- data/lib/flat_api/models/class_details_google_drive.rb +61 -101
- data/lib/flat_api/models/class_details_issues.rb +151 -0
- data/lib/flat_api/models/class_details_issues_sync_inner.rb +203 -0
- data/lib/flat_api/models/class_details_lti.rb +76 -106
- data/lib/flat_api/models/class_details_mfc.rb +159 -0
- data/lib/flat_api/models/class_details_microsoft_graph.rb +148 -0
- data/lib/flat_api/models/class_grade_level.rb +43 -0
- data/lib/flat_api/models/class_roles.rb +18 -9
- data/lib/flat_api/models/class_state.rb +19 -9
- data/lib/flat_api/models/class_update.rb +142 -107
- data/lib/flat_api/models/collection.rb +304 -115
- data/lib/flat_api/models/collection_app.rb +169 -0
- data/lib/flat_api/models/collection_capabilities.rb +157 -112
- data/lib/flat_api/models/collection_contents.rb +166 -0
- data/lib/flat_api/models/collection_creation.rb +120 -104
- data/lib/flat_api/models/collection_modification.rb +122 -100
- data/lib/flat_api/models/collection_privacy.rb +18 -9
- data/lib/flat_api/models/collection_type.rb +22 -11
- data/lib/flat_api/models/credit_transaction.rb +388 -0
- data/lib/flat_api/models/edu_library.rb +273 -0
- data/lib/flat_api/models/edu_resource.rb +383 -0
- data/lib/flat_api/models/edu_resource_assignment_creation.rb +170 -0
- data/lib/flat_api/models/edu_resource_capabilities.rb +179 -0
- data/lib/flat_api/models/edu_resource_copy.rb +166 -0
- data/lib/flat_api/models/edu_resource_creation.rb +311 -0
- data/lib/flat_api/models/edu_resource_folder.rb +171 -0
- data/lib/flat_api/models/edu_resource_lti_link.rb +166 -0
- data/lib/flat_api/models/edu_resource_move.rb +166 -0
- data/lib/flat_api/models/edu_resource_privacy.rb +41 -0
- data/lib/flat_api/models/edu_resource_resource.rb +104 -0
- data/lib/flat_api/models/edu_resource_type.rb +40 -0
- data/lib/flat_api/models/edu_resource_update.rb +292 -0
- data/lib/flat_api/models/edu_resource_use_in_class.rb +176 -0
- data/lib/flat_api/models/flat_error_response.rb +109 -105
- data/lib/flat_api/models/google_classroom_coursework.rb +74 -103
- data/lib/flat_api/models/google_classroom_submission.rb +112 -101
- data/lib/flat_api/models/grade.rb +51 -0
- data/lib/flat_api/models/group.rb +70 -122
- data/lib/flat_api/models/group_creation.rb +238 -0
- data/lib/flat_api/models/group_details.rb +253 -110
- data/lib/flat_api/models/group_type.rb +20 -9
- data/lib/flat_api/models/license_mode.rb +18 -9
- data/lib/flat_api/models/license_sources.rb +21 -9
- data/lib/flat_api/models/lms_name.rb +19 -9
- 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 +108 -114
- data/lib/flat_api/models/lti_credentials_creation.rb +99 -103
- data/lib/flat_api/models/media_attachment.rb +189 -137
- data/lib/flat_api/models/media_score_sharing_mode.rb +19 -9
- data/lib/flat_api/models/microsoft_graph_assignment.rb +259 -0
- data/lib/flat_api/models/microsoft_graph_submission.rb +193 -0
- 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 +177 -109
- data/lib/flat_api/models/organization_invitation_creation.rb +97 -100
- data/lib/flat_api/models/organization_roles.rb +19 -10
- data/lib/flat_api/models/organization_user_access_token_creation.rb +168 -0
- data/lib/flat_api/models/rename_group_request.rb +165 -0
- data/lib/flat_api/models/resource_collaborator.rb +204 -116
- data/lib/flat_api/models/resource_collaborator_creation.rb +72 -112
- data/lib/flat_api/models/resource_rights.rb +168 -107
- data/lib/flat_api/models/score_comment.rb +200 -121
- data/lib/flat_api/models/score_comment_context.rb +161 -124
- data/lib/flat_api/models/score_comment_creation.rb +79 -107
- data/lib/flat_api/models/score_comment_moderation.rb +193 -0
- data/lib/flat_api/models/score_comment_update.rb +81 -115
- data/lib/flat_api/models/score_comments_counts.rb +78 -108
- data/lib/flat_api/models/score_creation.rb +80 -225
- data/lib/flat_api/models/score_creation_builder_data.rb +234 -0
- data/lib/flat_api/models/score_creation_builder_data_all_of_builder_data.rb +173 -0
- data/lib/flat_api/models/score_creation_builder_data_all_of_builder_data_layout_data.rb +255 -0
- data/lib/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data.rb +217 -0
- data/lib/flat_api/models/score_creation_builder_data_all_of_builder_data_score_data_instruments.rb +222 -0
- data/lib/flat_api/models/score_creation_common.rb +201 -0
- data/lib/flat_api/models/score_creation_file_import.rb +277 -0
- data/lib/flat_api/models/score_creation_google_drive_import.rb +234 -0
- data/lib/flat_api/models/score_creation_type.rb +18 -9
- data/lib/flat_api/models/score_details.rb +428 -146
- data/lib/flat_api/models/score_details_all_of_me.rb +193 -0
- data/lib/flat_api/models/score_fork.rb +84 -101
- data/lib/flat_api/models/score_license.rb +18 -9
- data/lib/flat_api/models/score_likes_counts.rb +73 -103
- data/lib/flat_api/models/score_modification.rb +178 -115
- data/lib/flat_api/models/score_plays_counts.rb +179 -0
- data/lib/flat_api/models/score_privacy.rb +18 -9
- data/lib/flat_api/models/score_revision.rb +142 -111
- data/lib/flat_api/models/score_revision_creation.rb +113 -105
- data/lib/flat_api/models/score_revision_statistics.rb +81 -101
- data/lib/flat_api/models/score_source.rb +59 -100
- data/lib/flat_api/models/score_summary.rb +172 -105
- data/lib/flat_api/models/score_track.rb +244 -117
- data/lib/flat_api/models/score_track_creation.rb +99 -104
- data/lib/flat_api/models/score_track_creation_response.rb +165 -0
- data/lib/flat_api/models/score_track_point.rb +78 -103
- data/lib/flat_api/models/score_track_purpose.rb +40 -0
- data/lib/flat_api/models/score_track_state.rb +18 -9
- data/lib/flat_api/models/score_track_type.rb +18 -9
- data/lib/flat_api/models/score_track_update.rb +98 -103
- data/lib/flat_api/models/score_views_counts.rb +73 -103
- data/lib/flat_api/models/task.rb +339 -0
- data/lib/flat_api/models/task_export_options.rb +151 -0
- data/lib/flat_api/models/task_progress.rb +159 -0
- data/lib/flat_api/models/task_result.rb +159 -0
- data/lib/flat_api/models/teaching_theme.rb +47 -0
- data/lib/flat_api/models/tutteo_product.rb +42 -0
- data/lib/flat_api/models/user_admin_update.rb +206 -106
- data/lib/flat_api/models/user_azure_details.rb +168 -0
- data/lib/flat_api/models/user_basics.rb +215 -120
- data/lib/flat_api/models/user_community_profile_links.rb +205 -0
- data/lib/flat_api/models/user_creation.rb +203 -114
- data/lib/flat_api/models/user_details.rb +331 -161
- data/lib/flat_api/models/user_details_admin.rb +272 -133
- data/lib/flat_api/models/user_details_admin_all_of_license.rb +211 -0
- data/lib/flat_api/models/user_public.rb +303 -145
- data/lib/flat_api/models/user_public_summary.rb +243 -126
- data/lib/flat_api/models/user_signin_link.rb +168 -0
- data/lib/flat_api/models/user_signin_link_creation.rb +150 -0
- 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 +5 -5
- data/lib/flat_api.rb +144 -16
- metadata +154 -434
- data/Gemfile +0 -7
- data/Rakefile +0 -8
- data/docs/AccountApi.md +0 -55
- data/docs/Assignment.md +0 -18
- data/docs/AssignmentCopy.md +0 -8
- data/docs/AssignmentCreation.md +0 -12
- data/docs/AssignmentSubmission.md +0 -19
- data/docs/AssignmentSubmissionUpdate.md +0 -11
- data/docs/ClassApi.md +0 -1051
- data/docs/ClassAttachmentCreation.md +0 -10
- data/docs/ClassCreation.md +0 -9
- data/docs/ClassDetails.md +0 -25
- data/docs/ClassDetailsCanvas.md +0 -9
- data/docs/ClassDetailsClever.md +0 -14
- data/docs/ClassDetailsGoogleClassroom.md +0 -11
- data/docs/ClassDetailsGoogleDrive.md +0 -9
- data/docs/ClassDetailsLti.md +0 -10
- data/docs/ClassRoles.md +0 -7
- data/docs/ClassState.md +0 -7
- data/docs/ClassUpdate.md +0 -9
- data/docs/Collection.md +0 -18
- data/docs/CollectionApi.md +0 -521
- data/docs/CollectionCapabilities.md +0 -12
- data/docs/CollectionCreation.md +0 -8
- data/docs/CollectionModification.md +0 -8
- data/docs/CollectionPrivacy.md +0 -7
- data/docs/CollectionTitle.md +0 -7
- data/docs/CollectionType.md +0 -7
- data/docs/FlatErrorResponse.md +0 -11
- data/docs/FlatLocales.md +0 -7
- data/docs/GoogleClassroomCoursework.md +0 -10
- data/docs/GoogleClassroomSubmission.md +0 -10
- data/docs/Group.md +0 -14
- data/docs/GroupApi.md +0 -167
- data/docs/GroupDetails.md +0 -14
- data/docs/GroupType.md +0 -7
- data/docs/LicenseMode.md +0 -7
- data/docs/LicenseSources.md +0 -7
- data/docs/LmsName.md +0 -7
- data/docs/LtiCredentials.md +0 -16
- data/docs/LtiCredentialsCreation.md +0 -9
- data/docs/MediaAttachment.md +0 -23
- data/docs/MediaScoreSharingMode.md +0 -7
- data/docs/OrganizationApi.md +0 -538
- data/docs/OrganizationInvitation.md +0 -14
- data/docs/OrganizationInvitationCreation.md +0 -9
- data/docs/OrganizationRoles.md +0 -7
- data/docs/ResourceCollaborator.md +0 -16
- data/docs/ResourceCollaboratorCreation.md +0 -14
- data/docs/ResourceRights.md +0 -10
- data/docs/ResourceSharingKey.md +0 -7
- data/docs/ScoreApi.md +0 -1658
- data/docs/ScoreComment.md +0 -22
- data/docs/ScoreCommentContext.md +0 -14
- data/docs/ScoreCommentCreation.md +0 -13
- data/docs/ScoreCommentUpdate.md +0 -11
- data/docs/ScoreCommentsCounts.md +0 -11
- data/docs/ScoreCreation.md +0 -14
- data/docs/ScoreCreationType.md +0 -7
- data/docs/ScoreData.md +0 -7
- data/docs/ScoreDataEncoding.md +0 -7
- data/docs/ScoreDetails.md +0 -36
- data/docs/ScoreFork.md +0 -8
- data/docs/ScoreLicense.md +0 -7
- data/docs/ScoreLikesCounts.md +0 -10
- data/docs/ScoreModification.md +0 -14
- data/docs/ScorePrivacy.md +0 -7
- data/docs/ScoreRevision.md +0 -14
- data/docs/ScoreRevisionCreation.md +0 -11
- data/docs/ScoreRevisionStatistics.md +0 -9
- data/docs/ScoreSource.md +0 -8
- data/docs/ScoreSummary.md +0 -13
- data/docs/ScoreTrack.md +0 -19
- data/docs/ScoreTrackCreation.md +0 -12
- data/docs/ScoreTrackPoint.md +0 -10
- data/docs/ScoreTrackState.md +0 -7
- data/docs/ScoreTrackType.md +0 -7
- data/docs/ScoreTrackUpdate.md +0 -11
- data/docs/ScoreViewsCounts.md +0 -10
- data/docs/UserAdminUpdate.md +0 -9
- data/docs/UserApi.md +0 -173
- data/docs/UserBasics.md +0 -13
- data/docs/UserCreation.md +0 -11
- data/docs/UserDetails.md +0 -28
- data/docs/UserDetailsAdmin.md +0 -20
- data/docs/UserDetailsAdminLicense.md +0 -12
- data/docs/UserInstruments.md +0 -7
- data/docs/UserPublic.md +0 -25
- data/docs/UserPublicSummary.md +0 -17
- data/flat_api.gemspec +0 -48
- data/lib/flat_api/models/assignment_creation.rb +0 -230
- data/lib/flat_api/models/collection_title.rb +0 -179
- data/lib/flat_api/models/flat_locales.rb +0 -36
- data/lib/flat_api/models/resource_sharing_key.rb +0 -179
- data/lib/flat_api/models/score_data.rb +0 -179
- data/lib/flat_api/models/score_data_encoding.rb +0 -30
- data/lib/flat_api/models/user_details_admin_license.rb +0 -227
- data/lib/flat_api/models/user_instruments.rb +0 -179
- data/spec/api/account_api_spec.rb +0 -46
- data/spec/api/class_api_spec.rb +0 -278
- data/spec/api/collection_api_spec.rb +0 -159
- data/spec/api/group_api_spec.rb +0 -72
- data/spec/api/organization_api_spec.rb +0 -162
- data/spec/api/score_api_spec.rb +0 -426
- data/spec/api/user_api_spec.rb +0 -73
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/assignment_copy_spec.rb +0 -42
- data/spec/models/assignment_creation_spec.rb +0 -66
- data/spec/models/assignment_spec.rb +0 -106
- data/spec/models/assignment_submission_spec.rb +0 -108
- data/spec/models/assignment_submission_update_spec.rb +0 -60
- data/spec/models/class_attachment_creation_spec.rb +0 -58
- data/spec/models/class_creation_spec.rb +0 -48
- data/spec/models/class_details_canvas_spec.rb +0 -48
- data/spec/models/class_details_clever_spec.rb +0 -82
- data/spec/models/class_details_google_classroom_spec.rb +0 -60
- data/spec/models/class_details_google_drive_spec.rb +0 -48
- data/spec/models/class_details_lti_spec.rb +0 -54
- data/spec/models/class_details_spec.rb +0 -144
- data/spec/models/class_roles_spec.rb +0 -36
- data/spec/models/class_state_spec.rb +0 -36
- data/spec/models/class_update_spec.rb +0 -48
- data/spec/models/collection_capabilities_spec.rb +0 -66
- 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 -36
- data/spec/models/collection_spec.rb +0 -102
- data/spec/models/collection_title_spec.rb +0 -36
- data/spec/models/collection_type_spec.rb +0 -36
- data/spec/models/flat_error_response_spec.rb +0 -60
- data/spec/models/flat_locales_spec.rb +0 -36
- data/spec/models/google_classroom_coursework_spec.rb +0 -54
- data/spec/models/google_classroom_submission_spec.rb +0 -54
- data/spec/models/group_details_spec.rb +0 -78
- data/spec/models/group_spec.rb +0 -82
- data/spec/models/group_type_spec.rb +0 -36
- data/spec/models/license_mode_spec.rb +0 -36
- data/spec/models/license_sources_spec.rb +0 -36
- data/spec/models/lms_name_spec.rb +0 -36
- data/spec/models/lti_credentials_creation_spec.rb +0 -48
- data/spec/models/lti_credentials_spec.rb +0 -90
- data/spec/models/media_attachment_spec.rb +0 -136
- data/spec/models/media_score_sharing_mode_spec.rb +0 -36
- data/spec/models/organization_invitation_creation_spec.rb +0 -48
- data/spec/models/organization_invitation_spec.rb +0 -78
- data/spec/models/organization_roles_spec.rb +0 -36
- data/spec/models/resource_collaborator_creation_spec.rb +0 -78
- data/spec/models/resource_collaborator_spec.rb +0 -90
- data/spec/models/resource_rights_spec.rb +0 -54
- data/spec/models/resource_sharing_key_spec.rb +0 -36
- data/spec/models/score_comment_context_spec.rb +0 -78
- data/spec/models/score_comment_creation_spec.rb +0 -72
- data/spec/models/score_comment_spec.rb +0 -130
- data/spec/models/score_comment_update_spec.rb +0 -60
- data/spec/models/score_comments_counts_spec.rb +0 -60
- data/spec/models/score_creation_spec.rb +0 -78
- data/spec/models/score_creation_type_spec.rb +0 -36
- data/spec/models/score_data_encoding_spec.rb +0 -36
- data/spec/models/score_data_spec.rb +0 -36
- data/spec/models/score_details_spec.rb +0 -210
- data/spec/models/score_fork_spec.rb +0 -42
- data/spec/models/score_license_spec.rb +0 -36
- data/spec/models/score_likes_counts_spec.rb +0 -54
- data/spec/models/score_modification_spec.rb +0 -78
- data/spec/models/score_privacy_spec.rb +0 -36
- data/spec/models/score_revision_creation_spec.rb +0 -60
- data/spec/models/score_revision_spec.rb +0 -78
- data/spec/models/score_revision_statistics_spec.rb +0 -48
- data/spec/models/score_source_spec.rb +0 -42
- data/spec/models/score_summary_spec.rb +0 -72
- data/spec/models/score_track_creation_spec.rb +0 -66
- data/spec/models/score_track_point_spec.rb +0 -58
- data/spec/models/score_track_spec.rb +0 -108
- data/spec/models/score_track_state_spec.rb +0 -36
- data/spec/models/score_track_type_spec.rb +0 -36
- data/spec/models/score_track_update_spec.rb +0 -60
- data/spec/models/score_views_counts_spec.rb +0 -54
- data/spec/models/user_admin_update_spec.rb +0 -48
- data/spec/models/user_basics_spec.rb +0 -72
- data/spec/models/user_creation_spec.rb +0 -60
- data/spec/models/user_details_admin_license_spec.rb +0 -66
- data/spec/models/user_details_admin_spec.rb +0 -114
- data/spec/models/user_details_spec.rb +0 -166
- data/spec/models/user_instruments_spec.rb +0 -36
- data/spec/models/user_public_spec.rb +0 -144
- data/spec/models/user_public_summary_spec.rb +0 -96
- data/spec/spec_helper.rb +0 -111
|
@@ -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,17 +1,15 @@
|
|
|
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
|
|
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
|
-
OpenAPI
|
|
6
|
+
The version of the OpenAPI document: 2.26.1
|
|
7
7
|
Contact: developers@flat.io
|
|
8
|
-
Generated by: https://
|
|
9
|
-
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.24.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
|
-
require 'uri'
|
|
14
|
-
|
|
15
13
|
module FlatApi
|
|
16
14
|
class Configuration
|
|
17
15
|
# Defines url scheme
|
|
@@ -23,6 +21,18 @@ module FlatApi
|
|
|
23
21
|
# Defines url base path
|
|
24
22
|
attr_accessor :base_path
|
|
25
23
|
|
|
24
|
+
# Define server configuration index
|
|
25
|
+
attr_accessor :server_index
|
|
26
|
+
|
|
27
|
+
# Define server operation configuration index
|
|
28
|
+
attr_accessor :server_operation_index
|
|
29
|
+
|
|
30
|
+
# Default server variables
|
|
31
|
+
attr_accessor :server_variables
|
|
32
|
+
|
|
33
|
+
# Default server operation variables
|
|
34
|
+
attr_accessor :server_operation_variables
|
|
35
|
+
|
|
26
36
|
# Defines API keys used with API Key authentications.
|
|
27
37
|
#
|
|
28
38
|
# @return [Hash] key: parameter name, value: parameter value (API key)
|
|
@@ -52,6 +62,16 @@ module FlatApi
|
|
|
52
62
|
# Defines the access token (Bearer) used with OAuth2.
|
|
53
63
|
attr_accessor :access_token
|
|
54
64
|
|
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
|
66
|
+
# Overrides the access_token if set
|
|
67
|
+
# @return [Proc]
|
|
68
|
+
attr_accessor :access_token_getter
|
|
69
|
+
|
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
|
72
|
+
# Default to false.
|
|
73
|
+
attr_accessor :return_binary_data
|
|
74
|
+
|
|
55
75
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
|
56
76
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
|
57
77
|
# Default to false.
|
|
@@ -59,6 +79,14 @@ module FlatApi
|
|
|
59
79
|
# @return [true, false]
|
|
60
80
|
attr_accessor :debugging
|
|
61
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
|
+
|
|
62
90
|
# Defines the logger used for debugging.
|
|
63
91
|
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
|
64
92
|
#
|
|
@@ -76,6 +104,10 @@ module FlatApi
|
|
|
76
104
|
# Default to 0 (never times out).
|
|
77
105
|
attr_accessor :timeout
|
|
78
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
|
+
|
|
79
111
|
# Set this to false to skip client side validation in the operation.
|
|
80
112
|
# Default to true.
|
|
81
113
|
# @return [true, false]
|
|
@@ -88,40 +120,40 @@ module FlatApi
|
|
|
88
120
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
|
89
121
|
#
|
|
90
122
|
# @return [true, false]
|
|
91
|
-
attr_accessor :
|
|
123
|
+
attr_accessor :ssl_verify
|
|
92
124
|
|
|
93
125
|
### TLS/SSL setting
|
|
94
|
-
#
|
|
95
|
-
# Default to true.
|
|
126
|
+
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
|
|
96
127
|
#
|
|
97
128
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
|
98
129
|
#
|
|
99
|
-
|
|
100
|
-
attr_accessor :verify_ssl_host
|
|
130
|
+
attr_accessor :ssl_verify_mode
|
|
101
131
|
|
|
102
132
|
### TLS/SSL setting
|
|
103
133
|
# Set this to customize the certificate file to verify the peer.
|
|
104
134
|
#
|
|
105
135
|
# @return [String] the path to the certificate file
|
|
106
|
-
|
|
107
|
-
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
|
108
|
-
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
|
109
|
-
attr_accessor :ssl_ca_cert
|
|
136
|
+
attr_accessor :ssl_ca_file
|
|
110
137
|
|
|
111
138
|
### TLS/SSL setting
|
|
112
139
|
# Client certificate file (for client certificate)
|
|
113
|
-
attr_accessor :
|
|
140
|
+
attr_accessor :ssl_client_cert
|
|
114
141
|
|
|
115
142
|
### TLS/SSL setting
|
|
116
143
|
# Client private key file (for client certificate)
|
|
117
|
-
attr_accessor :
|
|
144
|
+
attr_accessor :ssl_client_key
|
|
145
|
+
|
|
146
|
+
### Proxy setting
|
|
147
|
+
# HTTP Proxy settings
|
|
148
|
+
attr_accessor :proxy
|
|
118
149
|
|
|
119
|
-
# Set this to customize parameters
|
|
120
|
-
# Default to nil.
|
|
150
|
+
# Set this to customize parameters encoder of array parameter.
|
|
151
|
+
# Default to nil. Faraday uses NestedParamsEncoder when nil.
|
|
121
152
|
#
|
|
122
|
-
# @see The
|
|
123
|
-
# https://github.com/
|
|
124
|
-
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
|
|
156
|
+
|
|
125
157
|
|
|
126
158
|
attr_accessor :inject_format
|
|
127
159
|
|
|
@@ -131,16 +163,27 @@ module FlatApi
|
|
|
131
163
|
@scheme = 'https'
|
|
132
164
|
@host = 'api.flat.io'
|
|
133
165
|
@base_path = '/v2'
|
|
166
|
+
@server_index = nil
|
|
167
|
+
@server_operation_index = {}
|
|
168
|
+
@server_variables = {}
|
|
169
|
+
@server_operation_variables = {}
|
|
134
170
|
@api_key = {}
|
|
135
171
|
@api_key_prefix = {}
|
|
136
|
-
@timeout = 0
|
|
137
172
|
@client_side_validation = true
|
|
138
|
-
@
|
|
139
|
-
@
|
|
140
|
-
@
|
|
141
|
-
@
|
|
142
|
-
@
|
|
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
|
|
143
185
|
@debugging = false
|
|
186
|
+
@ignore_operation_servers = false
|
|
144
187
|
@inject_format = false
|
|
145
188
|
@force_ending_format = false
|
|
146
189
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
|
@@ -170,24 +213,38 @@ module FlatApi
|
|
|
170
213
|
def base_path=(base_path)
|
|
171
214
|
# Add leading and trailing slashes to base_path
|
|
172
215
|
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
|
173
|
-
@base_path =
|
|
216
|
+
@base_path = '' if @base_path == '/'
|
|
174
217
|
end
|
|
175
218
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
219
|
+
# Returns base URL for specified operation based on server settings
|
|
220
|
+
def base_url(operation = nil)
|
|
221
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
|
|
222
|
+
if operation_server_settings.key?(operation) then
|
|
223
|
+
index = server_operation_index.fetch(operation, server_index)
|
|
224
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
|
225
|
+
else
|
|
226
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
|
227
|
+
end
|
|
179
228
|
end
|
|
180
229
|
|
|
181
230
|
# Gets API key (with prefix if set).
|
|
182
231
|
# @param [String] param_name the parameter name of API key auth
|
|
183
|
-
def api_key_with_prefix(param_name)
|
|
232
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
|
233
|
+
key = @api_key[param_name]
|
|
234
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
|
184
235
|
if @api_key_prefix[param_name]
|
|
185
|
-
"#{@api_key_prefix[param_name]} #{
|
|
236
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
|
186
237
|
else
|
|
187
|
-
|
|
238
|
+
key
|
|
188
239
|
end
|
|
189
240
|
end
|
|
190
241
|
|
|
242
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
|
243
|
+
def access_token_with_refresh
|
|
244
|
+
return access_token if access_token_getter.nil?
|
|
245
|
+
access_token_getter.call
|
|
246
|
+
end
|
|
247
|
+
|
|
191
248
|
# Gets Basic Auth token string
|
|
192
249
|
def basic_auth_token
|
|
193
250
|
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
|
@@ -201,9 +258,140 @@ module FlatApi
|
|
|
201
258
|
type: 'oauth2',
|
|
202
259
|
in: 'header',
|
|
203
260
|
key: 'Authorization',
|
|
204
|
-
value: "Bearer #{
|
|
261
|
+
value: "Bearer #{access_token_with_refresh}"
|
|
205
262
|
},
|
|
206
263
|
}
|
|
207
264
|
end
|
|
265
|
+
|
|
266
|
+
# Returns an array of Server setting
|
|
267
|
+
def server_settings
|
|
268
|
+
[
|
|
269
|
+
{
|
|
270
|
+
url: "https://api.flat.io/v2",
|
|
271
|
+
description: "No description provided",
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def operation_server_settings
|
|
277
|
+
{
|
|
278
|
+
}
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Returns URL based on server settings
|
|
282
|
+
#
|
|
283
|
+
# @param index array index of the server settings
|
|
284
|
+
# @param variables hash of variable and the corresponding value
|
|
285
|
+
def server_url(index, variables = {}, servers = nil)
|
|
286
|
+
servers = server_settings if servers == nil
|
|
287
|
+
|
|
288
|
+
# check array index out of bound
|
|
289
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
|
290
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
server = servers[index]
|
|
294
|
+
url = server[:url]
|
|
295
|
+
|
|
296
|
+
return url unless server.key? :variables
|
|
297
|
+
|
|
298
|
+
# go through variable and assign a value
|
|
299
|
+
server[:variables].each do |name, variable|
|
|
300
|
+
if variables.key?(name)
|
|
301
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
|
302
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
|
303
|
+
else
|
|
304
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
|
305
|
+
end
|
|
306
|
+
else
|
|
307
|
+
# use default value
|
|
308
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
url
|
|
313
|
+
end
|
|
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
|
|
395
|
+
|
|
208
396
|
end
|
|
209
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
|