songtradr_api_client_ruby 1.13.3 → 1.13.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +48 -5
- data/docs/AdminApiCreateUserDTO.md +76 -0
- data/docs/AdminApiUpdateUserDTO.md +76 -0
- data/docs/AdminUsersControllerApi.md +355 -0
- data/docs/AgeRange.md +20 -0
- data/docs/Beard.md +20 -0
- data/docs/BoundingBox.md +24 -0
- data/docs/ContextValue.md +18 -0
- data/docs/CuratePlaylistDTO.md +26 -0
- data/docs/CuratePlaylistResponseDTO.md +18 -0
- data/docs/DominantColor.md +30 -0
- data/docs/Emotion.md +20 -0
- data/docs/EyeDirection.md +22 -0
- data/docs/EyeOpen.md +20 -0
- data/docs/Eyeglasses.md +20 -0
- data/docs/FaceDetail.md +50 -0
- data/docs/FaceDetection.md +20 -0
- data/docs/FaceOccluded.md +20 -0
- data/docs/FileSmallDTO.md +5 -5
- data/docs/Gender.md +20 -0
- data/docs/ImageQuality.md +20 -0
- data/docs/ImageRecognitionResponse.md +20 -0
- data/docs/Instance.md +22 -0
- data/docs/InternalApiApi.md +149 -0
- data/docs/Label.md +28 -0
- data/docs/LabelAlias.md +18 -0
- data/docs/LabelCategory.md +18 -0
- data/docs/LabelDetection.md +26 -0
- data/docs/Landmark.md +22 -0
- data/docs/MouthOpen.md +20 -0
- data/docs/MusicalFeaturesDTO.md +38 -38
- data/docs/Mustache.md +20 -0
- data/docs/Parent.md +18 -0
- data/docs/PlaylistApi.md +70 -0
- data/docs/PlaylistLargeDTO.md +5 -5
- data/docs/Pose.md +22 -0
- data/docs/ProductMediumDTO.md +3 -3
- data/docs/RecordingGenrePredictionDTO.md +4 -4
- data/docs/RecordingLargeDTO.md +5 -5
- data/docs/RecordingMediumDTO.md +2 -2
- data/docs/RecordingMinimalWithMusicalFeaturesDTO.md +3 -3
- data/docs/RecordingSmallDTO.md +3 -3
- data/docs/SaveFileDTO.md +42 -0
- data/docs/SaveFileRecordingDTO.md +5 -1
- data/docs/Smile.md +20 -0
- data/docs/Sunglasses.md +20 -0
- data/docs/UserApi.md +140 -0
- data/docs/VideoRecognitionResponse.md +20 -0
- data/lib/songtradr_api_client_ruby/api/admin_users_controller_api.rb +346 -0
- data/lib/songtradr_api_client_ruby/api/allowed_values_api.rb +2 -2
- data/lib/songtradr_api_client_ruby/api/api_keys_api.rb +2 -2
- data/lib/songtradr_api_client_ruby/api/internal_api_api.rb +169 -0
- data/lib/songtradr_api_client_ruby/api/party_api.rb +2 -2
- data/lib/songtradr_api_client_ruby/api/playlist_api.rb +79 -2
- data/lib/songtradr_api_client_ruby/api/recording_api.rb +2 -2
- data/lib/songtradr_api_client_ruby/api/user_api.rb +138 -2
- data/lib/songtradr_api_client_ruby/api_client.rb +4 -3
- data/lib/songtradr_api_client_ruby/api_error.rb +2 -2
- data/lib/songtradr_api_client_ruby/configuration.rb +3 -2
- data/lib/songtradr_api_client_ruby/models/admin_api_create_user_dto.rb +489 -0
- data/lib/songtradr_api_client_ruby/models/admin_api_update_user_dto.rb +475 -0
- data/lib/songtradr_api_client_ruby/models/admin_api_user_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/age_range.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/api_key_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/beard.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/bounding_box.rb +241 -0
- data/lib/songtradr_api_client_ruby/models/category_medium_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/category_minimal_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/config_access_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/config_identifier_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/context_value.rb +216 -0
- data/lib/songtradr_api_client_ruby/models/contributor_type_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/create_api_key_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/curate_playlist_dto.rb +256 -0
- data/lib/songtradr_api_client_ruby/models/curate_playlist_response_dto.rb +216 -0
- data/lib/songtradr_api_client_ruby/models/dominant_color.rb +268 -0
- data/lib/songtradr_api_client_ruby/models/emotion.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/error_response.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/eye_direction.rb +232 -0
- data/lib/songtradr_api_client_ruby/models/eye_open.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/eyeglasses.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/face_detail.rb +362 -0
- data/lib/songtradr_api_client_ruby/models/face_detection.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/face_occluded.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/field_summary_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/file_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/file_list_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/file_minimal_with_url_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/file_small_dto.rb +24 -24
- data/lib/songtradr_api_client_ruby/models/file_upload_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/file_w_ith_url_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/files_summary_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/forgot_password_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/gender.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/genre_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/genre_minimal_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/genres_summary_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/image_quality.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/image_recognition_response.rb +227 -0
- data/lib/songtradr_api_client_ruby/models/init_put_recording_audio_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/instance.rb +234 -0
- data/lib/songtradr_api_client_ruby/models/jwt_token_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/label.rb +267 -0
- data/lib/songtradr_api_client_ruby/models/label_alias.rb +214 -0
- data/lib/songtradr_api_client_ruby/models/label_category.rb +214 -0
- data/lib/songtradr_api_client_ruby/models/label_detection.rb +250 -0
- data/lib/songtradr_api_client_ruby/models/landmark.rb +232 -0
- data/lib/songtradr_api_client_ruby/models/login_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/mouth_open.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/musical_features_dto.rb +285 -285
- data/lib/songtradr_api_client_ruby/models/mustache.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/p_line_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/parent.rb +214 -0
- data/lib/songtradr_api_client_ruby/models/party_large_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/party_small_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/playlist_large_dto.rb +24 -24
- data/lib/songtradr_api_client_ruby/models/pose.rb +232 -0
- data/lib/songtradr_api_client_ruby/models/product_medium_dto.rb +15 -15
- data/lib/songtradr_api_client_ruby/models/product_party_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/recording_for_similarity_search_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/recording_genre_prediction_dto.rb +23 -23
- data/lib/songtradr_api_client_ruby/models/recording_large_dto.rb +26 -26
- data/lib/songtradr_api_client_ruby/models/recording_list_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/recording_medium_dto.rb +14 -14
- data/lib/songtradr_api_client_ruby/models/recording_minimal_with_musical_features_dto.rb +17 -17
- data/lib/songtradr_api_client_ruby/models/recording_minimal_with_taggrams_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/recording_minimal_with_tagstrengths_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/recording_party_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/recording_playlist_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/recording_small_dto.rb +17 -17
- data/lib/songtradr_api_client_ruby/models/recording_tag_small_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/save_file_dto.rb +323 -0
- data/lib/songtradr_api_client_ruby/models/save_file_recording_dto.rb +30 -12
- data/lib/songtradr_api_client_ruby/models/save_playlist_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/save_recording_genre_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/save_recording_party_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/save_recording_playlist_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/save_recording_tag_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/save_referrer_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/save_taggrams_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/save_user_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/search_filter_values_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/search_recording_granular_abstraction_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/search_recording_granular_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/sign_up_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/smile.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/sunglasses.rb +223 -0
- data/lib/songtradr_api_client_ruby/models/tag_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/tag_small_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/taggram_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/tags_summary_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/tagstrength_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/title_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/token_request.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/track_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/track_to_medium_product_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/update_password_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/usage_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/user_dto.rb +2 -2
- data/lib/songtradr_api_client_ruby/models/video_recognition_response.rb +227 -0
- data/lib/songtradr_api_client_ruby/version.rb +3 -3
- data/lib/songtradr_api_client_ruby.rb +37 -2
- data/openapi-generator-config.yaml +1 -1
- data/songtradr_api_client_ruby.gemspec +2 -2
- data/spec/api/admin_users_controller_api_spec.rb +93 -0
- data/spec/api/allowed_values_api_spec.rb +2 -2
- data/spec/api/api_keys_api_spec.rb +2 -2
- data/spec/api/internal_api_api_spec.rb +58 -0
- data/spec/api/party_api_spec.rb +2 -2
- data/spec/api/playlist_api_spec.rb +14 -2
- data/spec/api/recording_api_spec.rb +2 -2
- data/spec/api/user_api_spec.rb +26 -2
- data/spec/api_client_spec.rb +2 -2
- data/spec/configuration_spec.rb +2 -2
- data/spec/models/admin_api_create_user_dto_spec.rb +210 -0
- data/spec/models/admin_api_update_user_dto_spec.rb +210 -0
- data/spec/models/admin_api_user_dto_spec.rb +5 -3
- data/spec/models/age_range_spec.rb +42 -0
- data/spec/models/api_key_dto_spec.rb +5 -3
- data/spec/models/beard_spec.rb +42 -0
- data/spec/models/bounding_box_spec.rb +54 -0
- data/spec/models/category_medium_dto_spec.rb +5 -3
- data/spec/models/category_minimal_dto_spec.rb +5 -3
- data/spec/models/config_access_dto_spec.rb +5 -3
- data/spec/models/config_identifier_dto_spec.rb +5 -3
- data/spec/models/context_value_spec.rb +36 -0
- data/spec/models/contributor_type_dto_spec.rb +5 -3
- data/spec/models/create_api_key_dto_spec.rb +5 -3
- data/spec/models/curate_playlist_dto_spec.rb +60 -0
- data/spec/models/curate_playlist_response_dto_spec.rb +36 -0
- data/spec/models/dominant_color_spec.rb +72 -0
- data/spec/models/emotion_spec.rb +42 -0
- data/spec/models/error_response_spec.rb +5 -3
- data/spec/models/eye_direction_spec.rb +48 -0
- data/spec/models/eye_open_spec.rb +42 -0
- data/spec/models/eyeglasses_spec.rb +42 -0
- data/spec/models/face_detail_spec.rb +132 -0
- data/spec/models/face_detection_spec.rb +42 -0
- data/spec/models/face_occluded_spec.rb +42 -0
- data/spec/models/field_summary_dto_spec.rb +5 -3
- data/spec/models/file_dto_spec.rb +5 -3
- data/spec/models/file_list_dto_spec.rb +5 -3
- data/spec/models/file_minimal_with_url_dto_spec.rb +5 -3
- data/spec/models/file_small_dto_spec.rb +17 -15
- data/spec/models/file_upload_dto_spec.rb +5 -3
- data/spec/models/file_w_ith_url_dto_spec.rb +5 -3
- data/spec/models/files_summary_dto_spec.rb +5 -3
- data/spec/models/forgot_password_dto_spec.rb +5 -3
- data/spec/models/gender_spec.rb +42 -0
- data/spec/models/genre_dto_spec.rb +5 -3
- data/spec/models/genre_minimal_dto_spec.rb +5 -3
- data/spec/models/genres_summary_dto_spec.rb +5 -3
- data/spec/models/image_quality_spec.rb +42 -0
- data/spec/models/image_recognition_response_spec.rb +42 -0
- data/spec/models/init_put_recording_audio_dto_spec.rb +5 -3
- data/spec/models/instance_spec.rb +48 -0
- data/spec/models/jwt_token_dto_spec.rb +5 -3
- data/spec/models/label_alias_spec.rb +36 -0
- data/spec/models/label_category_spec.rb +36 -0
- data/spec/models/label_detection_spec.rb +60 -0
- data/spec/models/label_spec.rb +66 -0
- data/spec/models/landmark_spec.rb +48 -0
- data/spec/models/login_dto_spec.rb +5 -3
- data/spec/models/mouth_open_spec.rb +42 -0
- data/spec/models/musical_features_dto_spec.rb +114 -112
- data/spec/models/mustache_spec.rb +42 -0
- data/spec/models/p_line_dto_spec.rb +5 -3
- data/spec/models/parent_spec.rb +36 -0
- data/spec/models/party_large_dto_spec.rb +5 -3
- data/spec/models/party_small_dto_spec.rb +5 -3
- data/spec/models/playlist_large_dto_spec.rb +14 -12
- data/spec/models/pose_spec.rb +48 -0
- data/spec/models/product_medium_dto_spec.rb +11 -9
- data/spec/models/product_party_dto_spec.rb +5 -3
- data/spec/models/recording_for_similarity_search_dto_spec.rb +5 -3
- data/spec/models/recording_genre_prediction_dto_spec.rb +7 -5
- data/spec/models/recording_large_dto_spec.rb +13 -11
- data/spec/models/recording_list_dto_spec.rb +5 -3
- data/spec/models/recording_medium_dto_spec.rb +10 -8
- data/spec/models/recording_minimal_with_musical_features_dto_spec.rb +7 -5
- data/spec/models/recording_minimal_with_taggrams_dto_spec.rb +5 -3
- data/spec/models/recording_minimal_with_tagstrengths_dto_spec.rb +5 -3
- data/spec/models/recording_party_dto_spec.rb +5 -3
- data/spec/models/recording_playlist_dto_spec.rb +5 -3
- data/spec/models/recording_small_dto_spec.rb +8 -6
- data/spec/models/recording_tag_small_dto_spec.rb +5 -3
- data/spec/models/save_file_dto_spec.rb +108 -0
- data/spec/models/save_file_recording_dto_spec.rb +20 -6
- data/spec/models/save_playlist_dto_spec.rb +5 -3
- data/spec/models/save_recording_genre_dto_spec.rb +5 -3
- data/spec/models/save_recording_party_dto_spec.rb +5 -3
- data/spec/models/save_recording_playlist_dto_spec.rb +5 -3
- data/spec/models/save_recording_tag_dto_spec.rb +5 -3
- data/spec/models/save_referrer_dto_spec.rb +5 -3
- data/spec/models/save_taggrams_dto_spec.rb +5 -3
- data/spec/models/save_user_dto_spec.rb +5 -3
- data/spec/models/search_filter_values_dto_spec.rb +5 -3
- data/spec/models/search_recording_granular_abstraction_dto_spec.rb +5 -3
- data/spec/models/search_recording_granular_dto_spec.rb +5 -3
- data/spec/models/sign_up_dto_spec.rb +5 -3
- data/spec/models/smile_spec.rb +42 -0
- data/spec/models/sunglasses_spec.rb +42 -0
- data/spec/models/tag_dto_spec.rb +5 -3
- data/spec/models/tag_small_dto_spec.rb +5 -3
- data/spec/models/taggram_dto_spec.rb +5 -3
- data/spec/models/tags_summary_dto_spec.rb +5 -3
- data/spec/models/tagstrength_dto_spec.rb +5 -3
- data/spec/models/title_dto_spec.rb +5 -3
- data/spec/models/token_request_spec.rb +5 -3
- data/spec/models/track_dto_spec.rb +5 -3
- data/spec/models/track_to_medium_product_dto_spec.rb +5 -3
- data/spec/models/update_password_dto_spec.rb +5 -3
- data/spec/models/usage_dto_spec.rb +5 -3
- data/spec/models/user_dto_spec.rb +5 -3
- data/spec/models/video_recognition_response_spec.rb +42 -0
- data/spec/spec_helper.rb +2 -2
- metadata +201 -61
@@ -0,0 +1,267 @@
|
|
1
|
+
=begin
|
2
|
+
#Songtradr API
|
3
|
+
|
4
|
+
#This is the Songtradr API. Use it to retrieve deep music metadata and trigger processes like auto-tagging. You can also use the API to manage your account and musicube cloud data. **Authentication** 1. Reach out to support@songtradr.com to receive a free account or use your login data if you are already signed up. 2. To authenticate, you need to login via the POST /api/v1/user/login endpoint. 3. The endpoint responds with a jwtToken which you can use in all following API requests as a bearer token. **Rate Limiting** The current limit is 120 Requests per minute. Reach out to us via support@songtradr.com if you need to request more. **Getting Started with auto-tagging** 1. If you want to get your own files auto-tagged, use the POST /api/v1/user/file/{name}/initUpload endpoint. It responds with a presigned S3 link where you can upload your file. 2. You can check the processing status of your file via the GET /api/v1/user/file/{name}/filesStatus endpoint. 3. As soon as processing is done, you can request the generated data via the GET /api/v1/user/files endpoint. **Getting Started with search** You can either search the released music via the /public/recording endpoints or your own private uploaded music via the /user/file/ endpoints. 1. If you want to search the world's released music, a good starting point is the GET /api/v1/public/recording/search endpoint. Please find the extensive list of parameters that serve as semantic search filters. 2. If you want to search your own previously uploaded music, a good starting point is the GET GET /api/v1/user/files endpoint. It has the same extensive list of parameters that serve as semantic search filters.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.13.5
|
7
|
+
Contact: info@songtradr.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module SongtradrApiClientRuby
|
17
|
+
class Label
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
attr_accessor :confidence
|
21
|
+
|
22
|
+
attr_accessor :instances
|
23
|
+
|
24
|
+
attr_accessor :parents
|
25
|
+
|
26
|
+
attr_accessor :aliases
|
27
|
+
|
28
|
+
attr_accessor :categories
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'name' => :'name',
|
34
|
+
:'confidence' => :'confidence',
|
35
|
+
:'instances' => :'instances',
|
36
|
+
:'parents' => :'parents',
|
37
|
+
:'aliases' => :'aliases',
|
38
|
+
:'categories' => :'categories'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns all the JSON keys this model knows about
|
43
|
+
def self.acceptable_attributes
|
44
|
+
attribute_map.values
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute type mapping.
|
48
|
+
def self.openapi_types
|
49
|
+
{
|
50
|
+
:'name' => :'String',
|
51
|
+
:'confidence' => :'Float',
|
52
|
+
:'instances' => :'Array<Instance>',
|
53
|
+
:'parents' => :'Array<Parent>',
|
54
|
+
:'aliases' => :'Array<LabelAlias>',
|
55
|
+
:'categories' => :'Array<LabelCategory>'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# List of attributes with nullable: true
|
60
|
+
def self.openapi_nullable
|
61
|
+
Set.new([
|
62
|
+
])
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initializes the object
|
66
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
67
|
+
def initialize(attributes = {})
|
68
|
+
if (!attributes.is_a?(Hash))
|
69
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SongtradrApiClientRuby::Label` initialize method"
|
70
|
+
end
|
71
|
+
|
72
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
73
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
74
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
75
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SongtradrApiClientRuby::Label`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
76
|
+
end
|
77
|
+
h[k.to_sym] = v
|
78
|
+
}
|
79
|
+
|
80
|
+
if attributes.key?(:'name')
|
81
|
+
self.name = attributes[:'name']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'confidence')
|
85
|
+
self.confidence = attributes[:'confidence']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:'instances')
|
89
|
+
if (value = attributes[:'instances']).is_a?(Array)
|
90
|
+
self.instances = value
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'parents')
|
95
|
+
if (value = attributes[:'parents']).is_a?(Array)
|
96
|
+
self.parents = value
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'aliases')
|
101
|
+
if (value = attributes[:'aliases']).is_a?(Array)
|
102
|
+
self.aliases = value
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'categories')
|
107
|
+
if (value = attributes[:'categories']).is_a?(Array)
|
108
|
+
self.categories = value
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
114
|
+
# @return Array for valid properties with the reasons
|
115
|
+
def list_invalid_properties
|
116
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
117
|
+
invalid_properties = Array.new
|
118
|
+
invalid_properties
|
119
|
+
end
|
120
|
+
|
121
|
+
# Check to see if the all the properties in the model are valid
|
122
|
+
# @return true if the model is valid
|
123
|
+
def valid?
|
124
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
125
|
+
true
|
126
|
+
end
|
127
|
+
|
128
|
+
# Checks equality by comparing each attribute.
|
129
|
+
# @param [Object] Object to be compared
|
130
|
+
def ==(o)
|
131
|
+
return true if self.equal?(o)
|
132
|
+
self.class == o.class &&
|
133
|
+
name == o.name &&
|
134
|
+
confidence == o.confidence &&
|
135
|
+
instances == o.instances &&
|
136
|
+
parents == o.parents &&
|
137
|
+
aliases == o.aliases &&
|
138
|
+
categories == o.categories
|
139
|
+
end
|
140
|
+
|
141
|
+
# @see the `==` method
|
142
|
+
# @param [Object] Object to be compared
|
143
|
+
def eql?(o)
|
144
|
+
self == o
|
145
|
+
end
|
146
|
+
|
147
|
+
# Calculates hash code according to all attributes.
|
148
|
+
# @return [Integer] Hash code
|
149
|
+
def hash
|
150
|
+
[name, confidence, instances, parents, aliases, categories].hash
|
151
|
+
end
|
152
|
+
|
153
|
+
# Builds the object from hash
|
154
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
155
|
+
# @return [Object] Returns the model itself
|
156
|
+
def self.build_from_hash(attributes)
|
157
|
+
return nil unless attributes.is_a?(Hash)
|
158
|
+
attributes = attributes.transform_keys(&:to_sym)
|
159
|
+
transformed_hash = {}
|
160
|
+
openapi_types.each_pair do |key, type|
|
161
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
162
|
+
transformed_hash["#{key}"] = nil
|
163
|
+
elsif type =~ /\AArray<(.*)>/i
|
164
|
+
# check to ensure the input is an array given that the attribute
|
165
|
+
# is documented as an array but the input is not
|
166
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
167
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
168
|
+
end
|
169
|
+
elsif !attributes[attribute_map[key]].nil?
|
170
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
171
|
+
end
|
172
|
+
end
|
173
|
+
new(transformed_hash)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Deserializes the data based on type
|
177
|
+
# @param string type Data type
|
178
|
+
# @param string value Value to be deserialized
|
179
|
+
# @return [Object] Deserialized data
|
180
|
+
def self._deserialize(type, value)
|
181
|
+
case type.to_sym
|
182
|
+
when :Time
|
183
|
+
Time.parse(value)
|
184
|
+
when :Date
|
185
|
+
Date.parse(value)
|
186
|
+
when :String
|
187
|
+
value.to_s
|
188
|
+
when :Integer
|
189
|
+
value.to_i
|
190
|
+
when :Float
|
191
|
+
value.to_f
|
192
|
+
when :Boolean
|
193
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
194
|
+
true
|
195
|
+
else
|
196
|
+
false
|
197
|
+
end
|
198
|
+
when :Object
|
199
|
+
# generic object (usually a Hash), return directly
|
200
|
+
value
|
201
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
202
|
+
inner_type = Regexp.last_match[:inner_type]
|
203
|
+
value.map { |v| _deserialize(inner_type, v) }
|
204
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
205
|
+
k_type = Regexp.last_match[:k_type]
|
206
|
+
v_type = Regexp.last_match[:v_type]
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each do |k, v|
|
209
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
else # model
|
213
|
+
# models (e.g. Pet) or oneOf
|
214
|
+
klass = SongtradrApiClientRuby.const_get(type)
|
215
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the string representation of the object
|
220
|
+
# @return [String] String presentation of the object
|
221
|
+
def to_s
|
222
|
+
to_hash.to_s
|
223
|
+
end
|
224
|
+
|
225
|
+
# to_body is an alias to to_hash (backward compatibility)
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
227
|
+
def to_body
|
228
|
+
to_hash
|
229
|
+
end
|
230
|
+
|
231
|
+
# Returns the object in the form of hash
|
232
|
+
# @return [Hash] Returns the object in the form of hash
|
233
|
+
def to_hash
|
234
|
+
hash = {}
|
235
|
+
self.class.attribute_map.each_pair do |attr, param|
|
236
|
+
value = self.send(attr)
|
237
|
+
if value.nil?
|
238
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
239
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
240
|
+
end
|
241
|
+
|
242
|
+
hash[param] = _to_hash(value)
|
243
|
+
end
|
244
|
+
hash
|
245
|
+
end
|
246
|
+
|
247
|
+
# Outputs non-array value in the form of hash
|
248
|
+
# For object, use to_hash. Otherwise, just return the value
|
249
|
+
# @param [Object] value Any valid value
|
250
|
+
# @return [Hash] Returns the value in the form of hash
|
251
|
+
def _to_hash(value)
|
252
|
+
if value.is_a?(Array)
|
253
|
+
value.compact.map { |v| _to_hash(v) }
|
254
|
+
elsif value.is_a?(Hash)
|
255
|
+
{}.tap do |hash|
|
256
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
257
|
+
end
|
258
|
+
elsif value.respond_to? :to_hash
|
259
|
+
value.to_hash
|
260
|
+
else
|
261
|
+
value
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
=begin
|
2
|
+
#Songtradr API
|
3
|
+
|
4
|
+
#This is the Songtradr API. Use it to retrieve deep music metadata and trigger processes like auto-tagging. You can also use the API to manage your account and musicube cloud data. **Authentication** 1. Reach out to support@songtradr.com to receive a free account or use your login data if you are already signed up. 2. To authenticate, you need to login via the POST /api/v1/user/login endpoint. 3. The endpoint responds with a jwtToken which you can use in all following API requests as a bearer token. **Rate Limiting** The current limit is 120 Requests per minute. Reach out to us via support@songtradr.com if you need to request more. **Getting Started with auto-tagging** 1. If you want to get your own files auto-tagged, use the POST /api/v1/user/file/{name}/initUpload endpoint. It responds with a presigned S3 link where you can upload your file. 2. You can check the processing status of your file via the GET /api/v1/user/file/{name}/filesStatus endpoint. 3. As soon as processing is done, you can request the generated data via the GET /api/v1/user/files endpoint. **Getting Started with search** You can either search the released music via the /public/recording endpoints or your own private uploaded music via the /user/file/ endpoints. 1. If you want to search the world's released music, a good starting point is the GET /api/v1/public/recording/search endpoint. Please find the extensive list of parameters that serve as semantic search filters. 2. If you want to search your own previously uploaded music, a good starting point is the GET GET /api/v1/user/files endpoint. It has the same extensive list of parameters that serve as semantic search filters.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.13.5
|
7
|
+
Contact: info@songtradr.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module SongtradrApiClientRuby
|
17
|
+
class LabelAlias
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'name' => :'name'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'name' => :'String'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SongtradrApiClientRuby::LabelAlias` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SongtradrApiClientRuby::LabelAlias`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'name')
|
61
|
+
self.name = attributes[:'name']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
69
|
+
invalid_properties = Array.new
|
70
|
+
invalid_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check to see if the all the properties in the model are valid
|
74
|
+
# @return true if the model is valid
|
75
|
+
def valid?
|
76
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
# Checks equality by comparing each attribute.
|
81
|
+
# @param [Object] Object to be compared
|
82
|
+
def ==(o)
|
83
|
+
return true if self.equal?(o)
|
84
|
+
self.class == o.class &&
|
85
|
+
name == o.name
|
86
|
+
end
|
87
|
+
|
88
|
+
# @see the `==` method
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def eql?(o)
|
91
|
+
self == o
|
92
|
+
end
|
93
|
+
|
94
|
+
# Calculates hash code according to all attributes.
|
95
|
+
# @return [Integer] Hash code
|
96
|
+
def hash
|
97
|
+
[name].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def self.build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
attributes = attributes.transform_keys(&:to_sym)
|
106
|
+
transformed_hash = {}
|
107
|
+
openapi_types.each_pair do |key, type|
|
108
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
109
|
+
transformed_hash["#{key}"] = nil
|
110
|
+
elsif type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the attribute
|
112
|
+
# is documented as an array but the input is not
|
113
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
114
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
115
|
+
end
|
116
|
+
elsif !attributes[attribute_map[key]].nil?
|
117
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
118
|
+
end
|
119
|
+
end
|
120
|
+
new(transformed_hash)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def self._deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :Time
|
130
|
+
Time.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :Boolean
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
# models (e.g. Pet) or oneOf
|
161
|
+
klass = SongtradrApiClientRuby.const_get(type)
|
162
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
if value.nil?
|
185
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
186
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
187
|
+
end
|
188
|
+
|
189
|
+
hash[param] = _to_hash(value)
|
190
|
+
end
|
191
|
+
hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Outputs non-array value in the form of hash
|
195
|
+
# For object, use to_hash. Otherwise, just return the value
|
196
|
+
# @param [Object] value Any valid value
|
197
|
+
# @return [Hash] Returns the value in the form of hash
|
198
|
+
def _to_hash(value)
|
199
|
+
if value.is_a?(Array)
|
200
|
+
value.compact.map { |v| _to_hash(v) }
|
201
|
+
elsif value.is_a?(Hash)
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
+
end
|
205
|
+
elsif value.respond_to? :to_hash
|
206
|
+
value.to_hash
|
207
|
+
else
|
208
|
+
value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
=begin
|
2
|
+
#Songtradr API
|
3
|
+
|
4
|
+
#This is the Songtradr API. Use it to retrieve deep music metadata and trigger processes like auto-tagging. You can also use the API to manage your account and musicube cloud data. **Authentication** 1. Reach out to support@songtradr.com to receive a free account or use your login data if you are already signed up. 2. To authenticate, you need to login via the POST /api/v1/user/login endpoint. 3. The endpoint responds with a jwtToken which you can use in all following API requests as a bearer token. **Rate Limiting** The current limit is 120 Requests per minute. Reach out to us via support@songtradr.com if you need to request more. **Getting Started with auto-tagging** 1. If you want to get your own files auto-tagged, use the POST /api/v1/user/file/{name}/initUpload endpoint. It responds with a presigned S3 link where you can upload your file. 2. You can check the processing status of your file via the GET /api/v1/user/file/{name}/filesStatus endpoint. 3. As soon as processing is done, you can request the generated data via the GET /api/v1/user/files endpoint. **Getting Started with search** You can either search the released music via the /public/recording endpoints or your own private uploaded music via the /user/file/ endpoints. 1. If you want to search the world's released music, a good starting point is the GET /api/v1/public/recording/search endpoint. Please find the extensive list of parameters that serve as semantic search filters. 2. If you want to search your own previously uploaded music, a good starting point is the GET GET /api/v1/user/files endpoint. It has the same extensive list of parameters that serve as semantic search filters.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.13.5
|
7
|
+
Contact: info@songtradr.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module SongtradrApiClientRuby
|
17
|
+
class LabelCategory
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'name' => :'name'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'name' => :'String'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SongtradrApiClientRuby::LabelCategory` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SongtradrApiClientRuby::LabelCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'name')
|
61
|
+
self.name = attributes[:'name']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
69
|
+
invalid_properties = Array.new
|
70
|
+
invalid_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check to see if the all the properties in the model are valid
|
74
|
+
# @return true if the model is valid
|
75
|
+
def valid?
|
76
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
# Checks equality by comparing each attribute.
|
81
|
+
# @param [Object] Object to be compared
|
82
|
+
def ==(o)
|
83
|
+
return true if self.equal?(o)
|
84
|
+
self.class == o.class &&
|
85
|
+
name == o.name
|
86
|
+
end
|
87
|
+
|
88
|
+
# @see the `==` method
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def eql?(o)
|
91
|
+
self == o
|
92
|
+
end
|
93
|
+
|
94
|
+
# Calculates hash code according to all attributes.
|
95
|
+
# @return [Integer] Hash code
|
96
|
+
def hash
|
97
|
+
[name].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def self.build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
attributes = attributes.transform_keys(&:to_sym)
|
106
|
+
transformed_hash = {}
|
107
|
+
openapi_types.each_pair do |key, type|
|
108
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
109
|
+
transformed_hash["#{key}"] = nil
|
110
|
+
elsif type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the attribute
|
112
|
+
# is documented as an array but the input is not
|
113
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
114
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
115
|
+
end
|
116
|
+
elsif !attributes[attribute_map[key]].nil?
|
117
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
118
|
+
end
|
119
|
+
end
|
120
|
+
new(transformed_hash)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def self._deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :Time
|
130
|
+
Time.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :Boolean
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
# models (e.g. Pet) or oneOf
|
161
|
+
klass = SongtradrApiClientRuby.const_get(type)
|
162
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
if value.nil?
|
185
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
186
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
187
|
+
end
|
188
|
+
|
189
|
+
hash[param] = _to_hash(value)
|
190
|
+
end
|
191
|
+
hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Outputs non-array value in the form of hash
|
195
|
+
# For object, use to_hash. Otherwise, just return the value
|
196
|
+
# @param [Object] value Any valid value
|
197
|
+
# @return [Hash] Returns the value in the form of hash
|
198
|
+
def _to_hash(value)
|
199
|
+
if value.is_a?(Array)
|
200
|
+
value.compact.map { |v| _to_hash(v) }
|
201
|
+
elsif value.is_a?(Hash)
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
+
end
|
205
|
+
elsif value.respond_to? :to_hash
|
206
|
+
value.to_hash
|
207
|
+
else
|
208
|
+
value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|