iron_titan 0.3.10 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -0
  3. data/README.md +6 -5
  4. data/lib/iron_titan/api/groups_api.rb +34 -31
  5. data/lib/iron_titan/api/jobs_api.rb +140 -182
  6. data/lib/iron_titan/api/runner_api.rb +43 -47
  7. data/lib/iron_titan/api_client.rb +48 -8
  8. data/lib/iron_titan/api_error.rb +12 -1
  9. data/lib/iron_titan/configuration.rb +23 -0
  10. data/lib/iron_titan/models/complete.rb +63 -27
  11. data/lib/iron_titan/models/error.rb +59 -21
  12. data/lib/iron_titan/models/error_body.rb +61 -24
  13. data/lib/iron_titan/models/group.rb +112 -28
  14. data/lib/iron_titan/models/group_wrapper.rb +60 -21
  15. data/lib/iron_titan/models/groups_wrapper.rb +60 -21
  16. data/lib/iron_titan/models/id_status.rb +89 -28
  17. data/lib/iron_titan/models/job.rb +168 -90
  18. data/lib/iron_titan/models/job_wrapper.rb +60 -21
  19. data/lib/iron_titan/models/jobs_wrapper.rb +62 -24
  20. data/lib/iron_titan/models/new_job.rb +91 -42
  21. data/lib/iron_titan/models/new_jobs_wrapper.rb +60 -21
  22. data/lib/iron_titan/models/start.rb +59 -21
  23. data/lib/iron_titan/version.rb +13 -2
  24. data/lib/iron_titan.rb +12 -1
  25. data/spec/api/groups_api_spec.rb +16 -17
  26. data/spec/api/jobs_api_spec.rb +37 -78
  27. data/spec/api/runner_api_spec.rb +20 -21
  28. data/spec/api_client_spec.rb +296 -0
  29. data/spec/configuration_spec.rb +48 -0
  30. data/spec/models/complete_spec.rb +16 -17
  31. data/spec/models/error_body_spec.rb +15 -12
  32. data/spec/models/error_spec.rb +14 -7
  33. data/spec/models/group_spec.rb +33 -12
  34. data/spec/models/group_wrapper_spec.rb +14 -7
  35. data/spec/models/groups_wrapper_spec.rb +14 -7
  36. data/spec/models/id_status_spec.rb +18 -12
  37. data/spec/models/job_spec.rb +43 -88
  38. data/spec/models/job_wrapper_spec.rb +14 -7
  39. data/spec/models/jobs_wrapper_spec.rb +15 -12
  40. data/spec/models/new_job_spec.rb +20 -37
  41. data/spec/models/new_jobs_wrapper_spec.rb +14 -7
  42. data/spec/models/start_spec.rb +14 -7
  43. data/spec/spec_helper.rb +122 -0
  44. metadata +9 -2
@@ -3,10 +3,21 @@ Titan API
3
3
 
4
4
  The ultimate, language agnostic, container based job processing framework.
5
5
 
6
- OpenAPI spec version: 0.3.10
6
+ OpenAPI spec version: 0.4.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
 
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -28,12 +39,12 @@ module IronTitan
28
39
  # @param [Hash] opts the optional parameters
29
40
  # @return [JobWrapper]
30
41
  def groups_name_jobs_id_error_post(name, id, body, opts = {})
31
- data, status_code, headers = groups_name_jobs_id_error_post_with_http_info(name, id, body, opts)
42
+ data, _status_code, _headers = groups_name_jobs_id_error_post_with_http_info(name, id, body, opts)
32
43
  return data
33
44
  end
34
45
 
35
46
  # Mark job as failed.
36
- # Job is marked as failed if it was in a valid state. Job's `finished_at` time is initialized.
47
+ # Job is marked as failed if it was in a valid state. Job's `finished_at` time is initialized.
37
48
  # @param name Name of group for this set of jobs.
38
49
  # @param id Job id
39
50
  # @param body
@@ -41,18 +52,14 @@ module IronTitan
41
52
  # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers
42
53
  def groups_name_jobs_id_error_post_with_http_info(name, id, body, opts = {})
43
54
  if @api_client.config.debugging
44
- @api_client.config.logger.debug "Calling API: RunnerApi#groups_name_jobs_id_error_post ..."
55
+ @api_client.config.logger.debug "Calling API: RunnerApi.groups_name_jobs_id_error_post ..."
45
56
  end
46
-
47
57
  # verify the required parameter 'name' is set
48
- fail "Missing the required parameter 'name' when calling groups_name_jobs_id_error_post" if name.nil?
49
-
58
+ fail ArgumentError, "Missing the required parameter 'name' when calling RunnerApi.groups_name_jobs_id_error_post" if name.nil?
50
59
  # verify the required parameter 'id' is set
51
- fail "Missing the required parameter 'id' when calling groups_name_jobs_id_error_post" if id.nil?
52
-
60
+ fail ArgumentError, "Missing the required parameter 'id' when calling RunnerApi.groups_name_jobs_id_error_post" if id.nil?
53
61
  # verify the required parameter 'body' is set
54
- fail "Missing the required parameter 'body' when calling groups_name_jobs_id_error_post" if body.nil?
55
-
62
+ fail ArgumentError, "Missing the required parameter 'body' when calling RunnerApi.groups_name_jobs_id_error_post" if body.nil?
56
63
  # resource path
57
64
  local_var_path = "/groups/{name}/jobs/{id}/error".sub('{format}','json').sub('{' + 'name' + '}', name.to_s).sub('{' + 'id' + '}', id.to_s)
58
65
 
@@ -63,19 +70,18 @@ module IronTitan
63
70
  header_params = {}
64
71
 
65
72
  # HTTP header 'Accept' (if needed)
66
- _header_accept = ['application/json']
67
- _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
73
+ local_header_accept = ['application/json']
74
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
68
75
 
69
76
  # HTTP header 'Content-Type'
70
- _header_content_type = ['application/json']
71
- header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
77
+ local_header_content_type = ['application/json']
78
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
72
79
 
73
80
  # form parameters
74
81
  form_params = {}
75
82
 
76
83
  # http body (model)
77
84
  post_body = @api_client.object_to_http_body(body)
78
-
79
85
  auth_names = []
80
86
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
81
87
  :header_params => header_params,
@@ -98,12 +104,12 @@ module IronTitan
98
104
  # @param [Hash] opts the optional parameters
99
105
  # @return [JobWrapper]
100
106
  def groups_name_jobs_id_start_post(name, id, body, opts = {})
101
- data, status_code, headers = groups_name_jobs_id_start_post_with_http_info(name, id, body, opts)
107
+ data, _status_code, _headers = groups_name_jobs_id_start_post_with_http_info(name, id, body, opts)
102
108
  return data
103
109
  end
104
110
 
105
- # Mark job as started, ie: status = &#39;running&#39;
106
- # Job status is changed to &#39;running&#39; if it was in a valid state before. Job&#39;s `started_at` time is initialized.
111
+ # Mark job as started, ie: status &#x3D; &#39;running&#39;
112
+ # Job status is changed to &#39;running&#39; if it was in a valid state before. Job&#39;s &#x60;started_at&#x60; time is initialized.
107
113
  # @param name Name of group for this set of jobs.
108
114
  # @param id Job id
109
115
  # @param body
@@ -111,18 +117,14 @@ module IronTitan
111
117
  # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers
112
118
  def groups_name_jobs_id_start_post_with_http_info(name, id, body, opts = {})
113
119
  if @api_client.config.debugging
114
- @api_client.config.logger.debug "Calling API: RunnerApi#groups_name_jobs_id_start_post ..."
120
+ @api_client.config.logger.debug "Calling API: RunnerApi.groups_name_jobs_id_start_post ..."
115
121
  end
116
-
117
122
  # verify the required parameter 'name' is set
118
- fail "Missing the required parameter 'name' when calling groups_name_jobs_id_start_post" if name.nil?
119
-
123
+ fail ArgumentError, "Missing the required parameter 'name' when calling RunnerApi.groups_name_jobs_id_start_post" if name.nil?
120
124
  # verify the required parameter 'id' is set
121
- fail "Missing the required parameter 'id' when calling groups_name_jobs_id_start_post" if id.nil?
122
-
125
+ fail ArgumentError, "Missing the required parameter 'id' when calling RunnerApi.groups_name_jobs_id_start_post" if id.nil?
123
126
  # verify the required parameter 'body' is set
124
- fail "Missing the required parameter 'body' when calling groups_name_jobs_id_start_post" if body.nil?
125
-
127
+ fail ArgumentError, "Missing the required parameter 'body' when calling RunnerApi.groups_name_jobs_id_start_post" if body.nil?
126
128
  # resource path
127
129
  local_var_path = "/groups/{name}/jobs/{id}/start".sub('{format}','json').sub('{' + 'name' + '}', name.to_s).sub('{' + 'id' + '}', id.to_s)
128
130
 
@@ -133,19 +135,18 @@ module IronTitan
133
135
  header_params = {}
134
136
 
135
137
  # HTTP header 'Accept' (if needed)
136
- _header_accept = ['application/json']
137
- _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
138
+ local_header_accept = ['application/json']
139
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
138
140
 
139
141
  # HTTP header 'Content-Type'
140
- _header_content_type = ['application/json']
141
- header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
142
+ local_header_content_type = ['application/json']
143
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
142
144
 
143
145
  # form parameters
144
146
  form_params = {}
145
147
 
146
148
  # http body (model)
147
149
  post_body = @api_client.object_to_http_body(body)
148
-
149
150
  auth_names = []
150
151
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
151
152
  :header_params => header_params,
@@ -168,12 +169,12 @@ module IronTitan
168
169
  # @param [Hash] opts the optional parameters
169
170
  # @return [JobWrapper]
170
171
  def groups_name_jobs_id_success_post(name, id, body, opts = {})
171
- data, status_code, headers = groups_name_jobs_id_success_post_with_http_info(name, id, body, opts)
172
+ data, _status_code, _headers = groups_name_jobs_id_success_post_with_http_info(name, id, body, opts)
172
173
  return data
173
174
  end
174
175
 
175
176
  # Mark job as succeeded.
176
- # Job status is changed to succeeded if it was in a valid state before. Job&#39;s `completed_at` time is initialized.
177
+ # Job status is changed to succeeded if it was in a valid state before. Job&#39;s &#x60;completed_at&#x60; time is initialized.
177
178
  # @param name Name of group for this set of jobs.
178
179
  # @param id Job id
179
180
  # @param body
@@ -181,18 +182,14 @@ module IronTitan
181
182
  # @return [Array<(JobWrapper, Fixnum, Hash)>] JobWrapper data, response status code and response headers
182
183
  def groups_name_jobs_id_success_post_with_http_info(name, id, body, opts = {})
183
184
  if @api_client.config.debugging
184
- @api_client.config.logger.debug "Calling API: RunnerApi#groups_name_jobs_id_success_post ..."
185
+ @api_client.config.logger.debug "Calling API: RunnerApi.groups_name_jobs_id_success_post ..."
185
186
  end
186
-
187
187
  # verify the required parameter 'name' is set
188
- fail "Missing the required parameter 'name' when calling groups_name_jobs_id_success_post" if name.nil?
189
-
188
+ fail ArgumentError, "Missing the required parameter 'name' when calling RunnerApi.groups_name_jobs_id_success_post" if name.nil?
190
189
  # verify the required parameter 'id' is set
191
- fail "Missing the required parameter 'id' when calling groups_name_jobs_id_success_post" if id.nil?
192
-
190
+ fail ArgumentError, "Missing the required parameter 'id' when calling RunnerApi.groups_name_jobs_id_success_post" if id.nil?
193
191
  # verify the required parameter 'body' is set
194
- fail "Missing the required parameter 'body' when calling groups_name_jobs_id_success_post" if body.nil?
195
-
192
+ fail ArgumentError, "Missing the required parameter 'body' when calling RunnerApi.groups_name_jobs_id_success_post" if body.nil?
196
193
  # resource path
197
194
  local_var_path = "/groups/{name}/jobs/{id}/success".sub('{format}','json').sub('{' + 'name' + '}', name.to_s).sub('{' + 'id' + '}', id.to_s)
198
195
 
@@ -203,19 +200,18 @@ module IronTitan
203
200
  header_params = {}
204
201
 
205
202
  # HTTP header 'Accept' (if needed)
206
- _header_accept = ['application/json']
207
- _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
203
+ local_header_accept = ['application/json']
204
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
208
205
 
209
206
  # HTTP header 'Content-Type'
210
- _header_content_type = ['application/json']
211
- header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
207
+ local_header_content_type = ['application/json']
208
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
212
209
 
213
210
  # form parameters
214
211
  form_params = {}
215
212
 
216
213
  # http body (model)
217
214
  post_body = @api_client.object_to_http_body(body)
218
-
219
215
  auth_names = []
220
216
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
221
217
  :header_params => header_params,
@@ -3,10 +3,21 @@ Titan API
3
3
 
4
4
  The ultimate, language agnostic, container based job processing framework.
5
5
 
6
- OpenAPI spec version: 0.3.10
6
+ OpenAPI spec version: 0.4.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
 
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -27,6 +38,8 @@ module IronTitan
27
38
  # @return [Hash]
28
39
  attr_accessor :default_headers
29
40
 
41
+ # Initializes the ApiClient
42
+ # @option config [Configuration] Configuraiton for initializing the object, default to Configuration.default
30
43
  def initialize(config = Configuration.default)
31
44
  @config = config
32
45
  @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
@@ -67,6 +80,15 @@ module IronTitan
67
80
  return data, response.code, response.headers
68
81
  end
69
82
 
83
+ # Builds the HTTP request
84
+ #
85
+ # @param [String] http_method HTTP method/verb (e.g. POST)
86
+ # @param [String] path URL path (e.g. /account/new)
87
+ # @option opts [Hash] :header_params Header parameters
88
+ # @option opts [Hash] :query_params Query parameters
89
+ # @option opts [Hash] :form_params Query parameters
90
+ # @option opts [Object] :body HTTP body (JSON/XML)
91
+ # @return [Typhoeus::Request] A Typhoeus Request
70
92
  def build_request(http_method, path, opts = {})
71
93
  url = build_request_url(path)
72
94
  http_method = http_method.to_sym.downcase
@@ -75,7 +97,6 @@ module IronTitan
75
97
  query_params = opts[:query_params] || {}
76
98
  form_params = opts[:form_params] || {}
77
99
 
78
-
79
100
 
80
101
  req_opts = {
81
102
  :method => http_method,
@@ -106,12 +127,15 @@ module IronTitan
106
127
  # application/json
107
128
  # application/json; charset=UTF8
108
129
  # APPLICATION/JSON
130
+ # @param [String] mime MIME
131
+ # @return [Boolean] True if the MIME is applicaton/json
109
132
  def json_mime?(mime)
110
- !!(mime =~ /\Aapplication\/json(;.*)?\z/i)
133
+ !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
111
134
  end
112
135
 
113
136
  # Deserialize the response to the given return type.
114
137
  #
138
+ # @param [Response] response HTTP response
115
139
  # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
116
140
  def deserialize(response, return_type)
117
141
  body = response.body
@@ -142,6 +166,9 @@ module IronTitan
142
166
  end
143
167
 
144
168
  # Convert data to the given return type.
169
+ # @param [Object] data Data to be converted
170
+ # @param [String] return_type Return type
171
+ # @return [Mixed] Data in a particular type
145
172
  def convert_to_type(data, return_type)
146
173
  return nil if data.nil?
147
174
  case return_type
@@ -214,7 +241,7 @@ module IronTitan
214
241
  # @param [String] filename the filename to be sanitized
215
242
  # @return [String] the sanitized filename
216
243
  def sanitize_filename(filename)
217
- filename.gsub /.*[\/\\]/, ''
244
+ filename.gsub(/.*[\/\\]/, '')
218
245
  end
219
246
 
220
247
  def build_request_url(path)
@@ -223,6 +250,12 @@ module IronTitan
223
250
  URI.encode(@config.base_url + path)
224
251
  end
225
252
 
253
+ # Builds the HTTP request body
254
+ #
255
+ # @param [Hash] header_params Header parameters
256
+ # @param [Hash] form_params Query parameters
257
+ # @param [Object] body HTTP body (JSON/XML)
258
+ # @return [String] HTTP body data in the form of string
226
259
  def build_request_body(header_params, form_params, body)
227
260
  # http form
228
261
  if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
@@ -246,6 +279,10 @@ module IronTitan
246
279
  end
247
280
 
248
281
  # Update hearder and query params based on authentication settings.
282
+ #
283
+ # @param [Hash] header_params Header parameters
284
+ # @param [Hash] form_params Query parameters
285
+ # @param [String] auth_names Authentication scheme name
249
286
  def update_params_for_auth!(header_params, query_params, auth_names)
250
287
  Array(auth_names).each do |auth_name|
251
288
  auth_setting = @config.auth_settings[auth_name]
@@ -258,6 +295,9 @@ module IronTitan
258
295
  end
259
296
  end
260
297
 
298
+ # Sets user agent in HTTP header
299
+ #
300
+ # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
261
301
  def user_agent=(user_agent)
262
302
  @user_agent = user_agent
263
303
  @default_headers['User-Agent'] = @user_agent
@@ -289,13 +329,13 @@ module IronTitan
289
329
  # @return [String] JSON string representation of the object
290
330
  def object_to_http_body(model)
291
331
  return model if model.nil? || model.is_a?(String)
292
- _body = nil
332
+ local_body = nil
293
333
  if model.is_a?(Array)
294
- _body = model.map{|m| object_to_hash(m) }
334
+ local_body = model.map{|m| object_to_hash(m) }
295
335
  else
296
- _body = object_to_hash(model)
336
+ local_body = object_to_hash(model)
297
337
  end
298
- _body.to_json
338
+ local_body.to_json
299
339
  end
300
340
 
301
341
  # Convert object(non-array) to hash.
@@ -3,10 +3,21 @@ Titan API
3
3
 
4
4
  The ultimate, language agnostic, container based job processing framework.
5
5
 
6
- OpenAPI spec version: 0.3.10
6
+ OpenAPI spec version: 0.4.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
 
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
@@ -1,3 +1,26 @@
1
+ =begin
2
+ Titan API
3
+
4
+ The ultimate, language agnostic, container based job processing framework.
5
+
6
+ OpenAPI spec version: 0.4.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
1
24
  require 'uri'
2
25
 
3
26
  module IronTitan
@@ -3,16 +3,28 @@ Titan API
3
3
 
4
4
  The ultimate, language agnostic, container based job processing framework.
5
5
 
6
- OpenAPI spec version: 0.3.10
6
+ OpenAPI spec version: 0.4.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
 
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
10
21
 
11
22
  =end
12
23
 
13
24
  require 'date'
14
25
 
15
26
  module IronTitan
27
+
16
28
  class Complete
17
29
  # Time when job was completed. Always in UTC.
18
30
  attr_accessor :completed_at
@@ -23,16 +35,13 @@ module IronTitan
23
35
  # Error message, if status=error. Only used by the /error endpoint.
24
36
  attr_accessor :error
25
37
 
38
+
26
39
  # Attribute mapping from ruby-style variable name to JSON key.
27
40
  def self.attribute_map
28
41
  {
29
-
30
42
  :'completed_at' => :'completed_at',
31
-
32
43
  :'reason' => :'reason',
33
-
34
44
  :'error' => :'error'
35
-
36
45
  }
37
46
  end
38
47
 
@@ -42,32 +51,46 @@ module IronTitan
42
51
  :'completed_at' => :'DateTime',
43
52
  :'reason' => :'String',
44
53
  :'error' => :'String'
45
-
46
54
  }
47
55
  end
48
56
 
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
49
59
  def initialize(attributes = {})
50
60
  return unless attributes.is_a?(Hash)
51
61
 
52
62
  # convert string to symbol for hash key
53
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
63
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
54
64
 
55
-
56
- if attributes[:'completed_at']
65
+ if attributes.has_key?(:'completed_at')
57
66
  self.completed_at = attributes[:'completed_at']
58
67
  end
59
-
60
- if attributes[:'reason']
68
+
69
+ if attributes.has_key?(:'reason')
61
70
  self.reason = attributes[:'reason']
62
71
  end
63
-
64
- if attributes[:'error']
72
+
73
+ if attributes.has_key?(:'error')
65
74
  self.error = attributes[:'error']
66
75
  end
67
-
76
+
68
77
  end
69
78
 
70
- # Check equality by comparing each attribute.
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properies with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ return invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
71
94
  def ==(o)
72
95
  return true if self.equal?(o)
73
96
  self.class == o.class &&
@@ -77,35 +100,41 @@ module IronTitan
77
100
  end
78
101
 
79
102
  # @see the `==` method
103
+ # @param [Object] Object to be compared
80
104
  def eql?(o)
81
105
  self == o
82
106
  end
83
107
 
84
- # Calculate hash code according to all attributes.
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Fixnum] Hash code
85
110
  def hash
86
111
  [completed_at, reason, error].hash
87
112
  end
88
113
 
89
- # build the object from hash
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
90
117
  def build_from_hash(attributes)
91
118
  return nil unless attributes.is_a?(Hash)
92
119
  self.class.swagger_types.each_pair do |key, type|
93
120
  if type =~ /^Array<(.*)>/i
121
+ # check to ensure the input is an array given that the the attribute
122
+ # is documented as an array but the input is not
94
123
  if attributes[self.class.attribute_map[key]].is_a?(Array)
95
124
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
96
- else
97
- #TODO show warning in debug mode
98
125
  end
99
126
  elsif !attributes[self.class.attribute_map[key]].nil?
100
127
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
101
- else
102
- # data not found in attributes(hash), not an issue as the data can be optional
103
- end
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
104
129
  end
105
130
 
106
131
  self
107
132
  end
108
133
 
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
109
138
  def _deserialize(type, value)
110
139
  case type.to_sym
111
140
  when :DateTime
@@ -139,21 +168,25 @@ module IronTitan
139
168
  end
140
169
  end
141
170
  else # model
142
- _model = IronTitan.const_get(type).new
143
- _model.build_from_hash(value)
171
+ temp_model = IronTitan.const_get(type).new
172
+ temp_model.build_from_hash(value)
144
173
  end
145
174
  end
146
175
 
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
147
178
  def to_s
148
179
  to_hash.to_s
149
180
  end
150
181
 
151
- # to_body is an alias to to_body (backward compatibility))
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
152
184
  def to_body
153
185
  to_hash
154
186
  end
155
187
 
156
- # return the object in the form of hash
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
157
190
  def to_hash
158
191
  hash = {}
159
192
  self.class.attribute_map.each_pair do |attr, param|
@@ -164,8 +197,10 @@ module IronTitan
164
197
  hash
165
198
  end
166
199
 
167
- # Method to output non-array value in the form of hash
200
+ # Outputs non-array value in the form of hash
168
201
  # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
169
204
  def _to_hash(value)
170
205
  if value.is_a?(Array)
171
206
  value.compact.map{ |v| _to_hash(v) }
@@ -181,4 +216,5 @@ module IronTitan
181
216
  end
182
217
 
183
218
  end
219
+
184
220
  end