flat_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +7 -0
- data/README.md +248 -0
- data/Rakefile +8 -0
- data/docs/AccountApi.md +55 -0
- data/docs/Assignment.md +18 -0
- data/docs/AssignmentCopy.md +8 -0
- data/docs/AssignmentCreation.md +12 -0
- data/docs/AssignmentSubmission.md +19 -0
- data/docs/AssignmentSubmissionUpdate.md +11 -0
- data/docs/ClassApi.md +1051 -0
- data/docs/ClassAttachmentCreation.md +10 -0
- data/docs/ClassCreation.md +9 -0
- data/docs/ClassDetails.md +25 -0
- data/docs/ClassDetailsCanvas.md +9 -0
- data/docs/ClassDetailsClever.md +14 -0
- data/docs/ClassDetailsGoogleClassroom.md +11 -0
- data/docs/ClassDetailsGoogleDrive.md +9 -0
- data/docs/ClassDetailsLti.md +10 -0
- data/docs/ClassRoles.md +7 -0
- data/docs/ClassState.md +7 -0
- data/docs/ClassUpdate.md +9 -0
- data/docs/FlatErrorResponse.md +11 -0
- data/docs/FlatLocales.md +7 -0
- data/docs/GoogleClassroomCoursework.md +10 -0
- data/docs/GoogleClassroomSubmission.md +10 -0
- data/docs/Group.md +14 -0
- data/docs/GroupApi.md +167 -0
- data/docs/GroupDetails.md +14 -0
- data/docs/GroupType.md +7 -0
- data/docs/LicenseMode.md +7 -0
- data/docs/LicenseSources.md +7 -0
- data/docs/LmsName.md +7 -0
- data/docs/LtiCredentials.md +16 -0
- data/docs/LtiCredentialsCreation.md +9 -0
- data/docs/MediaAttachment.md +23 -0
- data/docs/MediaScoreSharingMode.md +7 -0
- data/docs/OrganizationApi.md +538 -0
- data/docs/OrganizationInvitation.md +14 -0
- data/docs/OrganizationInvitationCreation.md +9 -0
- data/docs/OrganizationRoles.md +7 -0
- data/docs/ScoreApi.md +1605 -0
- data/docs/ScoreCollaborator.md +15 -0
- data/docs/ScoreCollaboratorCreation.md +13 -0
- data/docs/ScoreComment.md +22 -0
- data/docs/ScoreCommentContext.md +14 -0
- data/docs/ScoreCommentCreation.md +13 -0
- data/docs/ScoreCommentUpdate.md +11 -0
- data/docs/ScoreCommentsCounts.md +11 -0
- data/docs/ScoreCreation.md +13 -0
- data/docs/ScoreCreationType.md +7 -0
- data/docs/ScoreData.md +7 -0
- data/docs/ScoreDataEncoding.md +7 -0
- data/docs/ScoreDetails.md +36 -0
- data/docs/ScoreFork.md +7 -0
- data/docs/ScoreLicense.md +7 -0
- data/docs/ScoreLikesCounts.md +10 -0
- data/docs/ScoreModification.md +13 -0
- data/docs/ScorePrivacy.md +7 -0
- data/docs/ScoreRevision.md +14 -0
- data/docs/ScoreRevisionCreation.md +11 -0
- data/docs/ScoreRevisionStatistics.md +9 -0
- data/docs/ScoreRights.md +9 -0
- data/docs/ScoreSource.md +8 -0
- data/docs/ScoreSummary.md +13 -0
- data/docs/ScoreTrack.md +19 -0
- data/docs/ScoreTrackCreation.md +12 -0
- data/docs/ScoreTrackPoint.md +10 -0
- data/docs/ScoreTrackState.md +7 -0
- data/docs/ScoreTrackType.md +7 -0
- data/docs/ScoreTrackUpdate.md +11 -0
- data/docs/ScoreViewsCounts.md +10 -0
- data/docs/UserAdminUpdate.md +9 -0
- data/docs/UserApi.md +173 -0
- data/docs/UserBasics.md +13 -0
- data/docs/UserCreation.md +11 -0
- data/docs/UserDetails.md +28 -0
- data/docs/UserDetailsAdmin.md +20 -0
- data/docs/UserDetailsAdminLicense.md +12 -0
- data/docs/UserInstruments.md +7 -0
- data/docs/UserPublic.md +25 -0
- data/docs/UserPublicSummary.md +17 -0
- data/flat_api.gemspec +48 -0
- data/git_push.sh +55 -0
- data/lib/flat_api.rb +117 -0
- data/lib/flat_api/api/account_api.rb +72 -0
- data/lib/flat_api/api/class_api.rb +1148 -0
- data/lib/flat_api/api/group_api.rb +191 -0
- data/lib/flat_api/api/organization_api.rb +599 -0
- data/lib/flat_api/api/score_api.rb +1737 -0
- data/lib/flat_api/api/user_api.rb +194 -0
- data/lib/flat_api/api_client.rb +389 -0
- data/lib/flat_api/api_error.rb +38 -0
- data/lib/flat_api/configuration.rb +209 -0
- data/lib/flat_api/models/assignment.rb +323 -0
- data/lib/flat_api/models/assignment_copy.rb +194 -0
- data/lib/flat_api/models/assignment_creation.rb +230 -0
- data/lib/flat_api/models/assignment_submission.rb +299 -0
- data/lib/flat_api/models/assignment_submission_update.rb +220 -0
- data/lib/flat_api/models/class_attachment_creation.rb +242 -0
- data/lib/flat_api/models/class_creation.rb +239 -0
- data/lib/flat_api/models/class_details.rb +351 -0
- data/lib/flat_api/models/class_details_canvas.rb +199 -0
- data/lib/flat_api/models/class_details_clever.rb +282 -0
- data/lib/flat_api/models/class_details_google_classroom.rb +219 -0
- data/lib/flat_api/models/class_details_google_drive.rb +199 -0
- data/lib/flat_api/models/class_details_lti.rb +209 -0
- data/lib/flat_api/models/class_roles.rb +22 -0
- data/lib/flat_api/models/class_state.rb +23 -0
- data/lib/flat_api/models/class_update.rb +231 -0
- data/lib/flat_api/models/flat_error_response.rb +219 -0
- data/lib/flat_api/models/flat_locales.rb +27 -0
- data/lib/flat_api/models/google_classroom_coursework.rb +209 -0
- data/lib/flat_api/models/google_classroom_submission.rb +209 -0
- data/lib/flat_api/models/group.rb +282 -0
- data/lib/flat_api/models/group_details.rb +248 -0
- data/lib/flat_api/models/group_type.rb +23 -0
- data/lib/flat_api/models/license_mode.rb +22 -0
- data/lib/flat_api/models/license_sources.rb +25 -0
- data/lib/flat_api/models/lms_name.rb +27 -0
- data/lib/flat_api/models/lti_credentials.rb +268 -0
- data/lib/flat_api/models/lti_credentials_creation.rb +227 -0
- data/lib/flat_api/models/media_attachment.rb +371 -0
- data/lib/flat_api/models/media_score_sharing_mode.rb +23 -0
- data/lib/flat_api/models/organization_invitation.rb +248 -0
- data/lib/flat_api/models/organization_invitation_creation.rb +198 -0
- data/lib/flat_api/models/organization_roles.rb +24 -0
- data/lib/flat_api/models/score_collaborator.rb +263 -0
- data/lib/flat_api/models/score_collaborator_creation.rb +245 -0
- data/lib/flat_api/models/score_comment.rb +363 -0
- data/lib/flat_api/models/score_comment_context.rb +282 -0
- data/lib/flat_api/models/score_comment_creation.rb +245 -0
- data/lib/flat_api/models/score_comment_update.rb +268 -0
- data/lib/flat_api/models/score_comments_counts.rb +219 -0
- data/lib/flat_api/models/score_creation.rb +240 -0
- data/lib/flat_api/models/score_creation_type.rb +23 -0
- data/lib/flat_api/models/score_data.rb +179 -0
- data/lib/flat_api/models/score_data_encoding.rb +21 -0
- data/lib/flat_api/models/score_details.rb +467 -0
- data/lib/flat_api/models/score_fork.rb +179 -0
- data/lib/flat_api/models/score_license.rb +28 -0
- data/lib/flat_api/models/score_likes_counts.rb +209 -0
- data/lib/flat_api/models/score_modification.rb +270 -0
- data/lib/flat_api/models/score_privacy.rb +24 -0
- data/lib/flat_api/models/score_revision.rb +249 -0
- data/lib/flat_api/models/score_revision_creation.rb +222 -0
- data/lib/flat_api/models/score_revision_statistics.rb +199 -0
- data/lib/flat_api/models/score_rights.rb +203 -0
- data/lib/flat_api/models/score_source.rb +189 -0
- data/lib/flat_api/models/score_summary.rb +237 -0
- data/lib/flat_api/models/score_track.rb +298 -0
- data/lib/flat_api/models/score_track_creation.rb +229 -0
- data/lib/flat_api/models/score_track_point.rb +252 -0
- data/lib/flat_api/models/score_track_state.rb +23 -0
- data/lib/flat_api/models/score_track_type.rb +24 -0
- data/lib/flat_api/models/score_track_update.rb +219 -0
- data/lib/flat_api/models/score_views_counts.rb +209 -0
- data/lib/flat_api/models/user_admin_update.rb +214 -0
- data/lib/flat_api/models/user_basics.rb +239 -0
- data/lib/flat_api/models/user_creation.rb +266 -0
- data/lib/flat_api/models/user_details.rb +418 -0
- data/lib/flat_api/models/user_details_admin.rb +306 -0
- data/lib/flat_api/models/user_details_admin_license.rb +227 -0
- data/lib/flat_api/models/user_instruments.rb +179 -0
- data/lib/flat_api/models/user_public.rb +356 -0
- data/lib/flat_api/models/user_public_summary.rb +277 -0
- data/lib/flat_api/version.rb +15 -0
- data/lib/swagger_client.rb +117 -0
- data/lib/swagger_client/api/account_api.rb +72 -0
- data/lib/swagger_client/api/class_api.rb +1148 -0
- data/lib/swagger_client/api/group_api.rb +191 -0
- data/lib/swagger_client/api/organization_api.rb +599 -0
- data/lib/swagger_client/api/score_api.rb +1737 -0
- data/lib/swagger_client/api/user_api.rb +194 -0
- data/lib/swagger_client/api_client.rb +389 -0
- data/lib/swagger_client/api_error.rb +38 -0
- data/lib/swagger_client/configuration.rb +209 -0
- data/lib/swagger_client/models/assignment.rb +323 -0
- data/lib/swagger_client/models/assignment_copy.rb +194 -0
- data/lib/swagger_client/models/assignment_creation.rb +230 -0
- data/lib/swagger_client/models/assignment_submission.rb +299 -0
- data/lib/swagger_client/models/assignment_submission_update.rb +220 -0
- data/lib/swagger_client/models/class_attachment_creation.rb +242 -0
- data/lib/swagger_client/models/class_creation.rb +239 -0
- data/lib/swagger_client/models/class_details.rb +351 -0
- data/lib/swagger_client/models/class_details_canvas.rb +199 -0
- data/lib/swagger_client/models/class_details_clever.rb +282 -0
- data/lib/swagger_client/models/class_details_google_classroom.rb +219 -0
- data/lib/swagger_client/models/class_details_google_drive.rb +199 -0
- data/lib/swagger_client/models/class_details_lti.rb +209 -0
- data/lib/swagger_client/models/class_roles.rb +22 -0
- data/lib/swagger_client/models/class_state.rb +23 -0
- data/lib/swagger_client/models/class_update.rb +231 -0
- data/lib/swagger_client/models/flat_error_response.rb +219 -0
- data/lib/swagger_client/models/flat_locales.rb +27 -0
- data/lib/swagger_client/models/google_classroom_coursework.rb +209 -0
- data/lib/swagger_client/models/google_classroom_submission.rb +209 -0
- data/lib/swagger_client/models/group.rb +282 -0
- data/lib/swagger_client/models/group_details.rb +248 -0
- data/lib/swagger_client/models/group_type.rb +23 -0
- data/lib/swagger_client/models/license_mode.rb +22 -0
- data/lib/swagger_client/models/license_sources.rb +25 -0
- data/lib/swagger_client/models/lms_name.rb +27 -0
- data/lib/swagger_client/models/lti_credentials.rb +268 -0
- data/lib/swagger_client/models/lti_credentials_creation.rb +227 -0
- data/lib/swagger_client/models/media_attachment.rb +371 -0
- data/lib/swagger_client/models/media_score_sharing_mode.rb +23 -0
- data/lib/swagger_client/models/organization_invitation.rb +248 -0
- data/lib/swagger_client/models/organization_invitation_creation.rb +198 -0
- data/lib/swagger_client/models/organization_roles.rb +24 -0
- data/lib/swagger_client/models/score_collaborator.rb +263 -0
- data/lib/swagger_client/models/score_collaborator_creation.rb +245 -0
- data/lib/swagger_client/models/score_comment.rb +363 -0
- data/lib/swagger_client/models/score_comment_context.rb +282 -0
- data/lib/swagger_client/models/score_comment_creation.rb +245 -0
- data/lib/swagger_client/models/score_comment_update.rb +268 -0
- data/lib/swagger_client/models/score_comments_counts.rb +219 -0
- data/lib/swagger_client/models/score_creation.rb +240 -0
- data/lib/swagger_client/models/score_creation_type.rb +23 -0
- data/lib/swagger_client/models/score_data.rb +179 -0
- data/lib/swagger_client/models/score_data_encoding.rb +21 -0
- data/lib/swagger_client/models/score_details.rb +467 -0
- data/lib/swagger_client/models/score_fork.rb +179 -0
- data/lib/swagger_client/models/score_license.rb +28 -0
- data/lib/swagger_client/models/score_likes_counts.rb +209 -0
- data/lib/swagger_client/models/score_modification.rb +270 -0
- data/lib/swagger_client/models/score_privacy.rb +24 -0
- data/lib/swagger_client/models/score_revision.rb +249 -0
- data/lib/swagger_client/models/score_revision_creation.rb +222 -0
- data/lib/swagger_client/models/score_revision_statistics.rb +199 -0
- data/lib/swagger_client/models/score_rights.rb +203 -0
- data/lib/swagger_client/models/score_source.rb +189 -0
- data/lib/swagger_client/models/score_summary.rb +237 -0
- data/lib/swagger_client/models/score_track.rb +298 -0
- data/lib/swagger_client/models/score_track_creation.rb +229 -0
- data/lib/swagger_client/models/score_track_point.rb +252 -0
- data/lib/swagger_client/models/score_track_state.rb +23 -0
- data/lib/swagger_client/models/score_track_type.rb +24 -0
- data/lib/swagger_client/models/score_track_update.rb +219 -0
- data/lib/swagger_client/models/score_views_counts.rb +209 -0
- data/lib/swagger_client/models/user_admin_update.rb +214 -0
- data/lib/swagger_client/models/user_basics.rb +239 -0
- data/lib/swagger_client/models/user_creation.rb +266 -0
- data/lib/swagger_client/models/user_details.rb +418 -0
- data/lib/swagger_client/models/user_details_admin.rb +306 -0
- data/lib/swagger_client/models/user_details_admin_license.rb +227 -0
- data/lib/swagger_client/models/user_instruments.rb +179 -0
- data/lib/swagger_client/models/user_public.rb +356 -0
- data/lib/swagger_client/models/user_public_summary.rb +277 -0
- data/lib/swagger_client/version.rb +15 -0
- data/spec/api/account_api_spec.rb +46 -0
- data/spec/api/class_api_spec.rb +278 -0
- data/spec/api/group_api_spec.rb +72 -0
- data/spec/api/organization_api_spec.rb +162 -0
- data/spec/api/score_api_spec.rb +411 -0
- data/spec/api/user_api_spec.rb +73 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/assignment_copy_spec.rb +42 -0
- data/spec/models/assignment_creation_spec.rb +66 -0
- data/spec/models/assignment_spec.rb +106 -0
- data/spec/models/assignment_submission_spec.rb +108 -0
- data/spec/models/assignment_submission_update_spec.rb +60 -0
- data/spec/models/class_attachment_creation_spec.rb +58 -0
- data/spec/models/class_creation_spec.rb +48 -0
- data/spec/models/class_details_canvas_spec.rb +48 -0
- data/spec/models/class_details_clever_spec.rb +82 -0
- data/spec/models/class_details_google_classroom_spec.rb +60 -0
- data/spec/models/class_details_google_drive_spec.rb +48 -0
- data/spec/models/class_details_lti_spec.rb +54 -0
- data/spec/models/class_details_spec.rb +144 -0
- data/spec/models/class_roles_spec.rb +36 -0
- data/spec/models/class_state_spec.rb +36 -0
- data/spec/models/class_update_spec.rb +48 -0
- data/spec/models/flat_error_response_spec.rb +60 -0
- data/spec/models/flat_locales_spec.rb +36 -0
- data/spec/models/google_classroom_coursework_spec.rb +54 -0
- data/spec/models/google_classroom_submission_spec.rb +54 -0
- data/spec/models/group_details_spec.rb +78 -0
- data/spec/models/group_spec.rb +82 -0
- data/spec/models/group_type_spec.rb +36 -0
- data/spec/models/license_mode_spec.rb +36 -0
- data/spec/models/license_sources_spec.rb +36 -0
- data/spec/models/lms_name_spec.rb +36 -0
- data/spec/models/lti_credentials_creation_spec.rb +48 -0
- data/spec/models/lti_credentials_spec.rb +90 -0
- data/spec/models/media_attachment_spec.rb +136 -0
- data/spec/models/media_score_sharing_mode_spec.rb +36 -0
- data/spec/models/organization_invitation_creation_spec.rb +48 -0
- data/spec/models/organization_invitation_spec.rb +78 -0
- data/spec/models/organization_roles_spec.rb +36 -0
- data/spec/models/score_collaborator_creation_spec.rb +72 -0
- data/spec/models/score_collaborator_spec.rb +84 -0
- data/spec/models/score_comment_context_spec.rb +78 -0
- data/spec/models/score_comment_creation_spec.rb +72 -0
- data/spec/models/score_comment_spec.rb +130 -0
- data/spec/models/score_comment_update_spec.rb +60 -0
- data/spec/models/score_comments_counts_spec.rb +60 -0
- data/spec/models/score_creation_spec.rb +72 -0
- data/spec/models/score_creation_type_spec.rb +36 -0
- data/spec/models/score_data_encoding_spec.rb +36 -0
- data/spec/models/score_data_spec.rb +36 -0
- data/spec/models/score_details_spec.rb +210 -0
- data/spec/models/score_fork_spec.rb +36 -0
- data/spec/models/score_license_spec.rb +36 -0
- data/spec/models/score_likes_counts_spec.rb +54 -0
- data/spec/models/score_modification_spec.rb +72 -0
- data/spec/models/score_privacy_spec.rb +36 -0
- data/spec/models/score_revision_creation_spec.rb +60 -0
- data/spec/models/score_revision_spec.rb +78 -0
- data/spec/models/score_revision_statistics_spec.rb +48 -0
- data/spec/models/score_rights_spec.rb +48 -0
- data/spec/models/score_source_spec.rb +42 -0
- data/spec/models/score_summary_spec.rb +72 -0
- data/spec/models/score_track_creation_spec.rb +66 -0
- data/spec/models/score_track_point_spec.rb +58 -0
- data/spec/models/score_track_spec.rb +108 -0
- data/spec/models/score_track_state_spec.rb +36 -0
- data/spec/models/score_track_type_spec.rb +36 -0
- data/spec/models/score_track_update_spec.rb +60 -0
- data/spec/models/score_views_counts_spec.rb +54 -0
- data/spec/models/user_admin_update_spec.rb +48 -0
- data/spec/models/user_basics_spec.rb +72 -0
- data/spec/models/user_creation_spec.rb +60 -0
- data/spec/models/user_details_admin_license_spec.rb +66 -0
- data/spec/models/user_details_admin_spec.rb +114 -0
- data/spec/models/user_details_spec.rb +166 -0
- data/spec/models/user_instruments_spec.rb +36 -0
- data/spec/models/user_public_spec.rb +144 -0
- data/spec/models/user_public_summary_spec.rb +96 -0
- data/spec/spec_helper.rb +111 -0
- metadata +640 -0
@@ -0,0 +1,363 @@
|
|
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 or MIDI files * 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 interoduction](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
|
+
OpenAPI spec version: 2.5.1
|
7
|
+
Contact: developers@flat.io
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.2.3-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module FlatApi
|
16
|
+
# Comment added on a sheet music
|
17
|
+
class ScoreComment
|
18
|
+
# The comment unique identifier
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# The type of the comment
|
22
|
+
attr_accessor :type
|
23
|
+
|
24
|
+
# The author unique identifier
|
25
|
+
attr_accessor :user
|
26
|
+
|
27
|
+
# The unique identifier of the score where the comment was posted
|
28
|
+
attr_accessor :score
|
29
|
+
|
30
|
+
# The unique identifier of revision the comment was posted
|
31
|
+
attr_accessor :revision
|
32
|
+
|
33
|
+
# When the comment is a reply to another comment, the unique identifier of the parent comment
|
34
|
+
attr_accessor :reply_to
|
35
|
+
|
36
|
+
# The date when the comment was posted
|
37
|
+
attr_accessor :date
|
38
|
+
|
39
|
+
# The date of the last comment modification
|
40
|
+
attr_accessor :modification_date
|
41
|
+
|
42
|
+
# The comment text that can includes mentions using the following format: `@[id:username]`.
|
43
|
+
attr_accessor :comment
|
44
|
+
|
45
|
+
# A raw version of the comment, that can be displayed without parsing the mentions.
|
46
|
+
attr_accessor :raw_comment
|
47
|
+
|
48
|
+
attr_accessor :context
|
49
|
+
|
50
|
+
# The list of user identifier mentioned on the score
|
51
|
+
attr_accessor :mentions
|
52
|
+
|
53
|
+
# For inline comments, the comment can be marked as resolved and will be hidden in the future responses
|
54
|
+
attr_accessor :resolved
|
55
|
+
|
56
|
+
# If the user is marked as resolved, this will contain the unique identifier of the User who marked this comment as resolved
|
57
|
+
attr_accessor :resolved_by
|
58
|
+
|
59
|
+
# `true if the message has been detected as spam and hidden from other users
|
60
|
+
attr_accessor :spam
|
61
|
+
|
62
|
+
class EnumAttributeValidator
|
63
|
+
attr_reader :datatype
|
64
|
+
attr_reader :allowable_values
|
65
|
+
|
66
|
+
def initialize(datatype, allowable_values)
|
67
|
+
@allowable_values = allowable_values.map do |value|
|
68
|
+
case datatype.to_s
|
69
|
+
when /Integer/i
|
70
|
+
value.to_i
|
71
|
+
when /Float/i
|
72
|
+
value.to_f
|
73
|
+
else
|
74
|
+
value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def valid?(value)
|
80
|
+
!value || allowable_values.include?(value)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
85
|
+
def self.attribute_map
|
86
|
+
{
|
87
|
+
:'id' => :'id',
|
88
|
+
:'type' => :'type',
|
89
|
+
:'user' => :'user',
|
90
|
+
:'score' => :'score',
|
91
|
+
:'revision' => :'revision',
|
92
|
+
:'reply_to' => :'replyTo',
|
93
|
+
:'date' => :'date',
|
94
|
+
:'modification_date' => :'modificationDate',
|
95
|
+
:'comment' => :'comment',
|
96
|
+
:'raw_comment' => :'rawComment',
|
97
|
+
:'context' => :'context',
|
98
|
+
:'mentions' => :'mentions',
|
99
|
+
:'resolved' => :'resolved',
|
100
|
+
:'resolved_by' => :'resolvedBy',
|
101
|
+
:'spam' => :'spam'
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
105
|
+
# Attribute type mapping.
|
106
|
+
def self.swagger_types
|
107
|
+
{
|
108
|
+
:'id' => :'String',
|
109
|
+
:'type' => :'String',
|
110
|
+
:'user' => :'String',
|
111
|
+
:'score' => :'String',
|
112
|
+
:'revision' => :'String',
|
113
|
+
:'reply_to' => :'String',
|
114
|
+
:'date' => :'DateTime',
|
115
|
+
:'modification_date' => :'DateTime',
|
116
|
+
:'comment' => :'String',
|
117
|
+
:'raw_comment' => :'String',
|
118
|
+
:'context' => :'ScoreCommentContext',
|
119
|
+
:'mentions' => :'Array<String>',
|
120
|
+
:'resolved' => :'BOOLEAN',
|
121
|
+
:'resolved_by' => :'String',
|
122
|
+
:'spam' => :'BOOLEAN'
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
# Initializes the object
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
+
def initialize(attributes = {})
|
129
|
+
return unless attributes.is_a?(Hash)
|
130
|
+
|
131
|
+
# convert string to symbol for hash key
|
132
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
133
|
+
|
134
|
+
if attributes.has_key?(:'id')
|
135
|
+
self.id = attributes[:'id']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.has_key?(:'type')
|
139
|
+
self.type = attributes[:'type']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.has_key?(:'user')
|
143
|
+
self.user = attributes[:'user']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.has_key?(:'score')
|
147
|
+
self.score = attributes[:'score']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.has_key?(:'revision')
|
151
|
+
self.revision = attributes[:'revision']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.has_key?(:'replyTo')
|
155
|
+
self.reply_to = attributes[:'replyTo']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.has_key?(:'date')
|
159
|
+
self.date = attributes[:'date']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.has_key?(:'modificationDate')
|
163
|
+
self.modification_date = attributes[:'modificationDate']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.has_key?(:'comment')
|
167
|
+
self.comment = attributes[:'comment']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.has_key?(:'rawComment')
|
171
|
+
self.raw_comment = attributes[:'rawComment']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.has_key?(:'context')
|
175
|
+
self.context = attributes[:'context']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.has_key?(:'mentions')
|
179
|
+
if (value = attributes[:'mentions']).is_a?(Array)
|
180
|
+
self.mentions = value
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.has_key?(:'resolved')
|
185
|
+
self.resolved = attributes[:'resolved']
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.has_key?(:'resolvedBy')
|
189
|
+
self.resolved_by = attributes[:'resolvedBy']
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.has_key?(:'spam')
|
193
|
+
self.spam = attributes[:'spam']
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
199
|
+
# @return Array for valid properies with the reasons
|
200
|
+
def list_invalid_properties
|
201
|
+
invalid_properties = Array.new
|
202
|
+
return invalid_properties
|
203
|
+
end
|
204
|
+
|
205
|
+
# Check to see if the all the properties in the model are valid
|
206
|
+
# @return true if the model is valid
|
207
|
+
def valid?
|
208
|
+
type_validator = EnumAttributeValidator.new('String', ["document", "inline"])
|
209
|
+
return false unless type_validator.valid?(@type)
|
210
|
+
return true
|
211
|
+
end
|
212
|
+
|
213
|
+
# Custom attribute writer method checking allowed values (enum).
|
214
|
+
# @param [Object] type Object to be assigned
|
215
|
+
def type=(type)
|
216
|
+
validator = EnumAttributeValidator.new('String', ["document", "inline"])
|
217
|
+
unless validator.valid?(type)
|
218
|
+
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
219
|
+
end
|
220
|
+
@type = type
|
221
|
+
end
|
222
|
+
|
223
|
+
# Checks equality by comparing each attribute.
|
224
|
+
# @param [Object] Object to be compared
|
225
|
+
def ==(o)
|
226
|
+
return true if self.equal?(o)
|
227
|
+
self.class == o.class &&
|
228
|
+
id == o.id &&
|
229
|
+
type == o.type &&
|
230
|
+
user == o.user &&
|
231
|
+
score == o.score &&
|
232
|
+
revision == o.revision &&
|
233
|
+
reply_to == o.reply_to &&
|
234
|
+
date == o.date &&
|
235
|
+
modification_date == o.modification_date &&
|
236
|
+
comment == o.comment &&
|
237
|
+
raw_comment == o.raw_comment &&
|
238
|
+
context == o.context &&
|
239
|
+
mentions == o.mentions &&
|
240
|
+
resolved == o.resolved &&
|
241
|
+
resolved_by == o.resolved_by &&
|
242
|
+
spam == o.spam
|
243
|
+
end
|
244
|
+
|
245
|
+
# @see the `==` method
|
246
|
+
# @param [Object] Object to be compared
|
247
|
+
def eql?(o)
|
248
|
+
self == o
|
249
|
+
end
|
250
|
+
|
251
|
+
# Calculates hash code according to all attributes.
|
252
|
+
# @return [Fixnum] Hash code
|
253
|
+
def hash
|
254
|
+
[id, type, user, score, revision, reply_to, date, modification_date, comment, raw_comment, context, mentions, resolved, resolved_by, spam].hash
|
255
|
+
end
|
256
|
+
|
257
|
+
# Builds the object from hash
|
258
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
259
|
+
# @return [Object] Returns the model itself
|
260
|
+
def build_from_hash(attributes)
|
261
|
+
return nil unless attributes.is_a?(Hash)
|
262
|
+
self.class.swagger_types.each_pair do |key, type|
|
263
|
+
if type =~ /\AArray<(.*)>/i
|
264
|
+
# check to ensure the input is an array given that the the attribute
|
265
|
+
# is documented as an array but the input is not
|
266
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
267
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
268
|
+
end
|
269
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
270
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
271
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
272
|
+
end
|
273
|
+
|
274
|
+
self
|
275
|
+
end
|
276
|
+
|
277
|
+
# Deserializes the data based on type
|
278
|
+
# @param string type Data type
|
279
|
+
# @param string value Value to be deserialized
|
280
|
+
# @return [Object] Deserialized data
|
281
|
+
def _deserialize(type, value)
|
282
|
+
case type.to_sym
|
283
|
+
when :DateTime
|
284
|
+
DateTime.parse(value)
|
285
|
+
when :Date
|
286
|
+
Date.parse(value)
|
287
|
+
when :String
|
288
|
+
value.to_s
|
289
|
+
when :Integer
|
290
|
+
value.to_i
|
291
|
+
when :Float
|
292
|
+
value.to_f
|
293
|
+
when :BOOLEAN
|
294
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
295
|
+
true
|
296
|
+
else
|
297
|
+
false
|
298
|
+
end
|
299
|
+
when :Object
|
300
|
+
# generic object (usually a Hash), return directly
|
301
|
+
value
|
302
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
303
|
+
inner_type = Regexp.last_match[:inner_type]
|
304
|
+
value.map { |v| _deserialize(inner_type, v) }
|
305
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
306
|
+
k_type = Regexp.last_match[:k_type]
|
307
|
+
v_type = Regexp.last_match[:v_type]
|
308
|
+
{}.tap do |hash|
|
309
|
+
value.each do |k, v|
|
310
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
else # model
|
314
|
+
temp_model = FlatApi.const_get(type).new
|
315
|
+
temp_model.build_from_hash(value)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# Returns the string representation of the object
|
320
|
+
# @return [String] String presentation of the object
|
321
|
+
def to_s
|
322
|
+
to_hash.to_s
|
323
|
+
end
|
324
|
+
|
325
|
+
# to_body is an alias to to_hash (backward compatibility)
|
326
|
+
# @return [Hash] Returns the object in the form of hash
|
327
|
+
def to_body
|
328
|
+
to_hash
|
329
|
+
end
|
330
|
+
|
331
|
+
# Returns the object in the form of hash
|
332
|
+
# @return [Hash] Returns the object in the form of hash
|
333
|
+
def to_hash
|
334
|
+
hash = {}
|
335
|
+
self.class.attribute_map.each_pair do |attr, param|
|
336
|
+
value = self.send(attr)
|
337
|
+
next if value.nil?
|
338
|
+
hash[param] = _to_hash(value)
|
339
|
+
end
|
340
|
+
hash
|
341
|
+
end
|
342
|
+
|
343
|
+
# Outputs non-array value in the form of hash
|
344
|
+
# For object, use to_hash. Otherwise, just return the value
|
345
|
+
# @param [Object] value Any valid value
|
346
|
+
# @return [Hash] Returns the value in the form of hash
|
347
|
+
def _to_hash(value)
|
348
|
+
if value.is_a?(Array)
|
349
|
+
value.compact.map{ |v| _to_hash(v) }
|
350
|
+
elsif value.is_a?(Hash)
|
351
|
+
{}.tap do |hash|
|
352
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
353
|
+
end
|
354
|
+
elsif value.respond_to? :to_hash
|
355
|
+
value.to_hash
|
356
|
+
else
|
357
|
+
value
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
end
|
362
|
+
|
363
|
+
end
|
@@ -0,0 +1,282 @@
|
|
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 or MIDI files * 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 interoduction](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
|
+
OpenAPI spec version: 2.5.1
|
7
|
+
Contact: developers@flat.io
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.2.3-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module FlatApi
|
16
|
+
# The context of the comment (for inline/contextualized comments). A context will include all the information related to the location of the comment (i.e. score parts, range of measure, time position).
|
17
|
+
class ScoreCommentContext
|
18
|
+
# The unique identifier (UUID) of the score part
|
19
|
+
attr_accessor :part_uuid
|
20
|
+
|
21
|
+
# The identififer of the staff
|
22
|
+
attr_accessor :staff_idx
|
23
|
+
|
24
|
+
# The list of measure UUIds
|
25
|
+
attr_accessor :measure_uuids
|
26
|
+
|
27
|
+
attr_accessor :start_time_pos
|
28
|
+
|
29
|
+
attr_accessor :stop_time_pos
|
30
|
+
|
31
|
+
attr_accessor :start_dpq
|
32
|
+
|
33
|
+
attr_accessor :stop_dpq
|
34
|
+
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'part_uuid' => :'partUuid',
|
40
|
+
:'staff_idx' => :'staffIdx',
|
41
|
+
:'measure_uuids' => :'measureUuids',
|
42
|
+
:'start_time_pos' => :'startTimePos',
|
43
|
+
:'stop_time_pos' => :'stopTimePos',
|
44
|
+
:'start_dpq' => :'startDpq',
|
45
|
+
:'stop_dpq' => :'stopDpq'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.swagger_types
|
51
|
+
{
|
52
|
+
:'part_uuid' => :'String',
|
53
|
+
:'staff_idx' => :'Float',
|
54
|
+
:'measure_uuids' => :'Array<String>',
|
55
|
+
:'start_time_pos' => :'Float',
|
56
|
+
:'stop_time_pos' => :'Float',
|
57
|
+
:'start_dpq' => :'Float',
|
58
|
+
:'stop_dpq' => :'Float'
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
return unless attributes.is_a?(Hash)
|
66
|
+
|
67
|
+
# convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
69
|
+
|
70
|
+
if attributes.has_key?(:'partUuid')
|
71
|
+
self.part_uuid = attributes[:'partUuid']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'staffIdx')
|
75
|
+
self.staff_idx = attributes[:'staffIdx']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'measureUuids')
|
79
|
+
if (value = attributes[:'measureUuids']).is_a?(Array)
|
80
|
+
self.measure_uuids = value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'startTimePos')
|
85
|
+
self.start_time_pos = attributes[:'startTimePos']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:'stopTimePos')
|
89
|
+
self.stop_time_pos = attributes[:'stopTimePos']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:'startDpq')
|
93
|
+
self.start_dpq = attributes[:'startDpq']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:'stopDpq')
|
97
|
+
self.stop_dpq = attributes[:'stopDpq']
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
103
|
+
# @return Array for valid properies with the reasons
|
104
|
+
def list_invalid_properties
|
105
|
+
invalid_properties = Array.new
|
106
|
+
if @part_uuid.nil?
|
107
|
+
invalid_properties.push("invalid value for 'part_uuid', part_uuid cannot be nil.")
|
108
|
+
end
|
109
|
+
|
110
|
+
if @staff_idx.nil?
|
111
|
+
invalid_properties.push("invalid value for 'staff_idx', staff_idx cannot be nil.")
|
112
|
+
end
|
113
|
+
|
114
|
+
if @measure_uuids.nil?
|
115
|
+
invalid_properties.push("invalid value for 'measure_uuids', measure_uuids cannot be nil.")
|
116
|
+
end
|
117
|
+
|
118
|
+
if @start_time_pos.nil?
|
119
|
+
invalid_properties.push("invalid value for 'start_time_pos', start_time_pos cannot be nil.")
|
120
|
+
end
|
121
|
+
|
122
|
+
if @stop_time_pos.nil?
|
123
|
+
invalid_properties.push("invalid value for 'stop_time_pos', stop_time_pos cannot be nil.")
|
124
|
+
end
|
125
|
+
|
126
|
+
if @start_dpq.nil?
|
127
|
+
invalid_properties.push("invalid value for 'start_dpq', start_dpq cannot be nil.")
|
128
|
+
end
|
129
|
+
|
130
|
+
if @stop_dpq.nil?
|
131
|
+
invalid_properties.push("invalid value for 'stop_dpq', stop_dpq cannot be nil.")
|
132
|
+
end
|
133
|
+
|
134
|
+
return invalid_properties
|
135
|
+
end
|
136
|
+
|
137
|
+
# Check to see if the all the properties in the model are valid
|
138
|
+
# @return true if the model is valid
|
139
|
+
def valid?
|
140
|
+
return false if @part_uuid.nil?
|
141
|
+
return false if @staff_idx.nil?
|
142
|
+
return false if @measure_uuids.nil?
|
143
|
+
return false if @start_time_pos.nil?
|
144
|
+
return false if @stop_time_pos.nil?
|
145
|
+
return false if @start_dpq.nil?
|
146
|
+
return false if @stop_dpq.nil?
|
147
|
+
return true
|
148
|
+
end
|
149
|
+
|
150
|
+
# Checks equality by comparing each attribute.
|
151
|
+
# @param [Object] Object to be compared
|
152
|
+
def ==(o)
|
153
|
+
return true if self.equal?(o)
|
154
|
+
self.class == o.class &&
|
155
|
+
part_uuid == o.part_uuid &&
|
156
|
+
staff_idx == o.staff_idx &&
|
157
|
+
measure_uuids == o.measure_uuids &&
|
158
|
+
start_time_pos == o.start_time_pos &&
|
159
|
+
stop_time_pos == o.stop_time_pos &&
|
160
|
+
start_dpq == o.start_dpq &&
|
161
|
+
stop_dpq == o.stop_dpq
|
162
|
+
end
|
163
|
+
|
164
|
+
# @see the `==` method
|
165
|
+
# @param [Object] Object to be compared
|
166
|
+
def eql?(o)
|
167
|
+
self == o
|
168
|
+
end
|
169
|
+
|
170
|
+
# Calculates hash code according to all attributes.
|
171
|
+
# @return [Fixnum] Hash code
|
172
|
+
def hash
|
173
|
+
[part_uuid, staff_idx, measure_uuids, start_time_pos, stop_time_pos, start_dpq, stop_dpq].hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Builds the object from hash
|
177
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
178
|
+
# @return [Object] Returns the model itself
|
179
|
+
def build_from_hash(attributes)
|
180
|
+
return nil unless attributes.is_a?(Hash)
|
181
|
+
self.class.swagger_types.each_pair do |key, type|
|
182
|
+
if type =~ /\AArray<(.*)>/i
|
183
|
+
# check to ensure the input is an array given that the the attribute
|
184
|
+
# is documented as an array but the input is not
|
185
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
186
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
187
|
+
end
|
188
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
189
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
190
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
191
|
+
end
|
192
|
+
|
193
|
+
self
|
194
|
+
end
|
195
|
+
|
196
|
+
# Deserializes the data based on type
|
197
|
+
# @param string type Data type
|
198
|
+
# @param string value Value to be deserialized
|
199
|
+
# @return [Object] Deserialized data
|
200
|
+
def _deserialize(type, value)
|
201
|
+
case type.to_sym
|
202
|
+
when :DateTime
|
203
|
+
DateTime.parse(value)
|
204
|
+
when :Date
|
205
|
+
Date.parse(value)
|
206
|
+
when :String
|
207
|
+
value.to_s
|
208
|
+
when :Integer
|
209
|
+
value.to_i
|
210
|
+
when :Float
|
211
|
+
value.to_f
|
212
|
+
when :BOOLEAN
|
213
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
214
|
+
true
|
215
|
+
else
|
216
|
+
false
|
217
|
+
end
|
218
|
+
when :Object
|
219
|
+
# generic object (usually a Hash), return directly
|
220
|
+
value
|
221
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
222
|
+
inner_type = Regexp.last_match[:inner_type]
|
223
|
+
value.map { |v| _deserialize(inner_type, v) }
|
224
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
225
|
+
k_type = Regexp.last_match[:k_type]
|
226
|
+
v_type = Regexp.last_match[:v_type]
|
227
|
+
{}.tap do |hash|
|
228
|
+
value.each do |k, v|
|
229
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
else # model
|
233
|
+
temp_model = FlatApi.const_get(type).new
|
234
|
+
temp_model.build_from_hash(value)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the string representation of the object
|
239
|
+
# @return [String] String presentation of the object
|
240
|
+
def to_s
|
241
|
+
to_hash.to_s
|
242
|
+
end
|
243
|
+
|
244
|
+
# to_body is an alias to to_hash (backward compatibility)
|
245
|
+
# @return [Hash] Returns the object in the form of hash
|
246
|
+
def to_body
|
247
|
+
to_hash
|
248
|
+
end
|
249
|
+
|
250
|
+
# Returns the object in the form of hash
|
251
|
+
# @return [Hash] Returns the object in the form of hash
|
252
|
+
def to_hash
|
253
|
+
hash = {}
|
254
|
+
self.class.attribute_map.each_pair do |attr, param|
|
255
|
+
value = self.send(attr)
|
256
|
+
next if value.nil?
|
257
|
+
hash[param] = _to_hash(value)
|
258
|
+
end
|
259
|
+
hash
|
260
|
+
end
|
261
|
+
|
262
|
+
# Outputs non-array value in the form of hash
|
263
|
+
# For object, use to_hash. Otherwise, just return the value
|
264
|
+
# @param [Object] value Any valid value
|
265
|
+
# @return [Hash] Returns the value in the form of hash
|
266
|
+
def _to_hash(value)
|
267
|
+
if value.is_a?(Array)
|
268
|
+
value.compact.map{ |v| _to_hash(v) }
|
269
|
+
elsif value.is_a?(Hash)
|
270
|
+
{}.tap do |hash|
|
271
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
272
|
+
end
|
273
|
+
elsif value.respond_to? :to_hash
|
274
|
+
value.to_hash
|
275
|
+
else
|
276
|
+
value
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
281
|
+
|
282
|
+
end
|