aimastering 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +167 -0
  4. data/Rakefile +8 -0
  5. data/aimastering.gemspec +45 -0
  6. data/docs/AccessToken.md +8 -0
  7. data/docs/AccessTokenApi.md +55 -0
  8. data/docs/AnonymizedMastering.md +29 -0
  9. data/docs/Audio.md +29 -0
  10. data/docs/AudioAnalysis.md +10 -0
  11. data/docs/AudioApi.md +374 -0
  12. data/docs/AudioDownloadToken.md +9 -0
  13. data/docs/Config.md +10 -0
  14. data/docs/ConfigApi.md +55 -0
  15. data/docs/ConfigAuth0.md +10 -0
  16. data/docs/ConfigPaypal.md +9 -0
  17. data/docs/ConfigStripe.md +8 -0
  18. data/docs/DateTime.md +7 -0
  19. data/docs/ExternalSearchApi.md +64 -0
  20. data/docs/ExternalSearchResult.md +9 -0
  21. data/docs/ExternalSearchResultItunes.md +18 -0
  22. data/docs/ExternalSearchResultYoutube.md +15 -0
  23. data/docs/JWT.md +7 -0
  24. data/docs/Kpi.md +7 -0
  25. data/docs/LibraryAudio.md +38 -0
  26. data/docs/LibraryAudioAnalysis.md +10 -0
  27. data/docs/LibraryAudioApi.md +378 -0
  28. data/docs/LibraryAudioLike.md +10 -0
  29. data/docs/Mastering.md +35 -0
  30. data/docs/MasteringApi.md +482 -0
  31. data/docs/Payment.md +14 -0
  32. data/docs/PaymentApi.md +224 -0
  33. data/docs/PaymentCustomer.md +11 -0
  34. data/docs/PaymentCustomerApi.md +55 -0
  35. data/docs/Plan.md +12 -0
  36. data/docs/PlanApi.md +55 -0
  37. data/docs/StatisticsApi.md +102 -0
  38. data/docs/Subscription.md +17 -0
  39. data/docs/SubscriptionApi.md +273 -0
  40. data/docs/User.md +14 -0
  41. data/docs/UserApi.md +111 -0
  42. data/docs/Video.md +13 -0
  43. data/docs/VideoApi.md +267 -0
  44. data/docs/VideoDownloadToken.md +9 -0
  45. data/git_push.sh +55 -0
  46. data/lib/aimastering.rb +77 -0
  47. data/lib/aimastering/api/access_token_api.rb +70 -0
  48. data/lib/aimastering/api/audio_api.rb +404 -0
  49. data/lib/aimastering/api/config_api.rb +70 -0
  50. data/lib/aimastering/api/external_search_api.rb +84 -0
  51. data/lib/aimastering/api/library_audio_api.rb +416 -0
  52. data/lib/aimastering/api/mastering_api.rb +596 -0
  53. data/lib/aimastering/api/payment_api.rb +263 -0
  54. data/lib/aimastering/api/payment_customer_api.rb +70 -0
  55. data/lib/aimastering/api/plan_api.rb +70 -0
  56. data/lib/aimastering/api/statistics_api.rb +117 -0
  57. data/lib/aimastering/api/subscription_api.rb +311 -0
  58. data/lib/aimastering/api/user_api.rb +125 -0
  59. data/lib/aimastering/api/video_api.rb +295 -0
  60. data/lib/aimastering/api_client.rb +389 -0
  61. data/lib/aimastering/api_error.rb +38 -0
  62. data/lib/aimastering/configuration.rb +209 -0
  63. data/lib/aimastering/models/access_token.rb +188 -0
  64. data/lib/aimastering/models/anonymized_mastering.rb +520 -0
  65. data/lib/aimastering/models/audio.rb +377 -0
  66. data/lib/aimastering/models/audio_analysis.rb +209 -0
  67. data/lib/aimastering/models/audio_download_token.rb +197 -0
  68. data/lib/aimastering/models/config.rb +206 -0
  69. data/lib/aimastering/models/config_auth0.rb +206 -0
  70. data/lib/aimastering/models/config_paypal.rb +197 -0
  71. data/lib/aimastering/models/config_stripe.rb +188 -0
  72. data/lib/aimastering/models/date_time.rb +179 -0
  73. data/lib/aimastering/models/external_search_result.rb +201 -0
  74. data/lib/aimastering/models/external_search_result_itunes.rb +278 -0
  75. data/lib/aimastering/models/external_search_result_youtube.rb +251 -0
  76. data/lib/aimastering/models/jwt.rb +179 -0
  77. data/lib/aimastering/models/kpi.rb +179 -0
  78. data/lib/aimastering/models/library_audio.rb +458 -0
  79. data/lib/aimastering/models/library_audio_analysis.rb +209 -0
  80. data/lib/aimastering/models/library_audio_like.rb +209 -0
  81. data/lib/aimastering/models/mastering.rb +587 -0
  82. data/lib/aimastering/models/payment.rb +275 -0
  83. data/lib/aimastering/models/payment_customer.rb +215 -0
  84. data/lib/aimastering/models/plan.rb +269 -0
  85. data/lib/aimastering/models/subscription.rb +302 -0
  86. data/lib/aimastering/models/user.rb +275 -0
  87. data/lib/aimastering/models/video.rb +233 -0
  88. data/lib/aimastering/models/video_download_token.rb +197 -0
  89. data/lib/aimastering/version.rb +15 -0
  90. data/spec/api/access_token_api_spec.rb +46 -0
  91. data/spec/api/audio_api_spec.rb +118 -0
  92. data/spec/api/config_api_spec.rb +46 -0
  93. data/spec/api/external_search_api_spec.rb +48 -0
  94. data/spec/api/library_audio_api_spec.rb +119 -0
  95. data/spec/api/mastering_api_spec.rb +154 -0
  96. data/spec/api/payment_api_spec.rb +85 -0
  97. data/spec/api/payment_customer_api_spec.rb +46 -0
  98. data/spec/api/plan_api_spec.rb +46 -0
  99. data/spec/api/statistics_api_spec.rb +57 -0
  100. data/spec/api/subscription_api_spec.rb +96 -0
  101. data/spec/api/user_api_spec.rb +59 -0
  102. data/spec/api/video_api_spec.rb +94 -0
  103. data/spec/api_client_spec.rb +226 -0
  104. data/spec/configuration_spec.rb +42 -0
  105. data/spec/models/access_token_spec.rb +42 -0
  106. data/spec/models/anonymized_mastering_spec.rb +192 -0
  107. data/spec/models/audio_analysis_spec.rb +54 -0
  108. data/spec/models/audio_download_token_spec.rb +48 -0
  109. data/spec/models/audio_spec.rb +168 -0
  110. data/spec/models/config_auth0_spec.rb +54 -0
  111. data/spec/models/config_paypal_spec.rb +48 -0
  112. data/spec/models/config_spec.rb +54 -0
  113. data/spec/models/config_stripe_spec.rb +42 -0
  114. data/spec/models/date_time_spec.rb +36 -0
  115. data/spec/models/external_search_result_itunes_spec.rb +102 -0
  116. data/spec/models/external_search_result_spec.rb +48 -0
  117. data/spec/models/external_search_result_youtube_spec.rb +84 -0
  118. data/spec/models/jwt_spec.rb +36 -0
  119. data/spec/models/kpi_spec.rb +36 -0
  120. data/spec/models/library_audio_analysis_spec.rb +54 -0
  121. data/spec/models/library_audio_like_spec.rb +54 -0
  122. data/spec/models/library_audio_spec.rb +222 -0
  123. data/spec/models/mastering_spec.rb +224 -0
  124. data/spec/models/payment_customer_spec.rb +60 -0
  125. data/spec/models/payment_spec.rb +82 -0
  126. data/spec/models/plan_spec.rb +74 -0
  127. data/spec/models/subscription_spec.rb +100 -0
  128. data/spec/models/user_spec.rb +82 -0
  129. data/spec/models/video_download_token_spec.rb +48 -0
  130. data/spec/models/video_spec.rb +72 -0
  131. data/spec/spec_helper.rb +111 -0
  132. metadata +397 -0
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #AI Mastering API
3
+
4
+ #This is a AI Mastering API document. You can use the mastering feature of [AI Mastering](https://aimastering.com) through this API.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: aimasteringcom@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Aimastering
16
+
17
+ class LibraryAudioAnalysis
18
+ # Audio analysis id
19
+ attr_accessor :id
20
+
21
+ # Audio id
22
+ attr_accessor :library_audio_id
23
+
24
+ # Audio analysis data. The schema changes frequently.
25
+ attr_accessor :analysis
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'library_audio_id' => :'library_audio_id',
33
+ :'analysis' => :'analysis'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'id' => :'Integer',
41
+ :'library_audio_id' => :'Integer',
42
+ :'analysis' => :'Object'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'id')
55
+ self.id = attributes[:'id']
56
+ end
57
+
58
+ if attributes.has_key?(:'library_audio_id')
59
+ self.library_audio_id = attributes[:'library_audio_id']
60
+ end
61
+
62
+ if attributes.has_key?(:'analysis')
63
+ self.analysis = attributes[:'analysis']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ return invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ return true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ id == o.id &&
87
+ library_audio_id == o.library_audio_id &&
88
+ analysis == o.analysis
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [id, library_audio_id, analysis].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
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 _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.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
+ temp_model = Aimastering.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map{ |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ end
208
+
209
+ end
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #AI Mastering API
3
+
4
+ #This is a AI Mastering API document. You can use the mastering feature of [AI Mastering](https://aimastering.com) through this API.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: aimasteringcom@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Aimastering
16
+
17
+ class LibraryAudioLike
18
+ # Audio analysis id
19
+ attr_accessor :id
20
+
21
+ # Audio id
22
+ attr_accessor :library_audio_id
23
+
24
+ # User id
25
+ attr_accessor :user_id
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'library_audio_id' => :'library_audio_id',
33
+ :'user_id' => :'user_id'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'id' => :'Integer',
41
+ :'library_audio_id' => :'Integer',
42
+ :'user_id' => :'Integer'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'id')
55
+ self.id = attributes[:'id']
56
+ end
57
+
58
+ if attributes.has_key?(:'library_audio_id')
59
+ self.library_audio_id = attributes[:'library_audio_id']
60
+ end
61
+
62
+ if attributes.has_key?(:'user_id')
63
+ self.user_id = attributes[:'user_id']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ return invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ return true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ id == o.id &&
87
+ library_audio_id == o.library_audio_id &&
88
+ user_id == o.user_id
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [id, library_audio_id, user_id].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
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 _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.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
+ temp_model = Aimastering.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map{ |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ end
208
+
209
+ end
@@ -0,0 +1,587 @@
1
+ =begin
2
+ #AI Mastering API
3
+
4
+ #This is a AI Mastering API document. You can use the mastering feature of [AI Mastering](https://aimastering.com) through this API.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: aimasteringcom@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Aimastering
16
+
17
+ class Mastering
18
+ attr_accessor :id
19
+
20
+ attr_accessor :user_id
21
+
22
+ attr_accessor :input_audio_id
23
+
24
+ attr_accessor :output_audio_id
25
+
26
+ attr_accessor :output_video_id
27
+
28
+ attr_accessor :reference_audio_id
29
+
30
+ attr_accessor :mode
31
+
32
+ attr_accessor :status
33
+
34
+ attr_accessor :failure_reason
35
+
36
+ attr_accessor :target_loudness
37
+
38
+ attr_accessor :output_format
39
+
40
+ attr_accessor :preset
41
+
42
+ attr_accessor :bit_depth
43
+
44
+ attr_accessor :sample_rate
45
+
46
+ attr_accessor :review_comment
47
+
48
+ attr_accessor :review_score
49
+
50
+ attr_accessor :mastering_matching_level
51
+
52
+ attr_accessor :progression
53
+
54
+ attr_accessor :bass_preservation
55
+
56
+ attr_accessor :mastering
57
+
58
+ attr_accessor :retry_count
59
+
60
+ attr_accessor :mastering_reverb
61
+
62
+ attr_accessor :mastering_reverb_gain
63
+
64
+ attr_accessor :low_cut_freq
65
+
66
+ attr_accessor :high_cut_freq
67
+
68
+ attr_accessor :expire_at
69
+
70
+ attr_accessor :created_at
71
+
72
+ attr_accessor :updated_at
73
+
74
+ class EnumAttributeValidator
75
+ attr_reader :datatype
76
+ attr_reader :allowable_values
77
+
78
+ def initialize(datatype, allowable_values)
79
+ @allowable_values = allowable_values.map do |value|
80
+ case datatype.to_s
81
+ when /Integer/i
82
+ value.to_i
83
+ when /Float/i
84
+ value.to_f
85
+ else
86
+ value
87
+ end
88
+ end
89
+ end
90
+
91
+ def valid?(value)
92
+ !value || allowable_values.include?(value)
93
+ end
94
+ end
95
+
96
+ # Attribute mapping from ruby-style variable name to JSON key.
97
+ def self.attribute_map
98
+ {
99
+ :'id' => :'id',
100
+ :'user_id' => :'user_id',
101
+ :'input_audio_id' => :'input_audio_id',
102
+ :'output_audio_id' => :'output_audio_id',
103
+ :'output_video_id' => :'output_video_id',
104
+ :'reference_audio_id' => :'reference_audio_id',
105
+ :'mode' => :'mode',
106
+ :'status' => :'status',
107
+ :'failure_reason' => :'failure_reason',
108
+ :'target_loudness' => :'target_loudness',
109
+ :'output_format' => :'output_format',
110
+ :'preset' => :'preset',
111
+ :'bit_depth' => :'bit_depth',
112
+ :'sample_rate' => :'sample_rate',
113
+ :'review_comment' => :'review_comment',
114
+ :'review_score' => :'review_score',
115
+ :'mastering_matching_level' => :'mastering_matching_level',
116
+ :'progression' => :'progression',
117
+ :'bass_preservation' => :'bass_preservation',
118
+ :'mastering' => :'mastering',
119
+ :'retry_count' => :'retry_count',
120
+ :'mastering_reverb' => :'mastering_reverb',
121
+ :'mastering_reverb_gain' => :'mastering_reverb_gain',
122
+ :'low_cut_freq' => :'low_cut_freq',
123
+ :'high_cut_freq' => :'high_cut_freq',
124
+ :'expire_at' => :'expire_at',
125
+ :'created_at' => :'created_at',
126
+ :'updated_at' => :'updated_at'
127
+ }
128
+ end
129
+
130
+ # Attribute type mapping.
131
+ def self.swagger_types
132
+ {
133
+ :'id' => :'Integer',
134
+ :'user_id' => :'Integer',
135
+ :'input_audio_id' => :'Integer',
136
+ :'output_audio_id' => :'Integer',
137
+ :'output_video_id' => :'Integer',
138
+ :'reference_audio_id' => :'Integer',
139
+ :'mode' => :'String',
140
+ :'status' => :'String',
141
+ :'failure_reason' => :'String',
142
+ :'target_loudness' => :'Float',
143
+ :'output_format' => :'String',
144
+ :'preset' => :'String',
145
+ :'bit_depth' => :'Integer',
146
+ :'sample_rate' => :'Integer',
147
+ :'review_comment' => :'String',
148
+ :'review_score' => :'Float',
149
+ :'mastering_matching_level' => :'Float',
150
+ :'progression' => :'Float',
151
+ :'bass_preservation' => :'BOOLEAN',
152
+ :'mastering' => :'BOOLEAN',
153
+ :'retry_count' => :'Integer',
154
+ :'mastering_reverb' => :'BOOLEAN',
155
+ :'mastering_reverb_gain' => :'Float',
156
+ :'low_cut_freq' => :'Float',
157
+ :'high_cut_freq' => :'Float',
158
+ :'expire_at' => :'DateTime',
159
+ :'created_at' => :'DateTime',
160
+ :'updated_at' => :'DateTime'
161
+ }
162
+ end
163
+
164
+ # Initializes the object
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ def initialize(attributes = {})
167
+ return unless attributes.is_a?(Hash)
168
+
169
+ # convert string to symbol for hash key
170
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
171
+
172
+ if attributes.has_key?(:'id')
173
+ self.id = attributes[:'id']
174
+ end
175
+
176
+ if attributes.has_key?(:'user_id')
177
+ self.user_id = attributes[:'user_id']
178
+ end
179
+
180
+ if attributes.has_key?(:'input_audio_id')
181
+ self.input_audio_id = attributes[:'input_audio_id']
182
+ end
183
+
184
+ if attributes.has_key?(:'output_audio_id')
185
+ self.output_audio_id = attributes[:'output_audio_id']
186
+ end
187
+
188
+ if attributes.has_key?(:'output_video_id')
189
+ self.output_video_id = attributes[:'output_video_id']
190
+ end
191
+
192
+ if attributes.has_key?(:'reference_audio_id')
193
+ self.reference_audio_id = attributes[:'reference_audio_id']
194
+ end
195
+
196
+ if attributes.has_key?(:'mode')
197
+ self.mode = attributes[:'mode']
198
+ end
199
+
200
+ if attributes.has_key?(:'status')
201
+ self.status = attributes[:'status']
202
+ end
203
+
204
+ if attributes.has_key?(:'failure_reason')
205
+ self.failure_reason = attributes[:'failure_reason']
206
+ end
207
+
208
+ if attributes.has_key?(:'target_loudness')
209
+ self.target_loudness = attributes[:'target_loudness']
210
+ end
211
+
212
+ if attributes.has_key?(:'output_format')
213
+ self.output_format = attributes[:'output_format']
214
+ end
215
+
216
+ if attributes.has_key?(:'preset')
217
+ self.preset = attributes[:'preset']
218
+ end
219
+
220
+ if attributes.has_key?(:'bit_depth')
221
+ self.bit_depth = attributes[:'bit_depth']
222
+ end
223
+
224
+ if attributes.has_key?(:'sample_rate')
225
+ self.sample_rate = attributes[:'sample_rate']
226
+ end
227
+
228
+ if attributes.has_key?(:'review_comment')
229
+ self.review_comment = attributes[:'review_comment']
230
+ end
231
+
232
+ if attributes.has_key?(:'review_score')
233
+ self.review_score = attributes[:'review_score']
234
+ end
235
+
236
+ if attributes.has_key?(:'mastering_matching_level')
237
+ self.mastering_matching_level = attributes[:'mastering_matching_level']
238
+ end
239
+
240
+ if attributes.has_key?(:'progression')
241
+ self.progression = attributes[:'progression']
242
+ end
243
+
244
+ if attributes.has_key?(:'bass_preservation')
245
+ self.bass_preservation = attributes[:'bass_preservation']
246
+ end
247
+
248
+ if attributes.has_key?(:'mastering')
249
+ self.mastering = attributes[:'mastering']
250
+ end
251
+
252
+ if attributes.has_key?(:'retry_count')
253
+ self.retry_count = attributes[:'retry_count']
254
+ end
255
+
256
+ if attributes.has_key?(:'mastering_reverb')
257
+ self.mastering_reverb = attributes[:'mastering_reverb']
258
+ end
259
+
260
+ if attributes.has_key?(:'mastering_reverb_gain')
261
+ self.mastering_reverb_gain = attributes[:'mastering_reverb_gain']
262
+ end
263
+
264
+ if attributes.has_key?(:'low_cut_freq')
265
+ self.low_cut_freq = attributes[:'low_cut_freq']
266
+ end
267
+
268
+ if attributes.has_key?(:'high_cut_freq')
269
+ self.high_cut_freq = attributes[:'high_cut_freq']
270
+ end
271
+
272
+ if attributes.has_key?(:'expire_at')
273
+ self.expire_at = attributes[:'expire_at']
274
+ end
275
+
276
+ if attributes.has_key?(:'created_at')
277
+ self.created_at = attributes[:'created_at']
278
+ end
279
+
280
+ if attributes.has_key?(:'updated_at')
281
+ self.updated_at = attributes[:'updated_at']
282
+ end
283
+
284
+ end
285
+
286
+ # Show invalid properties with the reasons. Usually used together with valid?
287
+ # @return Array for valid properties with the reasons
288
+ def list_invalid_properties
289
+ invalid_properties = Array.new
290
+ if !@review_score.nil? && @review_score > 1
291
+ invalid_properties.push("invalid value for 'review_score', must be smaller than or equal to 1.")
292
+ end
293
+
294
+ if !@review_score.nil? && @review_score < 0
295
+ invalid_properties.push("invalid value for 'review_score', must be greater than or equal to 0.")
296
+ end
297
+
298
+ if !@mastering_matching_level.nil? && @mastering_matching_level > 1
299
+ invalid_properties.push("invalid value for 'mastering_matching_level', must be smaller than or equal to 1.")
300
+ end
301
+
302
+ if !@mastering_matching_level.nil? && @mastering_matching_level < 0
303
+ invalid_properties.push("invalid value for 'mastering_matching_level', must be greater than or equal to 0.")
304
+ end
305
+
306
+ if !@progression.nil? && @progression > 1
307
+ invalid_properties.push("invalid value for 'progression', must be smaller than or equal to 1.")
308
+ end
309
+
310
+ if !@progression.nil? && @progression < 0
311
+ invalid_properties.push("invalid value for 'progression', must be greater than or equal to 0.")
312
+ end
313
+
314
+ return invalid_properties
315
+ end
316
+
317
+ # Check to see if the all the properties in the model are valid
318
+ # @return true if the model is valid
319
+ def valid?
320
+ mode_validator = EnumAttributeValidator.new('String', ["default", "custom", "preset"])
321
+ return false unless mode_validator.valid?(@mode)
322
+ status_validator = EnumAttributeValidator.new('String', ["waiting", "processing", "canceled", "failed", "succeeded"])
323
+ return false unless status_validator.valid?(@status)
324
+ failure_reason_validator = EnumAttributeValidator.new('String', ["unknown", "expired", "failed_to_prepare", "job_queue"])
325
+ return false unless failure_reason_validator.valid?(@failure_reason)
326
+ output_format_validator = EnumAttributeValidator.new('String', ["wav", "mp3"])
327
+ return false unless output_format_validator.valid?(@output_format)
328
+ preset_validator = EnumAttributeValidator.new('String', ["general", "pop", "jazz", "classical"])
329
+ return false unless preset_validator.valid?(@preset)
330
+ return false if !@review_score.nil? && @review_score > 1
331
+ return false if !@review_score.nil? && @review_score < 0
332
+ return false if !@mastering_matching_level.nil? && @mastering_matching_level > 1
333
+ return false if !@mastering_matching_level.nil? && @mastering_matching_level < 0
334
+ return false if !@progression.nil? && @progression > 1
335
+ return false if !@progression.nil? && @progression < 0
336
+ return true
337
+ end
338
+
339
+ # Custom attribute writer method checking allowed values (enum).
340
+ # @param [Object] mode Object to be assigned
341
+ def mode=(mode)
342
+ validator = EnumAttributeValidator.new('String', ["default", "custom", "preset"])
343
+ unless validator.valid?(mode)
344
+ fail ArgumentError, "invalid value for 'mode', must be one of #{validator.allowable_values}."
345
+ end
346
+ @mode = mode
347
+ end
348
+
349
+ # Custom attribute writer method checking allowed values (enum).
350
+ # @param [Object] status Object to be assigned
351
+ def status=(status)
352
+ validator = EnumAttributeValidator.new('String', ["waiting", "processing", "canceled", "failed", "succeeded"])
353
+ unless validator.valid?(status)
354
+ fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
355
+ end
356
+ @status = status
357
+ end
358
+
359
+ # Custom attribute writer method checking allowed values (enum).
360
+ # @param [Object] failure_reason Object to be assigned
361
+ def failure_reason=(failure_reason)
362
+ validator = EnumAttributeValidator.new('String', ["unknown", "expired", "failed_to_prepare", "job_queue"])
363
+ unless validator.valid?(failure_reason)
364
+ fail ArgumentError, "invalid value for 'failure_reason', must be one of #{validator.allowable_values}."
365
+ end
366
+ @failure_reason = failure_reason
367
+ end
368
+
369
+ # Custom attribute writer method checking allowed values (enum).
370
+ # @param [Object] output_format Object to be assigned
371
+ def output_format=(output_format)
372
+ validator = EnumAttributeValidator.new('String', ["wav", "mp3"])
373
+ unless validator.valid?(output_format)
374
+ fail ArgumentError, "invalid value for 'output_format', must be one of #{validator.allowable_values}."
375
+ end
376
+ @output_format = output_format
377
+ end
378
+
379
+ # Custom attribute writer method checking allowed values (enum).
380
+ # @param [Object] preset Object to be assigned
381
+ def preset=(preset)
382
+ validator = EnumAttributeValidator.new('String', ["general", "pop", "jazz", "classical"])
383
+ unless validator.valid?(preset)
384
+ fail ArgumentError, "invalid value for 'preset', must be one of #{validator.allowable_values}."
385
+ end
386
+ @preset = preset
387
+ end
388
+
389
+ # Custom attribute writer method with validation
390
+ # @param [Object] review_score Value to be assigned
391
+ def review_score=(review_score)
392
+
393
+ if !review_score.nil? && review_score > 1
394
+ fail ArgumentError, "invalid value for 'review_score', must be smaller than or equal to 1."
395
+ end
396
+
397
+ if !review_score.nil? && review_score < 0
398
+ fail ArgumentError, "invalid value for 'review_score', must be greater than or equal to 0."
399
+ end
400
+
401
+ @review_score = review_score
402
+ end
403
+
404
+ # Custom attribute writer method with validation
405
+ # @param [Object] mastering_matching_level Value to be assigned
406
+ def mastering_matching_level=(mastering_matching_level)
407
+
408
+ if !mastering_matching_level.nil? && mastering_matching_level > 1
409
+ fail ArgumentError, "invalid value for 'mastering_matching_level', must be smaller than or equal to 1."
410
+ end
411
+
412
+ if !mastering_matching_level.nil? && mastering_matching_level < 0
413
+ fail ArgumentError, "invalid value for 'mastering_matching_level', must be greater than or equal to 0."
414
+ end
415
+
416
+ @mastering_matching_level = mastering_matching_level
417
+ end
418
+
419
+ # Custom attribute writer method with validation
420
+ # @param [Object] progression Value to be assigned
421
+ def progression=(progression)
422
+
423
+ if !progression.nil? && progression > 1
424
+ fail ArgumentError, "invalid value for 'progression', must be smaller than or equal to 1."
425
+ end
426
+
427
+ if !progression.nil? && progression < 0
428
+ fail ArgumentError, "invalid value for 'progression', must be greater than or equal to 0."
429
+ end
430
+
431
+ @progression = progression
432
+ end
433
+
434
+ # Checks equality by comparing each attribute.
435
+ # @param [Object] Object to be compared
436
+ def ==(o)
437
+ return true if self.equal?(o)
438
+ self.class == o.class &&
439
+ id == o.id &&
440
+ user_id == o.user_id &&
441
+ input_audio_id == o.input_audio_id &&
442
+ output_audio_id == o.output_audio_id &&
443
+ output_video_id == o.output_video_id &&
444
+ reference_audio_id == o.reference_audio_id &&
445
+ mode == o.mode &&
446
+ status == o.status &&
447
+ failure_reason == o.failure_reason &&
448
+ target_loudness == o.target_loudness &&
449
+ output_format == o.output_format &&
450
+ preset == o.preset &&
451
+ bit_depth == o.bit_depth &&
452
+ sample_rate == o.sample_rate &&
453
+ review_comment == o.review_comment &&
454
+ review_score == o.review_score &&
455
+ mastering_matching_level == o.mastering_matching_level &&
456
+ progression == o.progression &&
457
+ bass_preservation == o.bass_preservation &&
458
+ mastering == o.mastering &&
459
+ retry_count == o.retry_count &&
460
+ mastering_reverb == o.mastering_reverb &&
461
+ mastering_reverb_gain == o.mastering_reverb_gain &&
462
+ low_cut_freq == o.low_cut_freq &&
463
+ high_cut_freq == o.high_cut_freq &&
464
+ expire_at == o.expire_at &&
465
+ created_at == o.created_at &&
466
+ updated_at == o.updated_at
467
+ end
468
+
469
+ # @see the `==` method
470
+ # @param [Object] Object to be compared
471
+ def eql?(o)
472
+ self == o
473
+ end
474
+
475
+ # Calculates hash code according to all attributes.
476
+ # @return [Fixnum] Hash code
477
+ def hash
478
+ [id, user_id, input_audio_id, output_audio_id, output_video_id, reference_audio_id, mode, status, failure_reason, target_loudness, output_format, preset, bit_depth, sample_rate, review_comment, review_score, mastering_matching_level, progression, bass_preservation, mastering, retry_count, mastering_reverb, mastering_reverb_gain, low_cut_freq, high_cut_freq, expire_at, created_at, updated_at].hash
479
+ end
480
+
481
+ # Builds the object from hash
482
+ # @param [Hash] attributes Model attributes in the form of hash
483
+ # @return [Object] Returns the model itself
484
+ def build_from_hash(attributes)
485
+ return nil unless attributes.is_a?(Hash)
486
+ self.class.swagger_types.each_pair do |key, type|
487
+ if type =~ /\AArray<(.*)>/i
488
+ # check to ensure the input is an array given that the the attribute
489
+ # is documented as an array but the input is not
490
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
491
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
492
+ end
493
+ elsif !attributes[self.class.attribute_map[key]].nil?
494
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
495
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
496
+ end
497
+
498
+ self
499
+ end
500
+
501
+ # Deserializes the data based on type
502
+ # @param string type Data type
503
+ # @param string value Value to be deserialized
504
+ # @return [Object] Deserialized data
505
+ def _deserialize(type, value)
506
+ case type.to_sym
507
+ when :DateTime
508
+ DateTime.parse(value)
509
+ when :Date
510
+ Date.parse(value)
511
+ when :String
512
+ value.to_s
513
+ when :Integer
514
+ value.to_i
515
+ when :Float
516
+ value.to_f
517
+ when :BOOLEAN
518
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
519
+ true
520
+ else
521
+ false
522
+ end
523
+ when :Object
524
+ # generic object (usually a Hash), return directly
525
+ value
526
+ when /\AArray<(?<inner_type>.+)>\z/
527
+ inner_type = Regexp.last_match[:inner_type]
528
+ value.map { |v| _deserialize(inner_type, v) }
529
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
530
+ k_type = Regexp.last_match[:k_type]
531
+ v_type = Regexp.last_match[:v_type]
532
+ {}.tap do |hash|
533
+ value.each do |k, v|
534
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
535
+ end
536
+ end
537
+ else # model
538
+ temp_model = Aimastering.const_get(type).new
539
+ temp_model.build_from_hash(value)
540
+ end
541
+ end
542
+
543
+ # Returns the string representation of the object
544
+ # @return [String] String presentation of the object
545
+ def to_s
546
+ to_hash.to_s
547
+ end
548
+
549
+ # to_body is an alias to to_hash (backward compatibility)
550
+ # @return [Hash] Returns the object in the form of hash
551
+ def to_body
552
+ to_hash
553
+ end
554
+
555
+ # Returns the object in the form of hash
556
+ # @return [Hash] Returns the object in the form of hash
557
+ def to_hash
558
+ hash = {}
559
+ self.class.attribute_map.each_pair do |attr, param|
560
+ value = self.send(attr)
561
+ next if value.nil?
562
+ hash[param] = _to_hash(value)
563
+ end
564
+ hash
565
+ end
566
+
567
+ # Outputs non-array value in the form of hash
568
+ # For object, use to_hash. Otherwise, just return the value
569
+ # @param [Object] value Any valid value
570
+ # @return [Hash] Returns the value in the form of hash
571
+ def _to_hash(value)
572
+ if value.is_a?(Array)
573
+ value.compact.map{ |v| _to_hash(v) }
574
+ elsif value.is_a?(Hash)
575
+ {}.tap do |hash|
576
+ value.each { |k, v| hash[k] = _to_hash(v) }
577
+ end
578
+ elsif value.respond_to? :to_hash
579
+ value.to_hash
580
+ else
581
+ value
582
+ end
583
+ end
584
+
585
+ end
586
+
587
+ end