flat_api 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +34 -12
  4. data/docs/ClassApi.md +2 -2
  5. data/docs/Collection.md +18 -0
  6. data/docs/CollectionApi.md +521 -0
  7. data/docs/CollectionCapabilities.md +12 -0
  8. data/docs/CollectionCreation.md +8 -0
  9. data/docs/CollectionModification.md +8 -0
  10. data/docs/CollectionPrivacy.md +7 -0
  11. data/docs/CollectionTitle.md +7 -0
  12. data/docs/CollectionType.md +7 -0
  13. data/docs/ResourceCollaborator.md +16 -0
  14. data/docs/{ScoreCollaboratorCreation.md → ResourceCollaboratorCreation.md} +2 -1
  15. data/docs/ResourceRights.md +10 -0
  16. data/docs/ResourceSharingKey.md +7 -0
  17. data/docs/ScoreApi.md +144 -91
  18. data/docs/ScoreCreation.md +2 -1
  19. data/docs/ScoreDetails.md +2 -2
  20. data/docs/ScoreFork.md +1 -0
  21. data/docs/ScoreModification.md +2 -1
  22. data/docs/UserApi.md +1 -1
  23. data/flat_api.gemspec +1 -1
  24. data/lib/flat_api.rb +13 -4
  25. data/lib/flat_api/api/account_api.rb +1 -1
  26. data/lib/flat_api/api/class_api.rb +1 -1
  27. data/lib/flat_api/api/collection_api.rb +596 -0
  28. data/lib/flat_api/api/group_api.rb +1 -1
  29. data/lib/flat_api/api/organization_api.rb +1 -1
  30. data/lib/flat_api/api/score_api.rb +125 -53
  31. data/lib/flat_api/api/user_api.rb +3 -3
  32. data/lib/flat_api/api_client.rb +1 -1
  33. data/lib/flat_api/api_error.rb +1 -1
  34. data/lib/flat_api/configuration.rb +1 -1
  35. data/lib/flat_api/models/assignment.rb +1 -1
  36. data/lib/flat_api/models/assignment_copy.rb +1 -1
  37. data/lib/flat_api/models/assignment_creation.rb +1 -1
  38. data/lib/flat_api/models/assignment_submission.rb +1 -1
  39. data/lib/flat_api/models/assignment_submission_update.rb +1 -1
  40. data/lib/flat_api/models/class_attachment_creation.rb +1 -1
  41. data/lib/flat_api/models/class_creation.rb +1 -1
  42. data/lib/flat_api/models/class_details.rb +1 -1
  43. data/lib/flat_api/models/class_details_canvas.rb +1 -1
  44. data/lib/flat_api/models/class_details_clever.rb +1 -1
  45. data/lib/flat_api/models/class_details_google_classroom.rb +1 -1
  46. data/lib/flat_api/models/class_details_google_drive.rb +1 -1
  47. data/lib/flat_api/models/class_details_lti.rb +1 -1
  48. data/lib/flat_api/models/class_roles.rb +1 -1
  49. data/lib/flat_api/models/class_state.rb +1 -1
  50. data/lib/flat_api/models/class_update.rb +1 -1
  51. data/lib/flat_api/models/collection.rb +285 -0
  52. data/lib/flat_api/models/collection_capabilities.rb +229 -0
  53. data/lib/flat_api/models/collection_creation.rb +193 -0
  54. data/lib/flat_api/models/collection_modification.rb +188 -0
  55. data/lib/flat_api/models/collection_privacy.rb +30 -0
  56. data/lib/flat_api/models/collection_title.rb +179 -0
  57. data/lib/flat_api/models/collection_type.rb +34 -0
  58. data/lib/flat_api/models/flat_error_response.rb +1 -1
  59. data/lib/flat_api/models/flat_locales.rb +1 -1
  60. data/lib/flat_api/models/google_classroom_coursework.rb +1 -1
  61. data/lib/flat_api/models/google_classroom_submission.rb +1 -1
  62. data/lib/flat_api/models/group.rb +1 -1
  63. data/lib/flat_api/models/group_details.rb +1 -1
  64. data/lib/flat_api/models/group_type.rb +1 -1
  65. data/lib/flat_api/models/license_mode.rb +1 -1
  66. data/lib/flat_api/models/license_sources.rb +1 -1
  67. data/lib/flat_api/models/lms_name.rb +1 -1
  68. data/lib/flat_api/models/lti_credentials.rb +1 -1
  69. data/lib/flat_api/models/lti_credentials_creation.rb +1 -1
  70. data/lib/flat_api/models/media_attachment.rb +1 -1
  71. data/lib/flat_api/models/media_score_sharing_mode.rb +1 -1
  72. data/lib/flat_api/models/organization_invitation.rb +1 -1
  73. data/lib/flat_api/models/organization_invitation_creation.rb +1 -1
  74. data/lib/flat_api/models/organization_roles.rb +1 -1
  75. data/lib/flat_api/models/{score_collaborator.rb → resource_collaborator.rb} +54 -44
  76. data/lib/flat_api/models/{score_collaborator_creation.rb → resource_collaborator_creation.rb} +14 -4
  77. data/lib/flat_api/models/{score_rights.rb → resource_rights.rb} +6 -6
  78. data/lib/flat_api/models/resource_sharing_key.rb +179 -0
  79. data/lib/flat_api/models/score_comment.rb +1 -1
  80. data/lib/flat_api/models/score_comment_context.rb +1 -1
  81. data/lib/flat_api/models/score_comment_creation.rb +1 -1
  82. data/lib/flat_api/models/score_comment_update.rb +1 -1
  83. data/lib/flat_api/models/score_comments_counts.rb +1 -1
  84. data/lib/flat_api/models/score_creation.rb +13 -3
  85. data/lib/flat_api/models/score_creation_type.rb +1 -1
  86. data/lib/flat_api/models/score_data.rb +1 -1
  87. data/lib/flat_api/models/score_data_encoding.rb +1 -1
  88. data/lib/flat_api/models/score_details.rb +3 -3
  89. data/lib/flat_api/models/score_fork.rb +13 -3
  90. data/lib/flat_api/models/score_license.rb +1 -1
  91. data/lib/flat_api/models/score_likes_counts.rb +1 -1
  92. data/lib/flat_api/models/score_modification.rb +13 -20
  93. data/lib/flat_api/models/score_privacy.rb +1 -1
  94. data/lib/flat_api/models/score_revision.rb +1 -1
  95. data/lib/flat_api/models/score_revision_creation.rb +1 -1
  96. data/lib/flat_api/models/score_revision_statistics.rb +1 -1
  97. data/lib/flat_api/models/score_source.rb +1 -1
  98. data/lib/flat_api/models/score_summary.rb +1 -1
  99. data/lib/flat_api/models/score_track.rb +1 -1
  100. data/lib/flat_api/models/score_track_creation.rb +1 -1
  101. data/lib/flat_api/models/score_track_point.rb +1 -1
  102. data/lib/flat_api/models/score_track_state.rb +1 -1
  103. data/lib/flat_api/models/score_track_type.rb +1 -1
  104. data/lib/flat_api/models/score_track_update.rb +1 -1
  105. data/lib/flat_api/models/score_views_counts.rb +1 -1
  106. data/lib/flat_api/models/user_admin_update.rb +1 -1
  107. data/lib/flat_api/models/user_basics.rb +1 -1
  108. data/lib/flat_api/models/user_creation.rb +1 -1
  109. data/lib/flat_api/models/user_details.rb +1 -1
  110. data/lib/flat_api/models/user_details_admin.rb +1 -1
  111. data/lib/flat_api/models/user_details_admin_license.rb +1 -1
  112. data/lib/flat_api/models/user_instruments.rb +1 -1
  113. data/lib/flat_api/models/user_public.rb +1 -1
  114. data/lib/flat_api/models/user_public_summary.rb +1 -1
  115. data/lib/flat_api/version.rb +2 -2
  116. data/spec/api/account_api_spec.rb +2 -2
  117. data/spec/api/class_api_spec.rb +2 -2
  118. data/spec/api/collection_api_spec.rb +159 -0
  119. data/spec/api/group_api_spec.rb +2 -2
  120. data/spec/api/organization_api_spec.rb +2 -2
  121. data/spec/api/score_api_spec.rb +41 -26
  122. data/spec/api/user_api_spec.rb +3 -3
  123. data/spec/api_client_spec.rb +2 -2
  124. data/spec/configuration_spec.rb +2 -2
  125. data/spec/models/assignment_copy_spec.rb +2 -2
  126. data/spec/models/assignment_creation_spec.rb +2 -2
  127. data/spec/models/assignment_spec.rb +2 -2
  128. data/spec/models/assignment_submission_spec.rb +2 -2
  129. data/spec/models/assignment_submission_update_spec.rb +2 -2
  130. data/spec/models/class_attachment_creation_spec.rb +2 -2
  131. data/spec/models/class_creation_spec.rb +2 -2
  132. data/spec/models/class_details_canvas_spec.rb +2 -2
  133. data/spec/models/class_details_clever_spec.rb +2 -2
  134. data/spec/models/class_details_google_classroom_spec.rb +2 -2
  135. data/spec/models/class_details_google_drive_spec.rb +2 -2
  136. data/spec/models/class_details_lti_spec.rb +2 -2
  137. data/spec/models/class_details_spec.rb +2 -2
  138. data/spec/models/class_roles_spec.rb +2 -2
  139. data/spec/models/class_state_spec.rb +2 -2
  140. data/spec/models/class_update_spec.rb +2 -2
  141. data/spec/models/collection_capabilities_spec.rb +66 -0
  142. data/spec/models/collection_creation_spec.rb +42 -0
  143. data/spec/models/collection_modification_spec.rb +42 -0
  144. data/spec/models/collection_privacy_spec.rb +36 -0
  145. data/spec/models/collection_spec.rb +102 -0
  146. data/spec/models/collection_title_spec.rb +36 -0
  147. data/spec/models/collection_type_spec.rb +36 -0
  148. data/spec/models/flat_error_response_spec.rb +2 -2
  149. data/spec/models/flat_locales_spec.rb +2 -2
  150. data/spec/models/google_classroom_coursework_spec.rb +2 -2
  151. data/spec/models/google_classroom_submission_spec.rb +2 -2
  152. data/spec/models/group_details_spec.rb +2 -2
  153. data/spec/models/group_spec.rb +2 -2
  154. data/spec/models/group_type_spec.rb +2 -2
  155. data/spec/models/license_mode_spec.rb +2 -2
  156. data/spec/models/license_sources_spec.rb +2 -2
  157. data/spec/models/lms_name_spec.rb +2 -2
  158. data/spec/models/lti_credentials_creation_spec.rb +2 -2
  159. data/spec/models/lti_credentials_spec.rb +2 -2
  160. data/spec/models/media_attachment_spec.rb +2 -2
  161. data/spec/models/media_score_sharing_mode_spec.rb +2 -2
  162. data/spec/models/organization_invitation_creation_spec.rb +2 -2
  163. data/spec/models/organization_invitation_spec.rb +2 -2
  164. data/spec/models/organization_roles_spec.rb +2 -2
  165. data/spec/models/{score_collaborator_creation_spec.rb → resource_collaborator_creation_spec.rb} +14 -8
  166. data/spec/models/{score_collaborator_spec.rb → resource_collaborator_spec.rb} +22 -16
  167. data/spec/models/{score_rights_spec.rb → resource_rights_spec.rb} +14 -8
  168. data/spec/models/resource_sharing_key_spec.rb +36 -0
  169. data/spec/models/score_comment_context_spec.rb +2 -2
  170. data/spec/models/score_comment_creation_spec.rb +2 -2
  171. data/spec/models/score_comment_spec.rb +2 -2
  172. data/spec/models/score_comment_update_spec.rb +2 -2
  173. data/spec/models/score_comments_counts_spec.rb +2 -2
  174. data/spec/models/score_creation_spec.rb +8 -2
  175. data/spec/models/score_creation_type_spec.rb +2 -2
  176. data/spec/models/score_data_encoding_spec.rb +2 -2
  177. data/spec/models/score_data_spec.rb +2 -2
  178. data/spec/models/score_details_spec.rb +2 -2
  179. data/spec/models/score_fork_spec.rb +8 -2
  180. data/spec/models/score_license_spec.rb +2 -2
  181. data/spec/models/score_likes_counts_spec.rb +2 -2
  182. data/spec/models/score_modification_spec.rb +8 -2
  183. data/spec/models/score_privacy_spec.rb +2 -2
  184. data/spec/models/score_revision_creation_spec.rb +2 -2
  185. data/spec/models/score_revision_spec.rb +2 -2
  186. data/spec/models/score_revision_statistics_spec.rb +2 -2
  187. data/spec/models/score_source_spec.rb +2 -2
  188. data/spec/models/score_summary_spec.rb +2 -2
  189. data/spec/models/score_track_creation_spec.rb +2 -2
  190. data/spec/models/score_track_point_spec.rb +2 -2
  191. data/spec/models/score_track_spec.rb +2 -2
  192. data/spec/models/score_track_state_spec.rb +2 -2
  193. data/spec/models/score_track_type_spec.rb +2 -2
  194. data/spec/models/score_track_update_spec.rb +2 -2
  195. data/spec/models/score_views_counts_spec.rb +2 -2
  196. data/spec/models/user_admin_update_spec.rb +2 -2
  197. data/spec/models/user_basics_spec.rb +2 -2
  198. data/spec/models/user_creation_spec.rb +2 -2
  199. data/spec/models/user_details_admin_license_spec.rb +2 -2
  200. data/spec/models/user_details_admin_spec.rb +2 -2
  201. data/spec/models/user_details_spec.rb +2 -2
  202. data/spec/models/user_instruments_spec.rb +2 -2
  203. data/spec/models/user_public_spec.rb +2 -2
  204. data/spec/models/user_public_summary_spec.rb +2 -2
  205. data/spec/spec_helper.rb +2 -2
  206. metadata +50 -15
  207. data/docs/ScoreCollaborator.md +0 -15
  208. data/docs/ScoreRights.md +0 -10
  209. data/git_push.sh +0 -55
@@ -0,0 +1,229 @@
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.6.0
7
+ Contact: developers@flat.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module FlatApi
16
+ # Capabilities the current user has on this collection. Each capability corresponds to a fine-grained action that a user may take.
17
+ class CollectionCapabilities
18
+ # Whether the current user can modify the metadata for the collection
19
+ attr_accessor :can_edit
20
+
21
+ # Whether the current user can modify the sharing settings for the collection
22
+ attr_accessor :can_share
23
+
24
+ # Whether the current user can delete the collection
25
+ attr_accessor :can_delete
26
+
27
+ # Whether the current user can add scores to the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `DELETE /v2/scores/{score}` to trash a score.
28
+ attr_accessor :can_add_scores
29
+
30
+ # Whether the current user can delete scores from the collection If this collection has the `type` `trash`, this property will be set to `false`. Use `POST /v2/scores/{score}/untrash` to restore a score.
31
+ attr_accessor :can_delete_scores
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'can_edit' => :'canEdit',
38
+ :'can_share' => :'canShare',
39
+ :'can_delete' => :'canDelete',
40
+ :'can_add_scores' => :'canAddScores',
41
+ :'can_delete_scores' => :'canDeleteScores'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'can_edit' => :'BOOLEAN',
49
+ :'can_share' => :'BOOLEAN',
50
+ :'can_delete' => :'BOOLEAN',
51
+ :'can_add_scores' => :'BOOLEAN',
52
+ :'can_delete_scores' => :'BOOLEAN'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
+
64
+ if attributes.has_key?(:'canEdit')
65
+ self.can_edit = attributes[:'canEdit']
66
+ end
67
+
68
+ if attributes.has_key?(:'canShare')
69
+ self.can_share = attributes[:'canShare']
70
+ end
71
+
72
+ if attributes.has_key?(:'canDelete')
73
+ self.can_delete = attributes[:'canDelete']
74
+ end
75
+
76
+ if attributes.has_key?(:'canAddScores')
77
+ self.can_add_scores = attributes[:'canAddScores']
78
+ end
79
+
80
+ if attributes.has_key?(:'canDeleteScores')
81
+ self.can_delete_scores = attributes[:'canDeleteScores']
82
+ end
83
+
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ return invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ return true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ can_edit == o.can_edit &&
105
+ can_share == o.can_share &&
106
+ can_delete == o.can_delete &&
107
+ can_add_scores == o.can_add_scores &&
108
+ can_delete_scores == o.can_delete_scores
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Fixnum] Hash code
119
+ def hash
120
+ [can_edit, can_share, can_delete, can_add_scores, can_delete_scores].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.swagger_types.each_pair do |key, type|
129
+ if type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :DateTime
150
+ DateTime.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :BOOLEAN
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ temp_model = FlatApi.const_get(type).new
181
+ temp_model.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ next if value.nil?
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map{ |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+
229
+ end
@@ -0,0 +1,193 @@
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.6.0
7
+ Contact: developers@flat.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module FlatApi
16
+
17
+ class CollectionCreation
18
+ attr_accessor :title
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'title' => :'title'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'title' => :'CollectionTitle'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes.has_key?(:'title')
44
+ self.title = attributes[:'title']
45
+ end
46
+
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properties with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ if @title.nil?
54
+ invalid_properties.push("invalid value for 'title', title cannot be nil.")
55
+ end
56
+
57
+ return invalid_properties
58
+ end
59
+
60
+ # Check to see if the all the properties in the model are valid
61
+ # @return true if the model is valid
62
+ def valid?
63
+ return false if @title.nil?
64
+ return true
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ title == o.title
73
+ end
74
+
75
+ # @see the `==` method
76
+ # @param [Object] Object to be compared
77
+ def eql?(o)
78
+ self == o
79
+ end
80
+
81
+ # Calculates hash code according to all attributes.
82
+ # @return [Fixnum] Hash code
83
+ def hash
84
+ [title].hash
85
+ end
86
+
87
+ # Builds the object from hash
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ # @return [Object] Returns the model itself
90
+ def build_from_hash(attributes)
91
+ return nil unless attributes.is_a?(Hash)
92
+ self.class.swagger_types.each_pair do |key, type|
93
+ if type =~ /\AArray<(.*)>/i
94
+ # check to ensure the input is an array given that the the attribute
95
+ # is documented as an array but the input is not
96
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
97
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
98
+ end
99
+ elsif !attributes[self.class.attribute_map[key]].nil?
100
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
101
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
102
+ end
103
+
104
+ self
105
+ end
106
+
107
+ # Deserializes the data based on type
108
+ # @param string type Data type
109
+ # @param string value Value to be deserialized
110
+ # @return [Object] Deserialized data
111
+ def _deserialize(type, value)
112
+ case type.to_sym
113
+ when :DateTime
114
+ DateTime.parse(value)
115
+ when :Date
116
+ Date.parse(value)
117
+ when :String
118
+ value.to_s
119
+ when :Integer
120
+ value.to_i
121
+ when :Float
122
+ value.to_f
123
+ when :BOOLEAN
124
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
125
+ true
126
+ else
127
+ false
128
+ end
129
+ when :Object
130
+ # generic object (usually a Hash), return directly
131
+ value
132
+ when /\AArray<(?<inner_type>.+)>\z/
133
+ inner_type = Regexp.last_match[:inner_type]
134
+ value.map { |v| _deserialize(inner_type, v) }
135
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
136
+ k_type = Regexp.last_match[:k_type]
137
+ v_type = Regexp.last_match[:v_type]
138
+ {}.tap do |hash|
139
+ value.each do |k, v|
140
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
141
+ end
142
+ end
143
+ else # model
144
+ temp_model = FlatApi.const_get(type).new
145
+ temp_model.build_from_hash(value)
146
+ end
147
+ end
148
+
149
+ # Returns the string representation of the object
150
+ # @return [String] String presentation of the object
151
+ def to_s
152
+ to_hash.to_s
153
+ end
154
+
155
+ # to_body is an alias to to_hash (backward compatibility)
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_body
158
+ to_hash
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ next if value.nil?
168
+ hash[param] = _to_hash(value)
169
+ end
170
+ hash
171
+ end
172
+
173
+ # Outputs non-array value in the form of hash
174
+ # For object, use to_hash. Otherwise, just return the value
175
+ # @param [Object] value Any valid value
176
+ # @return [Hash] Returns the value in the form of hash
177
+ def _to_hash(value)
178
+ if value.is_a?(Array)
179
+ value.compact.map{ |v| _to_hash(v) }
180
+ elsif value.is_a?(Hash)
181
+ {}.tap do |hash|
182
+ value.each { |k, v| hash[k] = _to_hash(v) }
183
+ end
184
+ elsif value.respond_to? :to_hash
185
+ value.to_hash
186
+ else
187
+ value
188
+ end
189
+ end
190
+
191
+ end
192
+
193
+ end
@@ -0,0 +1,188 @@
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.6.0
7
+ Contact: developers@flat.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module FlatApi
16
+ # Edit the collection metadata
17
+ class CollectionModification
18
+ attr_accessor :title
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'title' => :'title'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'title' => :'CollectionTitle'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes.has_key?(:'title')
44
+ self.title = attributes[:'title']
45
+ end
46
+
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properties with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ return invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ return true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ title == o.title
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(o)
73
+ self == o
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [title].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :BOOLEAN
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ temp_model = FlatApi.const_get(type).new
140
+ temp_model.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
172
+ def _to_hash(value)
173
+ if value.is_a?(Array)
174
+ value.compact.map{ |v| _to_hash(v) }
175
+ elsif value.is_a?(Hash)
176
+ {}.tap do |hash|
177
+ value.each { |k, v| hash[k] = _to_hash(v) }
178
+ end
179
+ elsif value.respond_to? :to_hash
180
+ value.to_hash
181
+ else
182
+ value
183
+ end
184
+ end
185
+
186
+ end
187
+
188
+ end