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,197 @@
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 ConfigPaypal
18
+ attr_accessor :mode
19
+
20
+ attr_accessor :client_id
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'mode' => :'mode',
27
+ :'client_id' => :'client_id'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'mode' => :'String',
35
+ :'client_id' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
46
+
47
+ if attributes.has_key?(:'mode')
48
+ self.mode = attributes[:'mode']
49
+ end
50
+
51
+ if attributes.has_key?(:'client_id')
52
+ self.client_id = attributes[:'client_id']
53
+ end
54
+
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ return invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ return true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ mode == o.mode &&
76
+ client_id == o.client_id
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [mode, client_id].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = Aimastering.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map{ |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+
197
+ end
@@ -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 ConfigStripe
18
+ attr_accessor :publishable_key
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'publishable_key' => :'publishable_key'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'publishable_key' => :'String'
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?(:'publishable_key')
44
+ self.publishable_key = attributes[:'publishable_key']
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
+ publishable_key == o.publishable_key
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
+ [publishable_key].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,179 @@
1
+ =begin
2
+ #AI Mastering API
3
+
4
+ #This is a AI Mastering API document. You can use the mastering feature of [https://aimastering.com/](AI Mastering) 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 DateTime
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ }
29
+ end
30
+
31
+ # Initializes the object
32
+ # @param [Hash] attributes Model attributes in the form of hash
33
+ def initialize(attributes = {})
34
+ return unless attributes.is_a?(Hash)
35
+
36
+ # convert string to symbol for hash key
37
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
38
+
39
+ end
40
+
41
+ # Show invalid properties with the reasons. Usually used together with valid?
42
+ # @return Array for valid properties with the reasons
43
+ def list_invalid_properties
44
+ invalid_properties = Array.new
45
+ return invalid_properties
46
+ end
47
+
48
+ # Check to see if the all the properties in the model are valid
49
+ # @return true if the model is valid
50
+ def valid?
51
+ return true
52
+ end
53
+
54
+ # Checks equality by comparing each attribute.
55
+ # @param [Object] Object to be compared
56
+ def ==(o)
57
+ return true if self.equal?(o)
58
+ self.class == o.class
59
+ end
60
+
61
+ # @see the `==` method
62
+ # @param [Object] Object to be compared
63
+ def eql?(o)
64
+ self == o
65
+ end
66
+
67
+ # Calculates hash code according to all attributes.
68
+ # @return [Fixnum] Hash code
69
+ def hash
70
+ [].hash
71
+ end
72
+
73
+ # Builds the object from hash
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @return [Object] Returns the model itself
76
+ def build_from_hash(attributes)
77
+ return nil unless attributes.is_a?(Hash)
78
+ self.class.swagger_types.each_pair do |key, type|
79
+ if type =~ /\AArray<(.*)>/i
80
+ # check to ensure the input is an array given that the the attribute
81
+ # is documented as an array but the input is not
82
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
83
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
84
+ end
85
+ elsif !attributes[self.class.attribute_map[key]].nil?
86
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
87
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
88
+ end
89
+
90
+ self
91
+ end
92
+
93
+ # Deserializes the data based on type
94
+ # @param string type Data type
95
+ # @param string value Value to be deserialized
96
+ # @return [Object] Deserialized data
97
+ def _deserialize(type, value)
98
+ case type.to_sym
99
+ when :DateTime
100
+ DateTime.parse(value)
101
+ when :Date
102
+ Date.parse(value)
103
+ when :String
104
+ value.to_s
105
+ when :Integer
106
+ value.to_i
107
+ when :Float
108
+ value.to_f
109
+ when :BOOLEAN
110
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
111
+ true
112
+ else
113
+ false
114
+ end
115
+ when :Object
116
+ # generic object (usually a Hash), return directly
117
+ value
118
+ when /\AArray<(?<inner_type>.+)>\z/
119
+ inner_type = Regexp.last_match[:inner_type]
120
+ value.map { |v| _deserialize(inner_type, v) }
121
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
122
+ k_type = Regexp.last_match[:k_type]
123
+ v_type = Regexp.last_match[:v_type]
124
+ {}.tap do |hash|
125
+ value.each do |k, v|
126
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
127
+ end
128
+ end
129
+ else # model
130
+ temp_model = Aimastering.const_get(type).new
131
+ temp_model.build_from_hash(value)
132
+ end
133
+ end
134
+
135
+ # Returns the string representation of the object
136
+ # @return [String] String presentation of the object
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # to_body is an alias to to_hash (backward compatibility)
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_body
144
+ to_hash
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ next if value.nil?
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ # Outputs non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ # @param [Object] value Any valid value
162
+ # @return [Hash] Returns the value in the form of hash
163
+ def _to_hash(value)
164
+ if value.is_a?(Array)
165
+ value.compact.map{ |v| _to_hash(v) }
166
+ elsif value.is_a?(Hash)
167
+ {}.tap do |hash|
168
+ value.each { |k, v| hash[k] = _to_hash(v) }
169
+ end
170
+ elsif value.respond_to? :to_hash
171
+ value.to_hash
172
+ else
173
+ value
174
+ end
175
+ end
176
+
177
+ end
178
+
179
+ end