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
 
@@ -20,6 +20,53 @@ module Aimastering
20
20
  @api_client = api_client
21
21
  end
22
22
 
23
+ # Get group buy statistics.
24
+ #
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [GroupBuyStatistics]
27
+ def get_group_buy_statistics(opts = {})
28
+ data, _status_code, _headers = get_group_buy_statistics_with_http_info(opts)
29
+ return data
30
+ end
31
+
32
+ # Get group buy statistics.
33
+ #
34
+ # @param [Hash] opts the optional parameters
35
+ # @return [Array<(GroupBuyStatistics, Fixnum, Hash)>] GroupBuyStatistics data, response status code and response headers
36
+ def get_group_buy_statistics_with_http_info(opts = {})
37
+ if @api_client.config.debugging
38
+ @api_client.config.logger.debug "Calling API: StatisticsApi.get_group_buy_statistics ..."
39
+ end
40
+ # resource path
41
+ local_var_path = "/statistics/group_buy"
42
+
43
+ # query parameters
44
+ query_params = {}
45
+
46
+ # header parameters
47
+ header_params = {}
48
+ # HTTP header 'Accept' (if needed)
49
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
50
+
51
+ # form parameters
52
+ form_params = {}
53
+
54
+ # http body (model)
55
+ post_body = nil
56
+ auth_names = ['bearer']
57
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
58
+ :header_params => header_params,
59
+ :query_params => query_params,
60
+ :form_params => form_params,
61
+ :body => post_body,
62
+ :auth_names => auth_names,
63
+ :return_type => 'GroupBuyStatistics')
64
+ if @api_client.config.debugging
65
+ @api_client.config.logger.debug "API called: StatisticsApi#get_group_buy_statistics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
66
+ end
67
+ return data, status_code, headers
68
+ end
69
+
23
70
  # Get anonymized masterings.
24
71
  #
25
72
  # @param [Hash] opts the optional parameters
@@ -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
 
@@ -144,6 +144,7 @@ module Aimastering
144
144
  # @param [Hash] opts the optional parameters
145
145
  # @option opts [String] :stripe_plan_id The Stripe plan id. This parameter is effective only when the service is \&quot;stripe\&quot;.
146
146
  # @option opts [String] :token This parameter represents the card token. This parameter is effective only when the service is \&quot;stripe\&quot;.
147
+ # @option opts [String] :affiliate_id Affiliate id of inviter user.
147
148
  # @return [Subscription]
148
149
  def create_subscription(service, opts = {})
149
150
  data, _status_code, _headers = create_subscription_with_http_info(service, opts)
@@ -156,6 +157,7 @@ module Aimastering
156
157
  # @param [Hash] opts the optional parameters
157
158
  # @option opts [String] :stripe_plan_id The Stripe plan id. This parameter is effective only when the service is \&quot;stripe\&quot;.
158
159
  # @option opts [String] :token This parameter represents the card token. This parameter is effective only when the service is \&quot;stripe\&quot;.
160
+ # @option opts [String] :affiliate_id Affiliate id of inviter user.
159
161
  # @return [Array<(Subscription, Fixnum, Hash)>] Subscription data, response status code and response headers
160
162
  def create_subscription_with_http_info(service, opts = {})
161
163
  if @api_client.config.debugging
@@ -187,6 +189,7 @@ module Aimastering
187
189
  form_params["service"] = service
188
190
  form_params["stripe_plan_id"] = opts[:'stripe_plan_id'] if !opts[:'stripe_plan_id'].nil?
189
191
  form_params["token"] = opts[:'token'] if !opts[:'token'].nil?
192
+ form_params["affiliate_id"] = opts[:'affiliate_id'] if !opts[:'affiliate_id'].nil?
190
193
 
191
194
  # http body (model)
192
195
  post_body = nil
@@ -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
 
@@ -67,6 +67,117 @@ module Aimastering
67
67
  return data, status_code, headers
68
68
  end
69
69
 
70
+ # Notify user is registered.
71
+ #
72
+ # @param [Hash] opts the optional parameters
73
+ # @option opts [String] :affiliate_id The affiliate id of inviter.
74
+ # @option opts [String] :referrer_url The referrer URL.
75
+ # @return [User]
76
+ def notify_registration(opts = {})
77
+ data, _status_code, _headers = notify_registration_with_http_info(opts)
78
+ return data
79
+ end
80
+
81
+ # Notify user is registered.
82
+ #
83
+ # @param [Hash] opts the optional parameters
84
+ # @option opts [String] :affiliate_id The affiliate id of inviter.
85
+ # @option opts [String] :referrer_url The referrer URL.
86
+ # @return [Array<(User, Fixnum, Hash)>] User data, response status code and response headers
87
+ def notify_registration_with_http_info(opts = {})
88
+ if @api_client.config.debugging
89
+ @api_client.config.logger.debug "Calling API: UserApi.notify_registration ..."
90
+ end
91
+ # resource path
92
+ local_var_path = "/users/self/notify_registration"
93
+
94
+ # query parameters
95
+ query_params = {}
96
+
97
+ # header parameters
98
+ header_params = {}
99
+ # HTTP header 'Accept' (if needed)
100
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
101
+ # HTTP header 'Content-Type'
102
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
103
+
104
+ # form parameters
105
+ form_params = {}
106
+ form_params["affiliate_id"] = opts[:'affiliate_id'] if !opts[:'affiliate_id'].nil?
107
+ form_params["referrer_url"] = opts[:'referrer_url'] if !opts[:'referrer_url'].nil?
108
+
109
+ # http body (model)
110
+ post_body = nil
111
+ auth_names = ['bearer']
112
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
113
+ :header_params => header_params,
114
+ :query_params => query_params,
115
+ :form_params => form_params,
116
+ :body => post_body,
117
+ :auth_names => auth_names,
118
+ :return_type => 'User')
119
+ if @api_client.config.debugging
120
+ @api_client.config.logger.debug "API called: UserApi#notify_registration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
121
+ end
122
+ return data, status_code, headers
123
+ end
124
+
125
+ # Send invitation.
126
+ #
127
+ # @param invitee_email The email of invitee.
128
+ # @param [Hash] opts the optional parameters
129
+ # @return [User]
130
+ def send_invitation(invitee_email, opts = {})
131
+ data, _status_code, _headers = send_invitation_with_http_info(invitee_email, opts)
132
+ return data
133
+ end
134
+
135
+ # Send invitation.
136
+ #
137
+ # @param invitee_email The email of invitee.
138
+ # @param [Hash] opts the optional parameters
139
+ # @return [Array<(User, Fixnum, Hash)>] User data, response status code and response headers
140
+ def send_invitation_with_http_info(invitee_email, opts = {})
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "Calling API: UserApi.send_invitation ..."
143
+ end
144
+ # verify the required parameter 'invitee_email' is set
145
+ if @api_client.config.client_side_validation && invitee_email.nil?
146
+ fail ArgumentError, "Missing the required parameter 'invitee_email' when calling UserApi.send_invitation"
147
+ end
148
+ # resource path
149
+ local_var_path = "/users/self/send_invitation"
150
+
151
+ # query parameters
152
+ query_params = {}
153
+
154
+ # header parameters
155
+ header_params = {}
156
+ # HTTP header 'Accept' (if needed)
157
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
158
+ # HTTP header 'Content-Type'
159
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
160
+
161
+ # form parameters
162
+ form_params = {}
163
+ form_params["invitee_email"] = invitee_email
164
+
165
+ # http body (model)
166
+ post_body = nil
167
+ auth_names = ['bearer']
168
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
169
+ :header_params => header_params,
170
+ :query_params => query_params,
171
+ :form_params => form_params,
172
+ :body => post_body,
173
+ :auth_names => auth_names,
174
+ :return_type => 'User')
175
+ if @api_client.config.debugging
176
+ @api_client.config.logger.debug "API called: UserApi#send_invitation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
177
+ end
178
+ return data, status_code, headers
179
+ end
180
+
70
181
  # Update self user.
71
182
  #
72
183
  # @param [Hash] opts the optional parameters
@@ -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
 
@@ -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
 
@@ -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
 
@@ -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
 
@@ -129,8 +129,8 @@ module Aimastering
129
129
 
130
130
  def initialize
131
131
  @scheme = 'https'
132
- @host = 'aimastering.com:443'
133
- @base_path = '/api'
132
+ @host = 'api.bakuage.com:443'
133
+ @base_path = ''
134
134
  @api_key = {}
135
135
  @api_key_prefix = {}
136
136
  @timeout = 0
@@ -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 AmazonSubscription
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", "deactivated"])
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", "deactivated"])
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