aimastering 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +167 -0
- data/Rakefile +8 -0
- data/aimastering.gemspec +45 -0
- data/docs/AccessToken.md +8 -0
- data/docs/AccessTokenApi.md +55 -0
- data/docs/AnonymizedMastering.md +29 -0
- data/docs/Audio.md +29 -0
- data/docs/AudioAnalysis.md +10 -0
- data/docs/AudioApi.md +374 -0
- data/docs/AudioDownloadToken.md +9 -0
- data/docs/Config.md +10 -0
- data/docs/ConfigApi.md +55 -0
- data/docs/ConfigAuth0.md +10 -0
- data/docs/ConfigPaypal.md +9 -0
- data/docs/ConfigStripe.md +8 -0
- data/docs/DateTime.md +7 -0
- data/docs/ExternalSearchApi.md +64 -0
- data/docs/ExternalSearchResult.md +9 -0
- data/docs/ExternalSearchResultItunes.md +18 -0
- data/docs/ExternalSearchResultYoutube.md +15 -0
- data/docs/JWT.md +7 -0
- data/docs/Kpi.md +7 -0
- data/docs/LibraryAudio.md +38 -0
- data/docs/LibraryAudioAnalysis.md +10 -0
- data/docs/LibraryAudioApi.md +378 -0
- data/docs/LibraryAudioLike.md +10 -0
- data/docs/Mastering.md +35 -0
- data/docs/MasteringApi.md +482 -0
- data/docs/Payment.md +14 -0
- data/docs/PaymentApi.md +224 -0
- data/docs/PaymentCustomer.md +11 -0
- data/docs/PaymentCustomerApi.md +55 -0
- data/docs/Plan.md +12 -0
- data/docs/PlanApi.md +55 -0
- data/docs/StatisticsApi.md +102 -0
- data/docs/Subscription.md +17 -0
- data/docs/SubscriptionApi.md +273 -0
- data/docs/User.md +14 -0
- data/docs/UserApi.md +111 -0
- data/docs/Video.md +13 -0
- data/docs/VideoApi.md +267 -0
- data/docs/VideoDownloadToken.md +9 -0
- data/git_push.sh +55 -0
- data/lib/aimastering.rb +77 -0
- data/lib/aimastering/api/access_token_api.rb +70 -0
- data/lib/aimastering/api/audio_api.rb +404 -0
- data/lib/aimastering/api/config_api.rb +70 -0
- data/lib/aimastering/api/external_search_api.rb +84 -0
- data/lib/aimastering/api/library_audio_api.rb +416 -0
- data/lib/aimastering/api/mastering_api.rb +596 -0
- data/lib/aimastering/api/payment_api.rb +263 -0
- data/lib/aimastering/api/payment_customer_api.rb +70 -0
- data/lib/aimastering/api/plan_api.rb +70 -0
- data/lib/aimastering/api/statistics_api.rb +117 -0
- data/lib/aimastering/api/subscription_api.rb +311 -0
- data/lib/aimastering/api/user_api.rb +125 -0
- data/lib/aimastering/api/video_api.rb +295 -0
- data/lib/aimastering/api_client.rb +389 -0
- data/lib/aimastering/api_error.rb +38 -0
- data/lib/aimastering/configuration.rb +209 -0
- data/lib/aimastering/models/access_token.rb +188 -0
- data/lib/aimastering/models/anonymized_mastering.rb +520 -0
- data/lib/aimastering/models/audio.rb +377 -0
- data/lib/aimastering/models/audio_analysis.rb +209 -0
- data/lib/aimastering/models/audio_download_token.rb +197 -0
- data/lib/aimastering/models/config.rb +206 -0
- data/lib/aimastering/models/config_auth0.rb +206 -0
- data/lib/aimastering/models/config_paypal.rb +197 -0
- data/lib/aimastering/models/config_stripe.rb +188 -0
- data/lib/aimastering/models/date_time.rb +179 -0
- data/lib/aimastering/models/external_search_result.rb +201 -0
- data/lib/aimastering/models/external_search_result_itunes.rb +278 -0
- data/lib/aimastering/models/external_search_result_youtube.rb +251 -0
- data/lib/aimastering/models/jwt.rb +179 -0
- data/lib/aimastering/models/kpi.rb +179 -0
- data/lib/aimastering/models/library_audio.rb +458 -0
- data/lib/aimastering/models/library_audio_analysis.rb +209 -0
- data/lib/aimastering/models/library_audio_like.rb +209 -0
- data/lib/aimastering/models/mastering.rb +587 -0
- data/lib/aimastering/models/payment.rb +275 -0
- data/lib/aimastering/models/payment_customer.rb +215 -0
- data/lib/aimastering/models/plan.rb +269 -0
- data/lib/aimastering/models/subscription.rb +302 -0
- data/lib/aimastering/models/user.rb +275 -0
- data/lib/aimastering/models/video.rb +233 -0
- data/lib/aimastering/models/video_download_token.rb +197 -0
- data/lib/aimastering/version.rb +15 -0
- data/spec/api/access_token_api_spec.rb +46 -0
- data/spec/api/audio_api_spec.rb +118 -0
- data/spec/api/config_api_spec.rb +46 -0
- data/spec/api/external_search_api_spec.rb +48 -0
- data/spec/api/library_audio_api_spec.rb +119 -0
- data/spec/api/mastering_api_spec.rb +154 -0
- data/spec/api/payment_api_spec.rb +85 -0
- data/spec/api/payment_customer_api_spec.rb +46 -0
- data/spec/api/plan_api_spec.rb +46 -0
- data/spec/api/statistics_api_spec.rb +57 -0
- data/spec/api/subscription_api_spec.rb +96 -0
- data/spec/api/user_api_spec.rb +59 -0
- data/spec/api/video_api_spec.rb +94 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/access_token_spec.rb +42 -0
- data/spec/models/anonymized_mastering_spec.rb +192 -0
- data/spec/models/audio_analysis_spec.rb +54 -0
- data/spec/models/audio_download_token_spec.rb +48 -0
- data/spec/models/audio_spec.rb +168 -0
- data/spec/models/config_auth0_spec.rb +54 -0
- data/spec/models/config_paypal_spec.rb +48 -0
- data/spec/models/config_spec.rb +54 -0
- data/spec/models/config_stripe_spec.rb +42 -0
- data/spec/models/date_time_spec.rb +36 -0
- data/spec/models/external_search_result_itunes_spec.rb +102 -0
- data/spec/models/external_search_result_spec.rb +48 -0
- data/spec/models/external_search_result_youtube_spec.rb +84 -0
- data/spec/models/jwt_spec.rb +36 -0
- data/spec/models/kpi_spec.rb +36 -0
- data/spec/models/library_audio_analysis_spec.rb +54 -0
- data/spec/models/library_audio_like_spec.rb +54 -0
- data/spec/models/library_audio_spec.rb +222 -0
- data/spec/models/mastering_spec.rb +224 -0
- data/spec/models/payment_customer_spec.rb +60 -0
- data/spec/models/payment_spec.rb +82 -0
- data/spec/models/plan_spec.rb +74 -0
- data/spec/models/subscription_spec.rb +100 -0
- data/spec/models/user_spec.rb +82 -0
- data/spec/models/video_download_token_spec.rb +48 -0
- data/spec/models/video_spec.rb +72 -0
- data/spec/spec_helper.rb +111 -0
- metadata +397 -0
@@ -0,0 +1,458 @@
|
|
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 LibraryAudio
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :user_id
|
21
|
+
|
22
|
+
attr_accessor :name
|
23
|
+
|
24
|
+
attr_accessor :album
|
25
|
+
|
26
|
+
attr_accessor :album_artist
|
27
|
+
|
28
|
+
attr_accessor :artist
|
29
|
+
|
30
|
+
attr_accessor :genre
|
31
|
+
|
32
|
+
attr_accessor :track
|
33
|
+
|
34
|
+
attr_accessor :publisher
|
35
|
+
|
36
|
+
attr_accessor :file_hash
|
37
|
+
|
38
|
+
attr_accessor :size
|
39
|
+
|
40
|
+
attr_accessor :status
|
41
|
+
|
42
|
+
attr_accessor :failure_reason
|
43
|
+
|
44
|
+
attr_accessor :probe_json
|
45
|
+
|
46
|
+
attr_accessor :rms
|
47
|
+
|
48
|
+
attr_accessor :peak
|
49
|
+
|
50
|
+
attr_accessor :loudness
|
51
|
+
|
52
|
+
attr_accessor :dynamics
|
53
|
+
|
54
|
+
attr_accessor :sharpness
|
55
|
+
|
56
|
+
attr_accessor :space
|
57
|
+
|
58
|
+
attr_accessor :loudness_range
|
59
|
+
|
60
|
+
attr_accessor :drr
|
61
|
+
|
62
|
+
attr_accessor :sound_quality
|
63
|
+
|
64
|
+
attr_accessor :frames
|
65
|
+
|
66
|
+
attr_accessor :sample_rate
|
67
|
+
|
68
|
+
attr_accessor :channels
|
69
|
+
|
70
|
+
attr_accessor :is_public
|
71
|
+
|
72
|
+
attr_accessor :liked_by_self
|
73
|
+
|
74
|
+
attr_accessor :like_count
|
75
|
+
|
76
|
+
attr_accessor :created_at
|
77
|
+
|
78
|
+
attr_accessor :updated_at
|
79
|
+
|
80
|
+
|
81
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
82
|
+
def self.attribute_map
|
83
|
+
{
|
84
|
+
:'id' => :'id',
|
85
|
+
:'user_id' => :'user_id',
|
86
|
+
:'name' => :'name',
|
87
|
+
:'album' => :'album',
|
88
|
+
:'album_artist' => :'album_artist',
|
89
|
+
:'artist' => :'artist',
|
90
|
+
:'genre' => :'genre',
|
91
|
+
:'track' => :'track',
|
92
|
+
:'publisher' => :'publisher',
|
93
|
+
:'file_hash' => :'file_hash',
|
94
|
+
:'size' => :'size',
|
95
|
+
:'status' => :'status',
|
96
|
+
:'failure_reason' => :'failure_reason',
|
97
|
+
:'probe_json' => :'probe_json',
|
98
|
+
:'rms' => :'rms',
|
99
|
+
:'peak' => :'peak',
|
100
|
+
:'loudness' => :'loudness',
|
101
|
+
:'dynamics' => :'dynamics',
|
102
|
+
:'sharpness' => :'sharpness',
|
103
|
+
:'space' => :'space',
|
104
|
+
:'loudness_range' => :'loudness_range',
|
105
|
+
:'drr' => :'drr',
|
106
|
+
:'sound_quality' => :'sound_quality',
|
107
|
+
:'frames' => :'frames',
|
108
|
+
:'sample_rate' => :'sample_rate',
|
109
|
+
:'channels' => :'channels',
|
110
|
+
:'is_public' => :'is_public',
|
111
|
+
:'liked_by_self' => :'liked_by_self',
|
112
|
+
:'like_count' => :'like_count',
|
113
|
+
:'created_at' => :'created_at',
|
114
|
+
:'updated_at' => :'updated_at'
|
115
|
+
}
|
116
|
+
end
|
117
|
+
|
118
|
+
# Attribute type mapping.
|
119
|
+
def self.swagger_types
|
120
|
+
{
|
121
|
+
:'id' => :'Integer',
|
122
|
+
:'user_id' => :'Integer',
|
123
|
+
:'name' => :'String',
|
124
|
+
:'album' => :'String',
|
125
|
+
:'album_artist' => :'String',
|
126
|
+
:'artist' => :'String',
|
127
|
+
:'genre' => :'String',
|
128
|
+
:'track' => :'Integer',
|
129
|
+
:'publisher' => :'String',
|
130
|
+
:'file_hash' => :'String',
|
131
|
+
:'size' => :'Integer',
|
132
|
+
:'status' => :'String',
|
133
|
+
:'failure_reason' => :'String',
|
134
|
+
:'probe_json' => :'String',
|
135
|
+
:'rms' => :'Float',
|
136
|
+
:'peak' => :'Float',
|
137
|
+
:'loudness' => :'Float',
|
138
|
+
:'dynamics' => :'Float',
|
139
|
+
:'sharpness' => :'Float',
|
140
|
+
:'space' => :'Float',
|
141
|
+
:'loudness_range' => :'Float',
|
142
|
+
:'drr' => :'Float',
|
143
|
+
:'sound_quality' => :'Float',
|
144
|
+
:'frames' => :'Integer',
|
145
|
+
:'sample_rate' => :'Integer',
|
146
|
+
:'channels' => :'Integer',
|
147
|
+
:'is_public' => :'BOOLEAN',
|
148
|
+
:'liked_by_self' => :'BOOLEAN',
|
149
|
+
:'like_count' => :'Integer',
|
150
|
+
:'created_at' => :'DateTime',
|
151
|
+
:'updated_at' => :'DateTime'
|
152
|
+
}
|
153
|
+
end
|
154
|
+
|
155
|
+
# Initializes the object
|
156
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
157
|
+
def initialize(attributes = {})
|
158
|
+
return unless attributes.is_a?(Hash)
|
159
|
+
|
160
|
+
# convert string to symbol for hash key
|
161
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
162
|
+
|
163
|
+
if attributes.has_key?(:'id')
|
164
|
+
self.id = attributes[:'id']
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.has_key?(:'user_id')
|
168
|
+
self.user_id = attributes[:'user_id']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.has_key?(:'name')
|
172
|
+
self.name = attributes[:'name']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.has_key?(:'album')
|
176
|
+
self.album = attributes[:'album']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.has_key?(:'album_artist')
|
180
|
+
self.album_artist = attributes[:'album_artist']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.has_key?(:'artist')
|
184
|
+
self.artist = attributes[:'artist']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.has_key?(:'genre')
|
188
|
+
self.genre = attributes[:'genre']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.has_key?(:'track')
|
192
|
+
self.track = attributes[:'track']
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.has_key?(:'publisher')
|
196
|
+
self.publisher = attributes[:'publisher']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.has_key?(:'file_hash')
|
200
|
+
self.file_hash = attributes[:'file_hash']
|
201
|
+
end
|
202
|
+
|
203
|
+
if attributes.has_key?(:'size')
|
204
|
+
self.size = attributes[:'size']
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.has_key?(:'status')
|
208
|
+
self.status = attributes[:'status']
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.has_key?(:'failure_reason')
|
212
|
+
self.failure_reason = attributes[:'failure_reason']
|
213
|
+
end
|
214
|
+
|
215
|
+
if attributes.has_key?(:'probe_json')
|
216
|
+
self.probe_json = attributes[:'probe_json']
|
217
|
+
end
|
218
|
+
|
219
|
+
if attributes.has_key?(:'rms')
|
220
|
+
self.rms = attributes[:'rms']
|
221
|
+
end
|
222
|
+
|
223
|
+
if attributes.has_key?(:'peak')
|
224
|
+
self.peak = attributes[:'peak']
|
225
|
+
end
|
226
|
+
|
227
|
+
if attributes.has_key?(:'loudness')
|
228
|
+
self.loudness = attributes[:'loudness']
|
229
|
+
end
|
230
|
+
|
231
|
+
if attributes.has_key?(:'dynamics')
|
232
|
+
self.dynamics = attributes[:'dynamics']
|
233
|
+
end
|
234
|
+
|
235
|
+
if attributes.has_key?(:'sharpness')
|
236
|
+
self.sharpness = attributes[:'sharpness']
|
237
|
+
end
|
238
|
+
|
239
|
+
if attributes.has_key?(:'space')
|
240
|
+
self.space = attributes[:'space']
|
241
|
+
end
|
242
|
+
|
243
|
+
if attributes.has_key?(:'loudness_range')
|
244
|
+
self.loudness_range = attributes[:'loudness_range']
|
245
|
+
end
|
246
|
+
|
247
|
+
if attributes.has_key?(:'drr')
|
248
|
+
self.drr = attributes[:'drr']
|
249
|
+
end
|
250
|
+
|
251
|
+
if attributes.has_key?(:'sound_quality')
|
252
|
+
self.sound_quality = attributes[:'sound_quality']
|
253
|
+
end
|
254
|
+
|
255
|
+
if attributes.has_key?(:'frames')
|
256
|
+
self.frames = attributes[:'frames']
|
257
|
+
end
|
258
|
+
|
259
|
+
if attributes.has_key?(:'sample_rate')
|
260
|
+
self.sample_rate = attributes[:'sample_rate']
|
261
|
+
end
|
262
|
+
|
263
|
+
if attributes.has_key?(:'channels')
|
264
|
+
self.channels = attributes[:'channels']
|
265
|
+
end
|
266
|
+
|
267
|
+
if attributes.has_key?(:'is_public')
|
268
|
+
self.is_public = attributes[:'is_public']
|
269
|
+
end
|
270
|
+
|
271
|
+
if attributes.has_key?(:'liked_by_self')
|
272
|
+
self.liked_by_self = attributes[:'liked_by_self']
|
273
|
+
end
|
274
|
+
|
275
|
+
if attributes.has_key?(:'like_count')
|
276
|
+
self.like_count = attributes[:'like_count']
|
277
|
+
end
|
278
|
+
|
279
|
+
if attributes.has_key?(:'created_at')
|
280
|
+
self.created_at = attributes[:'created_at']
|
281
|
+
end
|
282
|
+
|
283
|
+
if attributes.has_key?(:'updated_at')
|
284
|
+
self.updated_at = attributes[:'updated_at']
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
290
|
+
# @return Array for valid properties with the reasons
|
291
|
+
def list_invalid_properties
|
292
|
+
invalid_properties = Array.new
|
293
|
+
return invalid_properties
|
294
|
+
end
|
295
|
+
|
296
|
+
# Check to see if the all the properties in the model are valid
|
297
|
+
# @return true if the model is valid
|
298
|
+
def valid?
|
299
|
+
return true
|
300
|
+
end
|
301
|
+
|
302
|
+
# Checks equality by comparing each attribute.
|
303
|
+
# @param [Object] Object to be compared
|
304
|
+
def ==(o)
|
305
|
+
return true if self.equal?(o)
|
306
|
+
self.class == o.class &&
|
307
|
+
id == o.id &&
|
308
|
+
user_id == o.user_id &&
|
309
|
+
name == o.name &&
|
310
|
+
album == o.album &&
|
311
|
+
album_artist == o.album_artist &&
|
312
|
+
artist == o.artist &&
|
313
|
+
genre == o.genre &&
|
314
|
+
track == o.track &&
|
315
|
+
publisher == o.publisher &&
|
316
|
+
file_hash == o.file_hash &&
|
317
|
+
size == o.size &&
|
318
|
+
status == o.status &&
|
319
|
+
failure_reason == o.failure_reason &&
|
320
|
+
probe_json == o.probe_json &&
|
321
|
+
rms == o.rms &&
|
322
|
+
peak == o.peak &&
|
323
|
+
loudness == o.loudness &&
|
324
|
+
dynamics == o.dynamics &&
|
325
|
+
sharpness == o.sharpness &&
|
326
|
+
space == o.space &&
|
327
|
+
loudness_range == o.loudness_range &&
|
328
|
+
drr == o.drr &&
|
329
|
+
sound_quality == o.sound_quality &&
|
330
|
+
frames == o.frames &&
|
331
|
+
sample_rate == o.sample_rate &&
|
332
|
+
channels == o.channels &&
|
333
|
+
is_public == o.is_public &&
|
334
|
+
liked_by_self == o.liked_by_self &&
|
335
|
+
like_count == o.like_count &&
|
336
|
+
created_at == o.created_at &&
|
337
|
+
updated_at == o.updated_at
|
338
|
+
end
|
339
|
+
|
340
|
+
# @see the `==` method
|
341
|
+
# @param [Object] Object to be compared
|
342
|
+
def eql?(o)
|
343
|
+
self == o
|
344
|
+
end
|
345
|
+
|
346
|
+
# Calculates hash code according to all attributes.
|
347
|
+
# @return [Fixnum] Hash code
|
348
|
+
def hash
|
349
|
+
[id, user_id, name, album, album_artist, artist, genre, track, publisher, file_hash, size, status, failure_reason, probe_json, rms, peak, loudness, dynamics, sharpness, space, loudness_range, drr, sound_quality, frames, sample_rate, channels, is_public, liked_by_self, like_count, created_at, updated_at].hash
|
350
|
+
end
|
351
|
+
|
352
|
+
# Builds the object from hash
|
353
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
354
|
+
# @return [Object] Returns the model itself
|
355
|
+
def build_from_hash(attributes)
|
356
|
+
return nil unless attributes.is_a?(Hash)
|
357
|
+
self.class.swagger_types.each_pair do |key, type|
|
358
|
+
if type =~ /\AArray<(.*)>/i
|
359
|
+
# check to ensure the input is an array given that the the attribute
|
360
|
+
# is documented as an array but the input is not
|
361
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
362
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
363
|
+
end
|
364
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
365
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
366
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
367
|
+
end
|
368
|
+
|
369
|
+
self
|
370
|
+
end
|
371
|
+
|
372
|
+
# Deserializes the data based on type
|
373
|
+
# @param string type Data type
|
374
|
+
# @param string value Value to be deserialized
|
375
|
+
# @return [Object] Deserialized data
|
376
|
+
def _deserialize(type, value)
|
377
|
+
case type.to_sym
|
378
|
+
when :DateTime
|
379
|
+
DateTime.parse(value)
|
380
|
+
when :Date
|
381
|
+
Date.parse(value)
|
382
|
+
when :String
|
383
|
+
value.to_s
|
384
|
+
when :Integer
|
385
|
+
value.to_i
|
386
|
+
when :Float
|
387
|
+
value.to_f
|
388
|
+
when :BOOLEAN
|
389
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
390
|
+
true
|
391
|
+
else
|
392
|
+
false
|
393
|
+
end
|
394
|
+
when :Object
|
395
|
+
# generic object (usually a Hash), return directly
|
396
|
+
value
|
397
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
398
|
+
inner_type = Regexp.last_match[:inner_type]
|
399
|
+
value.map { |v| _deserialize(inner_type, v) }
|
400
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
401
|
+
k_type = Regexp.last_match[:k_type]
|
402
|
+
v_type = Regexp.last_match[:v_type]
|
403
|
+
{}.tap do |hash|
|
404
|
+
value.each do |k, v|
|
405
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
else # model
|
409
|
+
temp_model = Aimastering.const_get(type).new
|
410
|
+
temp_model.build_from_hash(value)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
# Returns the string representation of the object
|
415
|
+
# @return [String] String presentation of the object
|
416
|
+
def to_s
|
417
|
+
to_hash.to_s
|
418
|
+
end
|
419
|
+
|
420
|
+
# to_body is an alias to to_hash (backward compatibility)
|
421
|
+
# @return [Hash] Returns the object in the form of hash
|
422
|
+
def to_body
|
423
|
+
to_hash
|
424
|
+
end
|
425
|
+
|
426
|
+
# Returns the object in the form of hash
|
427
|
+
# @return [Hash] Returns the object in the form of hash
|
428
|
+
def to_hash
|
429
|
+
hash = {}
|
430
|
+
self.class.attribute_map.each_pair do |attr, param|
|
431
|
+
value = self.send(attr)
|
432
|
+
next if value.nil?
|
433
|
+
hash[param] = _to_hash(value)
|
434
|
+
end
|
435
|
+
hash
|
436
|
+
end
|
437
|
+
|
438
|
+
# Outputs non-array value in the form of hash
|
439
|
+
# For object, use to_hash. Otherwise, just return the value
|
440
|
+
# @param [Object] value Any valid value
|
441
|
+
# @return [Hash] Returns the value in the form of hash
|
442
|
+
def _to_hash(value)
|
443
|
+
if value.is_a?(Array)
|
444
|
+
value.compact.map{ |v| _to_hash(v) }
|
445
|
+
elsif value.is_a?(Hash)
|
446
|
+
{}.tap do |hash|
|
447
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
448
|
+
end
|
449
|
+
elsif value.respond_to? :to_hash
|
450
|
+
value.to_hash
|
451
|
+
else
|
452
|
+
value
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
end
|
457
|
+
|
458
|
+
end
|