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
data/lib/flat_api/api_client.rb
CHANGED
|
@@ -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
|
|
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
|
|
|
@@ -14,8 +14,11 @@ require 'date'
|
|
|
14
14
|
require 'json'
|
|
15
15
|
require 'logger'
|
|
16
16
|
require 'tempfile'
|
|
17
|
-
require '
|
|
18
|
-
require '
|
|
17
|
+
require 'time'
|
|
18
|
+
require 'faraday'
|
|
19
|
+
require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
|
20
|
+
require 'marcel'
|
|
21
|
+
|
|
19
22
|
|
|
20
23
|
module FlatApi
|
|
21
24
|
class ApiClient
|
|
@@ -31,9 +34,9 @@ module FlatApi
|
|
|
31
34
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
|
32
35
|
def initialize(config = Configuration.default)
|
|
33
36
|
@config = config
|
|
34
|
-
@user_agent = "
|
|
37
|
+
@user_agent = "Flat-SDK-Ruby/#{FlatApi::VERSION} (ruby/#{RUBY_VERSION})"
|
|
35
38
|
@default_headers = {
|
|
36
|
-
'Content-Type' =>
|
|
39
|
+
'Content-Type' => 'application/json',
|
|
37
40
|
'User-Agent' => @user_agent
|
|
38
41
|
}
|
|
39
42
|
end
|
|
@@ -44,37 +47,72 @@ module FlatApi
|
|
|
44
47
|
|
|
45
48
|
# Call an API with given options.
|
|
46
49
|
#
|
|
47
|
-
# @return [Array<(Object,
|
|
50
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
|
48
51
|
# the data deserialized from response body (could be nil), response status code and response headers.
|
|
52
|
+
# BEGIN retry wrapper (tools/patches/20_errors.py)
|
|
53
|
+
# Every request goes through the retry policy, which is why it wraps call_api_once rather
|
|
54
|
+
# than living in each of the generated methods. The decision needs the typed error and not the
|
|
55
|
+
# status code: Flat returns 403 both for rate limiting and for a genuine authorization failure,
|
|
56
|
+
# and only the response body's +code+ separates them. See RetryPolicy.
|
|
49
57
|
def call_api(http_method, path, opts = {})
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
policy = @config.retry_policy || RetryPolicy.disabled
|
|
59
|
+
attempt = 0
|
|
60
|
+
|
|
61
|
+
begin
|
|
62
|
+
attempt += 1
|
|
63
|
+
call_api_once(http_method, path, opts)
|
|
64
|
+
rescue StandardError => e
|
|
65
|
+
raise unless policy.should_retry?(e, http_method, attempt)
|
|
52
66
|
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
sleep(policy.delay_for(e, attempt))
|
|
68
|
+
retry
|
|
55
69
|
end
|
|
70
|
+
end
|
|
71
|
+
# END retry wrapper (tools/patches/20_errors.py)
|
|
56
72
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
:response_body => response.body),
|
|
68
|
-
response.status_message
|
|
73
|
+
def call_api_once(http_method, path, opts = {})
|
|
74
|
+
stream = nil
|
|
75
|
+
begin
|
|
76
|
+
response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
|
|
77
|
+
request = build_request(http_method, path, req, opts)
|
|
78
|
+
stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if config.debugging
|
|
82
|
+
config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
|
69
83
|
end
|
|
84
|
+
|
|
85
|
+
unless response.success?
|
|
86
|
+
if response.status == 0 && response.respond_to?(:return_message)
|
|
87
|
+
# Errors from libcurl will be made visible here
|
|
88
|
+
fail ApiError.new(code: 0,
|
|
89
|
+
message: response.return_message)
|
|
90
|
+
else
|
|
91
|
+
fail FlatApi.error_from_response(
|
|
92
|
+
response.status,
|
|
93
|
+
(begin
|
|
94
|
+
JSON.parse(response.body)
|
|
95
|
+
rescue StandardError
|
|
96
|
+
response.body
|
|
97
|
+
end),
|
|
98
|
+
response.headers || {}
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
rescue Faraday::TimeoutError
|
|
103
|
+
fail ApiError.new('Connection timed out')
|
|
104
|
+
rescue Faraday::ConnectionFailed
|
|
105
|
+
fail ApiError.new('Connection failed')
|
|
70
106
|
end
|
|
71
107
|
|
|
72
|
-
if opts[:return_type]
|
|
108
|
+
if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
|
|
109
|
+
data = deserialize_file(response, stream)
|
|
110
|
+
elsif opts[:return_type]
|
|
73
111
|
data = deserialize(response, opts[:return_type])
|
|
74
112
|
else
|
|
75
113
|
data = nil
|
|
76
114
|
end
|
|
77
|
-
return data, response.
|
|
115
|
+
return data, response.status, response.headers
|
|
78
116
|
end
|
|
79
117
|
|
|
80
118
|
# Builds the HTTP request
|
|
@@ -85,9 +123,9 @@ module FlatApi
|
|
|
85
123
|
# @option opts [Hash] :query_params Query parameters
|
|
86
124
|
# @option opts [Hash] :form_params Query parameters
|
|
87
125
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
|
88
|
-
# @return [
|
|
89
|
-
def build_request(http_method, path, opts = {})
|
|
90
|
-
url = build_request_url(path)
|
|
126
|
+
# @return [Faraday::Request] A Faraday Request
|
|
127
|
+
def build_request(http_method, path, request, opts = {})
|
|
128
|
+
url = build_request_url(path, opts)
|
|
91
129
|
http_method = http_method.to_sym.downcase
|
|
92
130
|
|
|
93
131
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
|
@@ -96,38 +134,144 @@ module FlatApi
|
|
|
96
134
|
|
|
97
135
|
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
|
98
136
|
|
|
99
|
-
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
|
100
|
-
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
|
101
|
-
|
|
102
|
-
req_opts = {
|
|
103
|
-
:method => http_method,
|
|
104
|
-
:headers => header_params,
|
|
105
|
-
:params => query_params,
|
|
106
|
-
:params_encoding => @config.params_encoding,
|
|
107
|
-
:timeout => @config.timeout,
|
|
108
|
-
:ssl_verifypeer => @config.verify_ssl,
|
|
109
|
-
:ssl_verifyhost => _verify_ssl_host,
|
|
110
|
-
:sslcert => @config.cert_file,
|
|
111
|
-
:sslkey => @config.key_file,
|
|
112
|
-
:verbose => @config.debugging
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
# set custom cert, if provided
|
|
116
|
-
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
|
117
|
-
|
|
118
137
|
if [:post, :patch, :put, :delete].include?(http_method)
|
|
119
138
|
req_body = build_request_body(header_params, form_params, opts[:body])
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
|
139
|
+
if config.debugging
|
|
140
|
+
config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
|
123
141
|
end
|
|
124
142
|
end
|
|
143
|
+
request.headers = header_params
|
|
144
|
+
request.body = req_body
|
|
145
|
+
|
|
146
|
+
# Overload default options only if provided
|
|
147
|
+
request.options.params_encoder = config.params_encoder if config.params_encoder
|
|
148
|
+
request.options.timeout = config.timeout if config.timeout
|
|
125
149
|
|
|
126
|
-
request
|
|
127
|
-
|
|
150
|
+
request.url url
|
|
151
|
+
request.params = query_params
|
|
128
152
|
request
|
|
129
153
|
end
|
|
130
154
|
|
|
155
|
+
# Builds the HTTP request body
|
|
156
|
+
#
|
|
157
|
+
# @param [Hash] header_params Header parameters
|
|
158
|
+
# @param [Hash] form_params Query parameters
|
|
159
|
+
# @param [Object] body HTTP body (JSON/XML)
|
|
160
|
+
# @return [String] HTTP body data in the form of string
|
|
161
|
+
def build_request_body(header_params, form_params, body)
|
|
162
|
+
# http form
|
|
163
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
|
|
164
|
+
data = URI.encode_www_form(form_params)
|
|
165
|
+
elsif header_params['Content-Type'] == 'multipart/form-data'
|
|
166
|
+
data = {}
|
|
167
|
+
form_params.each do |key, value|
|
|
168
|
+
case value
|
|
169
|
+
when ::File, ::Tempfile
|
|
170
|
+
data[key] = Faraday::FilePart.new(value.path, Marcel::MimeType.for(Pathname.new(value.path)))
|
|
171
|
+
when ::Array, nil
|
|
172
|
+
# let Faraday handle Array and nil parameters
|
|
173
|
+
data[key] = value
|
|
174
|
+
else
|
|
175
|
+
data[key] = value.to_s
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
elsif body
|
|
179
|
+
data = body.is_a?(String) ? body : body.to_json
|
|
180
|
+
else
|
|
181
|
+
data = nil
|
|
182
|
+
end
|
|
183
|
+
data
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def download_file(request)
|
|
187
|
+
stream = []
|
|
188
|
+
|
|
189
|
+
# handle streaming Responses
|
|
190
|
+
request.options.on_data = Proc.new do |chunk, overall_received_bytes|
|
|
191
|
+
stream << chunk
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
stream
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def deserialize_file(response, stream)
|
|
198
|
+
body = response.body
|
|
199
|
+
encoding = body.encoding
|
|
200
|
+
|
|
201
|
+
# reconstruct content
|
|
202
|
+
content = stream.join
|
|
203
|
+
content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'binary'
|
|
204
|
+
content = content.force_encoding(encoding)
|
|
205
|
+
|
|
206
|
+
# return byte stream
|
|
207
|
+
return content if @config.return_binary_data == true
|
|
208
|
+
|
|
209
|
+
# return file instead of binary data
|
|
210
|
+
content_disposition = response.headers['Content-Disposition']
|
|
211
|
+
if content_disposition && content_disposition =~ /filename=/i
|
|
212
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
|
213
|
+
prefix = sanitize_filename(filename)
|
|
214
|
+
else
|
|
215
|
+
prefix = 'download-'
|
|
216
|
+
end
|
|
217
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
218
|
+
|
|
219
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
220
|
+
tempfile.write(content)
|
|
221
|
+
tempfile.close
|
|
222
|
+
|
|
223
|
+
config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
224
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
225
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
226
|
+
"explicitly with `tempfile.delete`"
|
|
227
|
+
tempfile
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def connection(opts)
|
|
231
|
+
opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def connection_multipart
|
|
235
|
+
@connection_multipart ||= build_connection do |conn|
|
|
236
|
+
conn.request :multipart
|
|
237
|
+
conn.request :url_encoded
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def connection_regular
|
|
242
|
+
@connection_regular ||= build_connection
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def build_connection
|
|
246
|
+
Faraday.new(url: config.base_url, ssl: ssl_options, proxy: config.proxy) do |conn|
|
|
247
|
+
basic_auth(conn)
|
|
248
|
+
config.configure_middleware(conn)
|
|
249
|
+
yield(conn) if block_given?
|
|
250
|
+
conn.adapter(Faraday.default_adapter)
|
|
251
|
+
config.configure_connection(conn)
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def ssl_options
|
|
256
|
+
{
|
|
257
|
+
ca_file: config.ssl_ca_file,
|
|
258
|
+
verify: config.ssl_verify,
|
|
259
|
+
verify_mode: config.ssl_verify_mode,
|
|
260
|
+
client_cert: config.ssl_client_cert,
|
|
261
|
+
client_key: config.ssl_client_key
|
|
262
|
+
}
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
def basic_auth(conn)
|
|
266
|
+
if config.username && config.password
|
|
267
|
+
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
|
268
|
+
conn.request(:authorization, :basic, config.username, config.password)
|
|
269
|
+
else
|
|
270
|
+
conn.request(:basic_auth, config.username, config.password)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
|
|
131
275
|
# Check if the given MIME is a JSON MIME.
|
|
132
276
|
# JSON MIME examples:
|
|
133
277
|
# application/json
|
|
@@ -137,24 +281,19 @@ module FlatApi
|
|
|
137
281
|
# @param [String] mime MIME
|
|
138
282
|
# @return [Boolean] True if the MIME is application/json
|
|
139
283
|
def json_mime?(mime)
|
|
140
|
-
|
|
284
|
+
(mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
|
|
141
285
|
end
|
|
142
286
|
|
|
143
287
|
# Deserialize the response to the given return type.
|
|
144
288
|
#
|
|
145
289
|
# @param [Response] response HTTP response
|
|
146
|
-
# @param [String] return_type some examples: "User", "Array
|
|
290
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
|
147
291
|
def deserialize(response, return_type)
|
|
148
292
|
body = response.body
|
|
149
|
-
|
|
150
|
-
# handle file downloading - return the File instance processed in request callbacks
|
|
151
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
|
152
|
-
return @tempfile if return_type == 'File'
|
|
153
|
-
|
|
154
293
|
return nil if body.nil? || body.empty?
|
|
155
294
|
|
|
156
295
|
# return response body directly for String return type
|
|
157
|
-
return body if return_type == 'String'
|
|
296
|
+
return body.to_s if return_type == 'String'
|
|
158
297
|
|
|
159
298
|
# ensuring a default content type
|
|
160
299
|
content_type = response.headers['Content-Type'] || 'application/json'
|
|
@@ -164,7 +303,7 @@ module FlatApi
|
|
|
164
303
|
begin
|
|
165
304
|
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
|
166
305
|
rescue JSON::ParserError => e
|
|
167
|
-
if %w(String Date
|
|
306
|
+
if %w(String Date Time).include?(return_type)
|
|
168
307
|
data = body
|
|
169
308
|
else
|
|
170
309
|
raise e
|
|
@@ -187,11 +326,11 @@ module FlatApi
|
|
|
187
326
|
data.to_i
|
|
188
327
|
when 'Float'
|
|
189
328
|
data.to_f
|
|
190
|
-
when '
|
|
329
|
+
when 'Boolean'
|
|
191
330
|
data == true
|
|
192
|
-
when '
|
|
331
|
+
when 'Time'
|
|
193
332
|
# parse date time (expecting ISO 8601 format)
|
|
194
|
-
|
|
333
|
+
Time.parse data
|
|
195
334
|
when 'Date'
|
|
196
335
|
# parse date time (expecting ISO 8601 format)
|
|
197
336
|
Date.parse data
|
|
@@ -201,54 +340,21 @@ module FlatApi
|
|
|
201
340
|
when /\AArray<(.+)>\z/
|
|
202
341
|
# e.g. Array<Pet>
|
|
203
342
|
sub_type = $1
|
|
204
|
-
data.map {|item| convert_to_type(item, sub_type) }
|
|
343
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
|
205
344
|
when /\AHash\<String, (.+)\>\z/
|
|
206
345
|
# e.g. Hash<String, Integer>
|
|
207
346
|
sub_type = $1
|
|
208
347
|
{}.tap do |hash|
|
|
209
|
-
data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }
|
|
348
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
|
210
349
|
end
|
|
211
350
|
else
|
|
212
|
-
# models
|
|
213
|
-
FlatApi.const_get(return_type)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
|
220
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
|
221
|
-
# The response body is written to the file in chunks in order to handle files which
|
|
222
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
|
223
|
-
# process can use.
|
|
224
|
-
#
|
|
225
|
-
# @see Configuration#temp_folder_path
|
|
226
|
-
def download_file(request)
|
|
227
|
-
tempfile = nil
|
|
228
|
-
encoding = nil
|
|
229
|
-
request.on_headers do |response|
|
|
230
|
-
content_disposition = response.headers['Content-Disposition']
|
|
231
|
-
if content_disposition and content_disposition =~ /filename=/i
|
|
232
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
|
233
|
-
prefix = sanitize_filename(filename)
|
|
351
|
+
# models (e.g. Pet) or oneOf/anyOf
|
|
352
|
+
klass = FlatApi.const_get(return_type)
|
|
353
|
+
if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
|
|
354
|
+
klass.build(data)
|
|
234
355
|
else
|
|
235
|
-
|
|
356
|
+
klass.build_from_hash(data)
|
|
236
357
|
end
|
|
237
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
238
|
-
encoding = response.body.encoding
|
|
239
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
240
|
-
@tempfile = tempfile
|
|
241
|
-
end
|
|
242
|
-
request.on_body do |chunk|
|
|
243
|
-
chunk.force_encoding(encoding)
|
|
244
|
-
tempfile.write(chunk)
|
|
245
|
-
end
|
|
246
|
-
request.on_complete do |response|
|
|
247
|
-
tempfile.close
|
|
248
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
|
249
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
|
250
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
|
251
|
-
"explicitly with `tempfile.delete`"
|
|
252
358
|
end
|
|
253
359
|
end
|
|
254
360
|
|
|
@@ -258,44 +364,16 @@ module FlatApi
|
|
|
258
364
|
# @param [String] filename the filename to be sanitized
|
|
259
365
|
# @return [String] the sanitized filename
|
|
260
366
|
def sanitize_filename(filename)
|
|
261
|
-
filename.
|
|
367
|
+
filename.split(/[\/\\]/).last
|
|
262
368
|
end
|
|
263
369
|
|
|
264
|
-
def build_request_url(path)
|
|
370
|
+
def build_request_url(path, opts = {})
|
|
265
371
|
# Add leading and trailing slashes to path
|
|
266
372
|
path = "/#{path}".gsub(/\/+/, '/')
|
|
267
|
-
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
# Builds the HTTP request body
|
|
271
|
-
#
|
|
272
|
-
# @param [Hash] header_params Header parameters
|
|
273
|
-
# @param [Hash] form_params Query parameters
|
|
274
|
-
# @param [Object] body HTTP body (JSON/XML)
|
|
275
|
-
# @return [String] HTTP body data in the form of string
|
|
276
|
-
def build_request_body(header_params, form_params, body)
|
|
277
|
-
# http form
|
|
278
|
-
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
|
279
|
-
header_params['Content-Type'] == 'multipart/form-data'
|
|
280
|
-
data = {}
|
|
281
|
-
form_params.each do |key, value|
|
|
282
|
-
case value
|
|
283
|
-
when ::File, ::Array, nil
|
|
284
|
-
# let typhoeus handle File, Array and nil parameters
|
|
285
|
-
data[key] = value
|
|
286
|
-
else
|
|
287
|
-
data[key] = value.to_s
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
elsif body
|
|
291
|
-
data = body.is_a?(String) ? body : body.to_json
|
|
292
|
-
else
|
|
293
|
-
data = nil
|
|
294
|
-
end
|
|
295
|
-
data
|
|
373
|
+
@config.base_url(opts[:operation]) + path
|
|
296
374
|
end
|
|
297
375
|
|
|
298
|
-
# Update
|
|
376
|
+
# Update header and query params based on authentication settings.
|
|
299
377
|
#
|
|
300
378
|
# @param [Hash] header_params Header parameters
|
|
301
379
|
# @param [Hash] query_params Query parameters
|
|
@@ -307,14 +385,14 @@ module FlatApi
|
|
|
307
385
|
case auth_setting[:in]
|
|
308
386
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
|
309
387
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
|
310
|
-
else fail ArgumentError, 'Authentication token must be in `query`
|
|
388
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
|
311
389
|
end
|
|
312
390
|
end
|
|
313
391
|
end
|
|
314
392
|
|
|
315
393
|
# Sets user agent in HTTP header
|
|
316
394
|
#
|
|
317
|
-
# @param [String] user_agent User agent (e.g.
|
|
395
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
|
318
396
|
def user_agent=(user_agent)
|
|
319
397
|
@user_agent = user_agent
|
|
320
398
|
@default_headers['User-Agent'] = @user_agent
|
|
@@ -327,18 +405,18 @@ module FlatApi
|
|
|
327
405
|
return nil if accepts.nil? || accepts.empty?
|
|
328
406
|
# use JSON when present, otherwise use all of the provided
|
|
329
407
|
json_accept = accepts.find { |s| json_mime?(s) }
|
|
330
|
-
|
|
408
|
+
json_accept || accepts.join(',')
|
|
331
409
|
end
|
|
332
410
|
|
|
333
411
|
# Return Content-Type header based on an array of content types provided.
|
|
334
412
|
# @param [Array] content_types array for Content-Type
|
|
335
413
|
# @return [String] the Content-Type header (e.g. application/json)
|
|
336
414
|
def select_header_content_type(content_types)
|
|
337
|
-
#
|
|
338
|
-
return
|
|
415
|
+
# return nil by default
|
|
416
|
+
return if content_types.nil? || content_types.empty?
|
|
339
417
|
# use JSON when present, otherwise use the first one
|
|
340
418
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
|
341
|
-
|
|
419
|
+
json_content_type || content_types.first
|
|
342
420
|
end
|
|
343
421
|
|
|
344
422
|
# Convert object (array, hash, object, etc) to JSON string.
|
|
@@ -348,7 +426,7 @@ module FlatApi
|
|
|
348
426
|
return model if model.nil? || model.is_a?(String)
|
|
349
427
|
local_body = nil
|
|
350
428
|
if model.is_a?(Array)
|
|
351
|
-
local_body = model.map{|m| object_to_hash(m) }
|
|
429
|
+
local_body = model.map { |m| object_to_hash(m) }
|
|
352
430
|
else
|
|
353
431
|
local_body = object_to_hash(model)
|
|
354
432
|
end
|
data/lib/flat_api/api_error.rb
CHANGED
|
@@ -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
|
|
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
|
|
|
@@ -32,7 +32,27 @@ module FlatApi
|
|
|
32
32
|
end
|
|
33
33
|
else
|
|
34
34
|
super arg
|
|
35
|
+
@message = arg
|
|
35
36
|
end
|
|
36
37
|
end
|
|
38
|
+
|
|
39
|
+
# Override to_s to display a friendly error message
|
|
40
|
+
def to_s
|
|
41
|
+
message
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def message
|
|
45
|
+
if @message.nil?
|
|
46
|
+
msg = "Error message: the server returns an error"
|
|
47
|
+
else
|
|
48
|
+
msg = @message
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
msg += "\nHTTP status code: #{code}" if code
|
|
52
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
|
53
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
|
54
|
+
|
|
55
|
+
msg
|
|
56
|
+
end
|
|
37
57
|
end
|
|
38
58
|
end
|
|
@@ -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
|