aimastering 1.0.0 → 1.1.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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -5
  3. data/aimastering.gemspec +4 -4
  4. data/docs/AccessTokenApi.md +1 -1
  5. data/docs/AmazonSubscription.md +12 -0
  6. data/docs/AmazonSubscriptionApi.md +55 -0
  7. data/docs/Audio.md +4 -0
  8. data/docs/AudioApi.md +4 -2
  9. data/docs/Config.md +1 -0
  10. data/docs/ConfigApi.md +1 -1
  11. data/docs/{DateTime.md → ConfigVersion.md} +2 -1
  12. data/docs/ExternalSearchApi.md +1 -1
  13. data/docs/GroupBuyStatistics.md +8 -0
  14. data/docs/LibraryAudio.md +4 -0
  15. data/docs/LibraryAudioApi.md +1 -1
  16. data/docs/Mastering.md +9 -0
  17. data/docs/MasteringApi.md +151 -29
  18. data/docs/PaymentApi.md +3 -3
  19. data/docs/PaymentCustomerApi.md +1 -1
  20. data/docs/PlanApi.md +1 -1
  21. data/docs/SpSubscription.md +12 -0
  22. data/docs/SpSubscriptionApi.md +112 -0
  23. data/docs/StatisticsApi.md +48 -1
  24. data/docs/Subscription.md +1 -0
  25. data/docs/SubscriptionApi.md +4 -2
  26. data/docs/User.md +3 -0
  27. data/docs/UserApi.md +110 -1
  28. data/docs/UserStatistics.md +13 -0
  29. data/docs/VideoApi.md +1 -1
  30. data/lib/aimastering.rb +8 -1
  31. data/lib/aimastering/api/access_token_api.rb +1 -1
  32. data/lib/aimastering/api/amazon_subscription_api.rb +70 -0
  33. data/lib/aimastering/api/audio_api.rb +4 -1
  34. data/lib/aimastering/api/config_api.rb +1 -1
  35. data/lib/aimastering/api/external_search_api.rb +1 -1
  36. data/lib/aimastering/api/library_audio_api.rb +1 -1
  37. data/lib/aimastering/api/mastering_api.rb +162 -16
  38. data/lib/aimastering/api/payment_api.rb +1 -1
  39. data/lib/aimastering/api/payment_customer_api.rb +1 -1
  40. data/lib/aimastering/api/plan_api.rb +1 -1
  41. data/lib/aimastering/api/sp_subscription_api.rb +133 -0
  42. data/lib/aimastering/api/statistics_api.rb +48 -1
  43. data/lib/aimastering/api/subscription_api.rb +4 -1
  44. data/lib/aimastering/api/user_api.rb +112 -1
  45. data/lib/aimastering/api/video_api.rb +1 -1
  46. data/lib/aimastering/api_client.rb +1 -1
  47. data/lib/aimastering/api_error.rb +1 -1
  48. data/lib/aimastering/configuration.rb +3 -3
  49. data/lib/aimastering/models/access_token.rb +1 -1
  50. data/lib/aimastering/models/amazon_subscription.rb +257 -0
  51. data/lib/aimastering/models/anonymized_mastering.rb +5 -5
  52. data/lib/aimastering/models/audio.rb +38 -2
  53. data/lib/aimastering/models/audio_analysis.rb +1 -1
  54. data/lib/aimastering/models/audio_download_token.rb +1 -1
  55. data/lib/aimastering/models/config.rb +14 -5
  56. data/lib/aimastering/models/config_auth0.rb +1 -1
  57. data/lib/aimastering/models/config_paypal.rb +1 -1
  58. data/lib/aimastering/models/config_stripe.rb +1 -1
  59. data/lib/aimastering/models/{date_time.rb → config_version.rb} +14 -5
  60. data/lib/aimastering/models/external_search_result.rb +1 -1
  61. data/lib/aimastering/models/external_search_result_itunes.rb +1 -1
  62. data/lib/aimastering/models/external_search_result_youtube.rb +1 -1
  63. data/lib/aimastering/models/group_buy_statistics.rb +188 -0
  64. data/lib/aimastering/models/jwt.rb +1 -1
  65. data/lib/aimastering/models/kpi.rb +1 -1
  66. data/lib/aimastering/models/library_audio.rb +38 -2
  67. data/lib/aimastering/models/library_audio_analysis.rb +1 -1
  68. data/lib/aimastering/models/library_audio_like.rb +1 -1
  69. data/lib/aimastering/models/mastering.rb +123 -6
  70. data/lib/aimastering/models/payment.rb +1 -1
  71. data/lib/aimastering/models/payment_customer.rb +1 -1
  72. data/lib/aimastering/models/plan.rb +1 -1
  73. data/lib/aimastering/models/sp_subscription.rb +257 -0
  74. data/lib/aimastering/models/subscription.rb +11 -2
  75. data/lib/aimastering/models/user.rb +29 -2
  76. data/lib/aimastering/models/user_statistics.rb +233 -0
  77. data/lib/aimastering/models/video.rb +1 -1
  78. data/lib/aimastering/models/video_download_token.rb +1 -1
  79. data/lib/aimastering/version.rb +2 -2
  80. data/spec/api/access_token_api_spec.rb +1 -1
  81. data/spec/api/amazon_subscription_api_spec.rb +46 -0
  82. data/spec/api/audio_api_spec.rb +2 -1
  83. data/spec/api/config_api_spec.rb +1 -1
  84. data/spec/api/external_search_api_spec.rb +1 -1
  85. data/spec/api/library_audio_api_spec.rb +1 -1
  86. data/spec/api/mastering_api_spec.rb +35 -4
  87. data/spec/api/payment_api_spec.rb +1 -1
  88. data/spec/api/payment_customer_api_spec.rb +1 -1
  89. data/spec/api/plan_api_spec.rb +1 -1
  90. data/spec/api/sp_subscription_api_spec.rb +59 -0
  91. data/spec/api/statistics_api_spec.rb +12 -1
  92. data/spec/api/subscription_api_spec.rb +2 -1
  93. data/spec/api/user_api_spec.rb +26 -1
  94. data/spec/api/video_api_spec.rb +1 -1
  95. data/spec/api_client_spec.rb +1 -1
  96. data/spec/configuration_spec.rb +4 -4
  97. data/spec/models/access_token_spec.rb +1 -1
  98. data/spec/models/amazon_subscription_spec.rb +70 -0
  99. data/spec/models/anonymized_mastering_spec.rb +3 -3
  100. data/spec/models/audio_analysis_spec.rb +1 -1
  101. data/spec/models/audio_download_token_spec.rb +1 -1
  102. data/spec/models/audio_spec.rb +25 -1
  103. data/spec/models/config_auth0_spec.rb +1 -1
  104. data/spec/models/config_paypal_spec.rb +1 -1
  105. data/spec/models/config_spec.rb +7 -1
  106. data/spec/models/config_stripe_spec.rb +1 -1
  107. data/spec/models/config_version_spec.rb +42 -0
  108. data/spec/models/external_search_result_itunes_spec.rb +1 -1
  109. data/spec/models/external_search_result_spec.rb +1 -1
  110. data/spec/models/external_search_result_youtube_spec.rb +1 -1
  111. data/spec/models/group_buy_statistics_spec.rb +42 -0
  112. data/spec/models/jwt_spec.rb +1 -1
  113. data/spec/models/kpi_spec.rb +1 -1
  114. data/spec/models/library_audio_analysis_spec.rb +1 -1
  115. data/spec/models/library_audio_like_spec.rb +1 -1
  116. data/spec/models/library_audio_spec.rb +25 -1
  117. data/spec/models/mastering_spec.rb +69 -3
  118. data/spec/models/payment_customer_spec.rb +1 -1
  119. data/spec/models/payment_spec.rb +1 -1
  120. data/spec/models/plan_spec.rb +1 -1
  121. data/spec/models/sp_subscription_spec.rb +70 -0
  122. data/spec/models/subscription_spec.rb +7 -1
  123. data/spec/models/user_spec.rb +19 -1
  124. data/spec/models/user_statistics_spec.rb +72 -0
  125. data/spec/models/video_download_token_spec.rb +1 -1
  126. data/spec/models/video_spec.rb +1 -1
  127. data/spec/spec_helper.rb +1 -1
  128. metadata +46 -23
  129. data/spec/models/date_time_spec.rb +0 -36
@@ -4,7 +4,7 @@
4
4
  #This is a AI Mastering API document. You can use the mastering feature of [AI Mastering](https://aimastering.com) through this API.
5
5
 
6
6
  OpenAPI spec version: 1.0.0
7
- Contact: aimasteringcom@gmail.com
7
+ Contact: info@bakuage.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.3.1
10
10
 
@@ -0,0 +1,257 @@
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: info@bakuage.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 SpSubscription
18
+ attr_accessor :id
19
+
20
+ attr_accessor :user_id
21
+
22
+ attr_accessor :status
23
+
24
+ attr_accessor :created_at
25
+
26
+ attr_accessor :updated_at
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'id' => :'id',
54
+ :'user_id' => :'user_id',
55
+ :'status' => :'status',
56
+ :'created_at' => :'created_at',
57
+ :'updated_at' => :'updated_at'
58
+ }
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.swagger_types
63
+ {
64
+ :'id' => :'Integer',
65
+ :'user_id' => :'Integer',
66
+ :'status' => :'String',
67
+ :'created_at' => :'DateTime',
68
+ :'updated_at' => :'DateTime'
69
+ }
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ return unless attributes.is_a?(Hash)
76
+
77
+ # convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
79
+
80
+ if attributes.has_key?(:'id')
81
+ self.id = attributes[:'id']
82
+ end
83
+
84
+ if attributes.has_key?(:'user_id')
85
+ self.user_id = attributes[:'user_id']
86
+ end
87
+
88
+ if attributes.has_key?(:'status')
89
+ self.status = attributes[:'status']
90
+ end
91
+
92
+ if attributes.has_key?(:'created_at')
93
+ self.created_at = attributes[:'created_at']
94
+ end
95
+
96
+ if attributes.has_key?(:'updated_at')
97
+ self.updated_at = attributes[:'updated_at']
98
+ end
99
+
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ return invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ status_validator = EnumAttributeValidator.new('String', ["active", "inactive"])
113
+ return false unless status_validator.valid?(@status)
114
+ return true
115
+ end
116
+
117
+ # Custom attribute writer method checking allowed values (enum).
118
+ # @param [Object] status Object to be assigned
119
+ def status=(status)
120
+ validator = EnumAttributeValidator.new('String', ["active", "inactive"])
121
+ unless validator.valid?(status)
122
+ fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
123
+ end
124
+ @status = status
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ id == o.id &&
133
+ user_id == o.user_id &&
134
+ status == o.status &&
135
+ created_at == o.created_at &&
136
+ updated_at == o.updated_at
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Fixnum] Hash code
147
+ def hash
148
+ [id, user_id, status, created_at, updated_at].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.swagger_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :BOOLEAN
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ temp_model = Aimastering.const_get(type).new
209
+ temp_model.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ next if value.nil?
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map{ |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end
@@ -4,7 +4,7 @@
4
4
  #This is a AI Mastering API document. You can use the mastering feature of [AI Mastering](https://aimastering.com) through this API.
5
5
 
6
6
  OpenAPI spec version: 1.0.0
7
- Contact: aimasteringcom@gmail.com
7
+ Contact: info@bakuage.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.3.1
10
10
 
@@ -29,6 +29,8 @@ module Aimastering
29
29
 
30
30
  attr_accessor :cancel_at_period_end
31
31
 
32
+ attr_accessor :trial_end
33
+
32
34
  attr_accessor :status
33
35
 
34
36
  attr_accessor :created_at
@@ -67,6 +69,7 @@ module Aimastering
67
69
  :'current_period_end_at' => :'current_period_end_at',
68
70
  :'canceled' => :'canceled',
69
71
  :'cancel_at_period_end' => :'cancel_at_period_end',
72
+ :'trial_end' => :'trial_end',
70
73
  :'status' => :'status',
71
74
  :'created_at' => :'created_at',
72
75
  :'updated_at' => :'updated_at'
@@ -83,6 +86,7 @@ module Aimastering
83
86
  :'current_period_end_at' => :'DateTime',
84
87
  :'canceled' => :'BOOLEAN',
85
88
  :'cancel_at_period_end' => :'BOOLEAN',
89
+ :'trial_end' => :'DateTime',
86
90
  :'status' => :'String',
87
91
  :'created_at' => :'DateTime',
88
92
  :'updated_at' => :'DateTime'
@@ -125,6 +129,10 @@ module Aimastering
125
129
  self.cancel_at_period_end = attributes[:'cancel_at_period_end']
126
130
  end
127
131
 
132
+ if attributes.has_key?(:'trial_end')
133
+ self.trial_end = attributes[:'trial_end']
134
+ end
135
+
128
136
  if attributes.has_key?(:'status')
129
137
  self.status = attributes[:'status']
130
138
  end
@@ -176,6 +184,7 @@ module Aimastering
176
184
  current_period_end_at == o.current_period_end_at &&
177
185
  canceled == o.canceled &&
178
186
  cancel_at_period_end == o.cancel_at_period_end &&
187
+ trial_end == o.trial_end &&
179
188
  status == o.status &&
180
189
  created_at == o.created_at &&
181
190
  updated_at == o.updated_at
@@ -190,7 +199,7 @@ module Aimastering
190
199
  # Calculates hash code according to all attributes.
191
200
  # @return [Fixnum] Hash code
192
201
  def hash
193
- [id, user_id, stripe_subscription_id, current_period_start_at, current_period_end_at, canceled, cancel_at_period_end, status, created_at, updated_at].hash
202
+ [id, user_id, stripe_subscription_id, current_period_start_at, current_period_end_at, canceled, cancel_at_period_end, trial_end, status, created_at, updated_at].hash
194
203
  end
195
204
 
196
205
  # Builds the object from hash
@@ -4,7 +4,7 @@
4
4
  #This is a AI Mastering API document. You can use the mastering feature of [AI Mastering](https://aimastering.com) through this API.
5
5
 
6
6
  OpenAPI spec version: 1.0.0
7
- Contact: aimasteringcom@gmail.com
7
+ Contact: info@bakuage.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.3.1
10
10
 
@@ -17,6 +17,8 @@ module Aimastering
17
17
  class User
18
18
  attr_accessor :id
19
19
 
20
+ attr_accessor :affiliate_enabled
21
+
20
22
  attr_accessor :agreed_terms_of_service
21
23
 
22
24
  attr_accessor :auth_id
@@ -25,6 +27,10 @@ module Aimastering
25
27
 
26
28
  attr_accessor :email
27
29
 
30
+ attr_accessor :registration_notified
31
+
32
+ attr_accessor :statistics
33
+
28
34
  attr_accessor :created_at
29
35
 
30
36
  attr_accessor :updated_at
@@ -55,10 +61,13 @@ module Aimastering
55
61
  def self.attribute_map
56
62
  {
57
63
  :'id' => :'id',
64
+ :'affiliate_enabled' => :'affiliate_enabled',
58
65
  :'agreed_terms_of_service' => :'agreed_terms_of_service',
59
66
  :'auth_id' => :'auth_id',
60
67
  :'auth_provider' => :'auth_provider',
61
68
  :'email' => :'email',
69
+ :'registration_notified' => :'registration_notified',
70
+ :'statistics' => :'statistics',
62
71
  :'created_at' => :'created_at',
63
72
  :'updated_at' => :'updated_at'
64
73
  }
@@ -68,10 +77,13 @@ module Aimastering
68
77
  def self.swagger_types
69
78
  {
70
79
  :'id' => :'Integer',
80
+ :'affiliate_enabled' => :'BOOLEAN',
71
81
  :'agreed_terms_of_service' => :'BOOLEAN',
72
82
  :'auth_id' => :'String',
73
83
  :'auth_provider' => :'String',
74
84
  :'email' => :'String',
85
+ :'registration_notified' => :'BOOLEAN',
86
+ :'statistics' => :'UserStatistics',
75
87
  :'created_at' => :'DateTime',
76
88
  :'updated_at' => :'DateTime'
77
89
  }
@@ -89,6 +101,10 @@ module Aimastering
89
101
  self.id = attributes[:'id']
90
102
  end
91
103
 
104
+ if attributes.has_key?(:'affiliate_enabled')
105
+ self.affiliate_enabled = attributes[:'affiliate_enabled']
106
+ end
107
+
92
108
  if attributes.has_key?(:'agreed_terms_of_service')
93
109
  self.agreed_terms_of_service = attributes[:'agreed_terms_of_service']
94
110
  end
@@ -105,6 +121,14 @@ module Aimastering
105
121
  self.email = attributes[:'email']
106
122
  end
107
123
 
124
+ if attributes.has_key?(:'registration_notified')
125
+ self.registration_notified = attributes[:'registration_notified']
126
+ end
127
+
128
+ if attributes.has_key?(:'statistics')
129
+ self.statistics = attributes[:'statistics']
130
+ end
131
+
108
132
  if attributes.has_key?(:'created_at')
109
133
  self.created_at = attributes[:'created_at']
110
134
  end
@@ -146,10 +170,13 @@ module Aimastering
146
170
  return true if self.equal?(o)
147
171
  self.class == o.class &&
148
172
  id == o.id &&
173
+ affiliate_enabled == o.affiliate_enabled &&
149
174
  agreed_terms_of_service == o.agreed_terms_of_service &&
150
175
  auth_id == o.auth_id &&
151
176
  auth_provider == o.auth_provider &&
152
177
  email == o.email &&
178
+ registration_notified == o.registration_notified &&
179
+ statistics == o.statistics &&
153
180
  created_at == o.created_at &&
154
181
  updated_at == o.updated_at
155
182
  end
@@ -163,7 +190,7 @@ module Aimastering
163
190
  # Calculates hash code according to all attributes.
164
191
  # @return [Fixnum] Hash code
165
192
  def hash
166
- [id, agreed_terms_of_service, auth_id, auth_provider, email, created_at, updated_at].hash
193
+ [id, affiliate_enabled, agreed_terms_of_service, auth_id, auth_provider, email, registration_notified, statistics, created_at, updated_at].hash
167
194
  end
168
195
 
169
196
  # Builds the object from hash
@@ -0,0 +1,233 @@
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: info@bakuage.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 UserStatistics
18
+ attr_accessor :registration_invitation_count
19
+
20
+ attr_accessor :subscription_invitation_count
21
+
22
+ attr_accessor :mastering_count
23
+
24
+ attr_accessor :monthly_registration_invitation_count
25
+
26
+ attr_accessor :monthly_subscription_invitation_count
27
+
28
+ attr_accessor :monthly_mastering_count
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'registration_invitation_count' => :'registration_invitation_count',
35
+ :'subscription_invitation_count' => :'subscription_invitation_count',
36
+ :'mastering_count' => :'mastering_count',
37
+ :'monthly_registration_invitation_count' => :'monthly_registration_invitation_count',
38
+ :'monthly_subscription_invitation_count' => :'monthly_subscription_invitation_count',
39
+ :'monthly_mastering_count' => :'monthly_mastering_count'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'registration_invitation_count' => :'Integer',
47
+ :'subscription_invitation_count' => :'Integer',
48
+ :'mastering_count' => :'Integer',
49
+ :'monthly_registration_invitation_count' => :'Integer',
50
+ :'monthly_subscription_invitation_count' => :'Integer',
51
+ :'monthly_mastering_count' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
62
+
63
+ if attributes.has_key?(:'registration_invitation_count')
64
+ self.registration_invitation_count = attributes[:'registration_invitation_count']
65
+ end
66
+
67
+ if attributes.has_key?(:'subscription_invitation_count')
68
+ self.subscription_invitation_count = attributes[:'subscription_invitation_count']
69
+ end
70
+
71
+ if attributes.has_key?(:'mastering_count')
72
+ self.mastering_count = attributes[:'mastering_count']
73
+ end
74
+
75
+ if attributes.has_key?(:'monthly_registration_invitation_count')
76
+ self.monthly_registration_invitation_count = attributes[:'monthly_registration_invitation_count']
77
+ end
78
+
79
+ if attributes.has_key?(:'monthly_subscription_invitation_count')
80
+ self.monthly_subscription_invitation_count = attributes[:'monthly_subscription_invitation_count']
81
+ end
82
+
83
+ if attributes.has_key?(:'monthly_mastering_count')
84
+ self.monthly_mastering_count = attributes[:'monthly_mastering_count']
85
+ end
86
+
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ return invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ registration_invitation_count == o.registration_invitation_count &&
108
+ subscription_invitation_count == o.subscription_invitation_count &&
109
+ mastering_count == o.mastering_count &&
110
+ monthly_registration_invitation_count == o.monthly_registration_invitation_count &&
111
+ monthly_subscription_invitation_count == o.monthly_subscription_invitation_count &&
112
+ monthly_mastering_count == o.monthly_mastering_count
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Fixnum] Hash code
123
+ def hash
124
+ [registration_invitation_count, subscription_invitation_count, mastering_count, monthly_registration_invitation_count, monthly_subscription_invitation_count, monthly_mastering_count].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.swagger_types.each_pair do |key, type|
133
+ if type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :DateTime
154
+ DateTime.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :BOOLEAN
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ temp_model = Aimastering.const_get(type).new
185
+ temp_model.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ next if value.nil?
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map{ |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ end
232
+
233
+ end