aimastering 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,188 @@
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 AccessToken
18
+ attr_accessor :access_token
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'access_token' => :'access_token'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'access_token' => :'JWT'
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?(:'access_token')
44
+ self.access_token = attributes[:'access_token']
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
+ access_token == o.access_token
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
+ [access_token].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 = Aimastering.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
@@ -0,0 +1,520 @@
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 AnonymizedMastering
18
+ attr_accessor :user_id
19
+
20
+ attr_accessor :user_auth_provider
21
+
22
+ attr_accessor :mode
23
+
24
+ attr_accessor :status
25
+
26
+ attr_accessor :failure_reason
27
+
28
+ attr_accessor :target_loudness
29
+
30
+ attr_accessor :output_format
31
+
32
+ attr_accessor :preset
33
+
34
+ attr_accessor :bit_depth
35
+
36
+ attr_accessor :sample_rate
37
+
38
+ attr_accessor :review_score
39
+
40
+ attr_accessor :mastering_matching_level
41
+
42
+ attr_accessor :mastering
43
+
44
+ attr_accessor :paid
45
+
46
+ attr_accessor :payment_service
47
+
48
+ attr_accessor :retry_count
49
+
50
+ attr_accessor :mastering_reverb
51
+
52
+ attr_accessor :mastering_reverb_gain
53
+
54
+ attr_accessor :low_cut_freq
55
+
56
+ attr_accessor :high_cut_freq
57
+
58
+ attr_accessor :created_at
59
+
60
+ attr_accessor :updated_at
61
+
62
+ class EnumAttributeValidator
63
+ attr_reader :datatype
64
+ attr_reader :allowable_values
65
+
66
+ def initialize(datatype, allowable_values)
67
+ @allowable_values = allowable_values.map do |value|
68
+ case datatype.to_s
69
+ when /Integer/i
70
+ value.to_i
71
+ when /Float/i
72
+ value.to_f
73
+ else
74
+ value
75
+ end
76
+ end
77
+ end
78
+
79
+ def valid?(value)
80
+ !value || allowable_values.include?(value)
81
+ end
82
+ end
83
+
84
+ # Attribute mapping from ruby-style variable name to JSON key.
85
+ def self.attribute_map
86
+ {
87
+ :'user_id' => :'user_id',
88
+ :'user_auth_provider' => :'user_auth_provider',
89
+ :'mode' => :'mode',
90
+ :'status' => :'status',
91
+ :'failure_reason' => :'failure_reason',
92
+ :'target_loudness' => :'target_loudness',
93
+ :'output_format' => :'output_format',
94
+ :'preset' => :'preset',
95
+ :'bit_depth' => :'bit_depth',
96
+ :'sample_rate' => :'sample_rate',
97
+ :'review_score' => :'review_score',
98
+ :'mastering_matching_level' => :'mastering_matching_level',
99
+ :'mastering' => :'mastering',
100
+ :'paid' => :'paid',
101
+ :'payment_service' => :'payment_service',
102
+ :'retry_count' => :'retry_count',
103
+ :'mastering_reverb' => :'mastering_reverb',
104
+ :'mastering_reverb_gain' => :'mastering_reverb_gain',
105
+ :'low_cut_freq' => :'low_cut_freq',
106
+ :'high_cut_freq' => :'high_cut_freq',
107
+ :'created_at' => :'created_at',
108
+ :'updated_at' => :'updated_at'
109
+ }
110
+ end
111
+
112
+ # Attribute type mapping.
113
+ def self.swagger_types
114
+ {
115
+ :'user_id' => :'String',
116
+ :'user_auth_provider' => :'String',
117
+ :'mode' => :'String',
118
+ :'status' => :'String',
119
+ :'failure_reason' => :'String',
120
+ :'target_loudness' => :'Float',
121
+ :'output_format' => :'String',
122
+ :'preset' => :'String',
123
+ :'bit_depth' => :'Integer',
124
+ :'sample_rate' => :'Integer',
125
+ :'review_score' => :'Float',
126
+ :'mastering_matching_level' => :'Float',
127
+ :'mastering' => :'BOOLEAN',
128
+ :'paid' => :'BOOLEAN',
129
+ :'payment_service' => :'String',
130
+ :'retry_count' => :'Integer',
131
+ :'mastering_reverb' => :'BOOLEAN',
132
+ :'mastering_reverb_gain' => :'Float',
133
+ :'low_cut_freq' => :'Float',
134
+ :'high_cut_freq' => :'Float',
135
+ :'created_at' => :'DateTime',
136
+ :'updated_at' => :'DateTime'
137
+ }
138
+ end
139
+
140
+ # Initializes the object
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ def initialize(attributes = {})
143
+ return unless attributes.is_a?(Hash)
144
+
145
+ # convert string to symbol for hash key
146
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
147
+
148
+ if attributes.has_key?(:'user_id')
149
+ self.user_id = attributes[:'user_id']
150
+ end
151
+
152
+ if attributes.has_key?(:'user_auth_provider')
153
+ self.user_auth_provider = attributes[:'user_auth_provider']
154
+ end
155
+
156
+ if attributes.has_key?(:'mode')
157
+ self.mode = attributes[:'mode']
158
+ end
159
+
160
+ if attributes.has_key?(:'status')
161
+ self.status = attributes[:'status']
162
+ end
163
+
164
+ if attributes.has_key?(:'failure_reason')
165
+ self.failure_reason = attributes[:'failure_reason']
166
+ end
167
+
168
+ if attributes.has_key?(:'target_loudness')
169
+ self.target_loudness = attributes[:'target_loudness']
170
+ end
171
+
172
+ if attributes.has_key?(:'output_format')
173
+ self.output_format = attributes[:'output_format']
174
+ end
175
+
176
+ if attributes.has_key?(:'preset')
177
+ self.preset = attributes[:'preset']
178
+ end
179
+
180
+ if attributes.has_key?(:'bit_depth')
181
+ self.bit_depth = attributes[:'bit_depth']
182
+ end
183
+
184
+ if attributes.has_key?(:'sample_rate')
185
+ self.sample_rate = attributes[:'sample_rate']
186
+ end
187
+
188
+ if attributes.has_key?(:'review_score')
189
+ self.review_score = attributes[:'review_score']
190
+ end
191
+
192
+ if attributes.has_key?(:'mastering_matching_level')
193
+ self.mastering_matching_level = attributes[:'mastering_matching_level']
194
+ end
195
+
196
+ if attributes.has_key?(:'mastering')
197
+ self.mastering = attributes[:'mastering']
198
+ end
199
+
200
+ if attributes.has_key?(:'paid')
201
+ self.paid = attributes[:'paid']
202
+ end
203
+
204
+ if attributes.has_key?(:'payment_service')
205
+ self.payment_service = attributes[:'payment_service']
206
+ end
207
+
208
+ if attributes.has_key?(:'retry_count')
209
+ self.retry_count = attributes[:'retry_count']
210
+ end
211
+
212
+ if attributes.has_key?(:'mastering_reverb')
213
+ self.mastering_reverb = attributes[:'mastering_reverb']
214
+ end
215
+
216
+ if attributes.has_key?(:'mastering_reverb_gain')
217
+ self.mastering_reverb_gain = attributes[:'mastering_reverb_gain']
218
+ end
219
+
220
+ if attributes.has_key?(:'low_cut_freq')
221
+ self.low_cut_freq = attributes[:'low_cut_freq']
222
+ end
223
+
224
+ if attributes.has_key?(:'high_cut_freq')
225
+ self.high_cut_freq = attributes[:'high_cut_freq']
226
+ end
227
+
228
+ if attributes.has_key?(:'created_at')
229
+ self.created_at = attributes[:'created_at']
230
+ end
231
+
232
+ if attributes.has_key?(:'updated_at')
233
+ self.updated_at = attributes[:'updated_at']
234
+ end
235
+
236
+ end
237
+
238
+ # Show invalid properties with the reasons. Usually used together with valid?
239
+ # @return Array for valid properties with the reasons
240
+ def list_invalid_properties
241
+ invalid_properties = Array.new
242
+ if !@review_score.nil? && @review_score > 1
243
+ invalid_properties.push("invalid value for 'review_score', must be smaller than or equal to 1.")
244
+ end
245
+
246
+ if !@review_score.nil? && @review_score < 0
247
+ invalid_properties.push("invalid value for 'review_score', must be greater than or equal to 0.")
248
+ end
249
+
250
+ if !@mastering_matching_level.nil? && @mastering_matching_level > 1
251
+ invalid_properties.push("invalid value for 'mastering_matching_level', must be smaller than or equal to 1.")
252
+ end
253
+
254
+ if !@mastering_matching_level.nil? && @mastering_matching_level < 0
255
+ invalid_properties.push("invalid value for 'mastering_matching_level', must be greater than or equal to 0.")
256
+ end
257
+
258
+ return invalid_properties
259
+ end
260
+
261
+ # Check to see if the all the properties in the model are valid
262
+ # @return true if the model is valid
263
+ def valid?
264
+ mode_validator = EnumAttributeValidator.new('String', ["default", "custom", "preset"])
265
+ return false unless mode_validator.valid?(@mode)
266
+ status_validator = EnumAttributeValidator.new('String', ["waiting", "processing", "canceled", "failed", "succeeded"])
267
+ return false unless status_validator.valid?(@status)
268
+ failure_reason_validator = EnumAttributeValidator.new('String', ["unknown", "expired", "failed_to_prepare", "job_queue"])
269
+ return false unless failure_reason_validator.valid?(@failure_reason)
270
+ output_format_validator = EnumAttributeValidator.new('String', ["wav", "mp3"])
271
+ return false unless output_format_validator.valid?(@output_format)
272
+ preset_validator = EnumAttributeValidator.new('String', ["general", "pop", "jazz", "classical"])
273
+ return false unless preset_validator.valid?(@preset)
274
+ return false if !@review_score.nil? && @review_score > 1
275
+ return false if !@review_score.nil? && @review_score < 0
276
+ return false if !@mastering_matching_level.nil? && @mastering_matching_level > 1
277
+ return false if !@mastering_matching_level.nil? && @mastering_matching_level < 0
278
+ payment_service_validator = EnumAttributeValidator.new('String', ["paypal", "stripe"])
279
+ return false unless payment_service_validator.valid?(@payment_service)
280
+ return true
281
+ end
282
+
283
+ # Custom attribute writer method checking allowed values (enum).
284
+ # @param [Object] mode Object to be assigned
285
+ def mode=(mode)
286
+ validator = EnumAttributeValidator.new('String', ["default", "custom", "preset"])
287
+ unless validator.valid?(mode)
288
+ fail ArgumentError, "invalid value for 'mode', must be one of #{validator.allowable_values}."
289
+ end
290
+ @mode = mode
291
+ end
292
+
293
+ # Custom attribute writer method checking allowed values (enum).
294
+ # @param [Object] status Object to be assigned
295
+ def status=(status)
296
+ validator = EnumAttributeValidator.new('String', ["waiting", "processing", "canceled", "failed", "succeeded"])
297
+ unless validator.valid?(status)
298
+ fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
299
+ end
300
+ @status = status
301
+ end
302
+
303
+ # Custom attribute writer method checking allowed values (enum).
304
+ # @param [Object] failure_reason Object to be assigned
305
+ def failure_reason=(failure_reason)
306
+ validator = EnumAttributeValidator.new('String', ["unknown", "expired", "failed_to_prepare", "job_queue"])
307
+ unless validator.valid?(failure_reason)
308
+ fail ArgumentError, "invalid value for 'failure_reason', must be one of #{validator.allowable_values}."
309
+ end
310
+ @failure_reason = failure_reason
311
+ end
312
+
313
+ # Custom attribute writer method checking allowed values (enum).
314
+ # @param [Object] output_format Object to be assigned
315
+ def output_format=(output_format)
316
+ validator = EnumAttributeValidator.new('String', ["wav", "mp3"])
317
+ unless validator.valid?(output_format)
318
+ fail ArgumentError, "invalid value for 'output_format', must be one of #{validator.allowable_values}."
319
+ end
320
+ @output_format = output_format
321
+ end
322
+
323
+ # Custom attribute writer method checking allowed values (enum).
324
+ # @param [Object] preset Object to be assigned
325
+ def preset=(preset)
326
+ validator = EnumAttributeValidator.new('String', ["general", "pop", "jazz", "classical"])
327
+ unless validator.valid?(preset)
328
+ fail ArgumentError, "invalid value for 'preset', must be one of #{validator.allowable_values}."
329
+ end
330
+ @preset = preset
331
+ end
332
+
333
+ # Custom attribute writer method with validation
334
+ # @param [Object] review_score Value to be assigned
335
+ def review_score=(review_score)
336
+
337
+ if !review_score.nil? && review_score > 1
338
+ fail ArgumentError, "invalid value for 'review_score', must be smaller than or equal to 1."
339
+ end
340
+
341
+ if !review_score.nil? && review_score < 0
342
+ fail ArgumentError, "invalid value for 'review_score', must be greater than or equal to 0."
343
+ end
344
+
345
+ @review_score = review_score
346
+ end
347
+
348
+ # Custom attribute writer method with validation
349
+ # @param [Object] mastering_matching_level Value to be assigned
350
+ def mastering_matching_level=(mastering_matching_level)
351
+
352
+ if !mastering_matching_level.nil? && mastering_matching_level > 1
353
+ fail ArgumentError, "invalid value for 'mastering_matching_level', must be smaller than or equal to 1."
354
+ end
355
+
356
+ if !mastering_matching_level.nil? && mastering_matching_level < 0
357
+ fail ArgumentError, "invalid value for 'mastering_matching_level', must be greater than or equal to 0."
358
+ end
359
+
360
+ @mastering_matching_level = mastering_matching_level
361
+ end
362
+
363
+ # Custom attribute writer method checking allowed values (enum).
364
+ # @param [Object] payment_service Object to be assigned
365
+ def payment_service=(payment_service)
366
+ validator = EnumAttributeValidator.new('String', ["paypal", "stripe"])
367
+ unless validator.valid?(payment_service)
368
+ fail ArgumentError, "invalid value for 'payment_service', must be one of #{validator.allowable_values}."
369
+ end
370
+ @payment_service = payment_service
371
+ end
372
+
373
+ # Checks equality by comparing each attribute.
374
+ # @param [Object] Object to be compared
375
+ def ==(o)
376
+ return true if self.equal?(o)
377
+ self.class == o.class &&
378
+ user_id == o.user_id &&
379
+ user_auth_provider == o.user_auth_provider &&
380
+ mode == o.mode &&
381
+ status == o.status &&
382
+ failure_reason == o.failure_reason &&
383
+ target_loudness == o.target_loudness &&
384
+ output_format == o.output_format &&
385
+ preset == o.preset &&
386
+ bit_depth == o.bit_depth &&
387
+ sample_rate == o.sample_rate &&
388
+ review_score == o.review_score &&
389
+ mastering_matching_level == o.mastering_matching_level &&
390
+ mastering == o.mastering &&
391
+ paid == o.paid &&
392
+ payment_service == o.payment_service &&
393
+ retry_count == o.retry_count &&
394
+ mastering_reverb == o.mastering_reverb &&
395
+ mastering_reverb_gain == o.mastering_reverb_gain &&
396
+ low_cut_freq == o.low_cut_freq &&
397
+ high_cut_freq == o.high_cut_freq &&
398
+ created_at == o.created_at &&
399
+ updated_at == o.updated_at
400
+ end
401
+
402
+ # @see the `==` method
403
+ # @param [Object] Object to be compared
404
+ def eql?(o)
405
+ self == o
406
+ end
407
+
408
+ # Calculates hash code according to all attributes.
409
+ # @return [Fixnum] Hash code
410
+ def hash
411
+ [user_id, user_auth_provider, mode, status, failure_reason, target_loudness, output_format, preset, bit_depth, sample_rate, review_score, mastering_matching_level, mastering, paid, payment_service, retry_count, mastering_reverb, mastering_reverb_gain, low_cut_freq, high_cut_freq, created_at, updated_at].hash
412
+ end
413
+
414
+ # Builds the object from hash
415
+ # @param [Hash] attributes Model attributes in the form of hash
416
+ # @return [Object] Returns the model itself
417
+ def build_from_hash(attributes)
418
+ return nil unless attributes.is_a?(Hash)
419
+ self.class.swagger_types.each_pair do |key, type|
420
+ if type =~ /\AArray<(.*)>/i
421
+ # check to ensure the input is an array given that the the attribute
422
+ # is documented as an array but the input is not
423
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
424
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
425
+ end
426
+ elsif !attributes[self.class.attribute_map[key]].nil?
427
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
428
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
429
+ end
430
+
431
+ self
432
+ end
433
+
434
+ # Deserializes the data based on type
435
+ # @param string type Data type
436
+ # @param string value Value to be deserialized
437
+ # @return [Object] Deserialized data
438
+ def _deserialize(type, value)
439
+ case type.to_sym
440
+ when :DateTime
441
+ DateTime.parse(value)
442
+ when :Date
443
+ Date.parse(value)
444
+ when :String
445
+ value.to_s
446
+ when :Integer
447
+ value.to_i
448
+ when :Float
449
+ value.to_f
450
+ when :BOOLEAN
451
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
452
+ true
453
+ else
454
+ false
455
+ end
456
+ when :Object
457
+ # generic object (usually a Hash), return directly
458
+ value
459
+ when /\AArray<(?<inner_type>.+)>\z/
460
+ inner_type = Regexp.last_match[:inner_type]
461
+ value.map { |v| _deserialize(inner_type, v) }
462
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
463
+ k_type = Regexp.last_match[:k_type]
464
+ v_type = Regexp.last_match[:v_type]
465
+ {}.tap do |hash|
466
+ value.each do |k, v|
467
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
468
+ end
469
+ end
470
+ else # model
471
+ temp_model = Aimastering.const_get(type).new
472
+ temp_model.build_from_hash(value)
473
+ end
474
+ end
475
+
476
+ # Returns the string representation of the object
477
+ # @return [String] String presentation of the object
478
+ def to_s
479
+ to_hash.to_s
480
+ end
481
+
482
+ # to_body is an alias to to_hash (backward compatibility)
483
+ # @return [Hash] Returns the object in the form of hash
484
+ def to_body
485
+ to_hash
486
+ end
487
+
488
+ # Returns the object in the form of hash
489
+ # @return [Hash] Returns the object in the form of hash
490
+ def to_hash
491
+ hash = {}
492
+ self.class.attribute_map.each_pair do |attr, param|
493
+ value = self.send(attr)
494
+ next if value.nil?
495
+ hash[param] = _to_hash(value)
496
+ end
497
+ hash
498
+ end
499
+
500
+ # Outputs non-array value in the form of hash
501
+ # For object, use to_hash. Otherwise, just return the value
502
+ # @param [Object] value Any valid value
503
+ # @return [Hash] Returns the value in the form of hash
504
+ def _to_hash(value)
505
+ if value.is_a?(Array)
506
+ value.compact.map{ |v| _to_hash(v) }
507
+ elsif value.is_a?(Hash)
508
+ {}.tap do |hash|
509
+ value.each { |k, v| hash[k] = _to_hash(v) }
510
+ end
511
+ elsif value.respond_to? :to_hash
512
+ value.to_hash
513
+ else
514
+ value
515
+ end
516
+ end
517
+
518
+ end
519
+
520
+ end