dkron-rb 0.9.2 → 0.10.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +30 -28
  4. data/README.md +13 -8
  5. data/Rakefile +9 -3
  6. data/config.json +1 -1
  7. data/dkron-rb.gemspec +8 -17
  8. data/docs/DefaultApi.md +1 -1
  9. data/docs/ExecutionsApi.md +1 -1
  10. data/docs/ExecutorConfig.md +7 -0
  11. data/docs/ExecutorShell.md +10 -0
  12. data/docs/Job.md +5 -4
  13. data/docs/Member.md +3 -3
  14. data/docs/ProcessorFiles.md +9 -0
  15. data/docs/ProcessorLog.md +8 -0
  16. data/docs/ProcessorSyslog.md +8 -0
  17. data/docs/Processors.md +7 -0
  18. data/git_push.sh +1 -13
  19. data/lib/dkron-rb.rb +10 -4
  20. data/lib/dkron-rb/api/default_api.rb +13 -36
  21. data/lib/dkron-rb/api/executions_api.rb +8 -21
  22. data/lib/dkron-rb/api/jobs_api.rb +29 -52
  23. data/lib/dkron-rb/api/members_api.rb +5 -20
  24. data/lib/dkron-rb/api_client.rb +55 -45
  25. data/lib/dkron-rb/api_error.rb +9 -18
  26. data/lib/dkron-rb/configuration.rb +8 -13
  27. data/lib/dkron-rb/models/execution.rb +6 -17
  28. data/lib/dkron-rb/models/executor_config.rb +179 -0
  29. data/lib/dkron-rb/models/executor_shell.rb +208 -0
  30. data/lib/dkron-rb/models/job.rb +48 -46
  31. data/lib/dkron-rb/models/member.rb +10 -20
  32. data/lib/dkron-rb/models/processor_files.rb +198 -0
  33. data/lib/dkron-rb/models/processor_log.rb +189 -0
  34. data/lib/dkron-rb/models/processor_syslog.rb +189 -0
  35. data/lib/dkron-rb/models/processors.rb +179 -0
  36. data/lib/dkron-rb/models/status.rb +6 -17
  37. data/lib/dkron-rb/version.rb +3 -14
  38. data/pkg/dkron-rb-0.9.2.gem +0 -0
  39. data/seeds.rb +5 -2
  40. data/spec/models/executor_config_spec.rb +36 -0
  41. data/spec/models/executor_shell_spec.rb +54 -0
  42. data/spec/models/processor_files_spec.rb +48 -0
  43. data/spec/models/processor_log_spec.rb +42 -0
  44. data/spec/models/processor_syslog_spec.rb +42 -0
  45. data/spec/models/processors_spec.rb +36 -0
  46. metadata +46 -25
  47. data/dkron-rb-0.0.1.gem +0 -0
  48. data/dkron-rb-0.0.2.gem +0 -0
@@ -3,21 +3,10 @@
3
3
 
4
4
  #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
5
 
6
- OpenAPI spec version: 0.9.2
6
+ OpenAPI spec version: 0.10.0
7
7
 
8
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.
9
+ Swagger Codegen version: 2.3.1
21
10
 
22
11
  =end
23
12
 
@@ -51,23 +40,21 @@ module Dkron
51
40
  @api_client.config.logger.debug "Calling API: ExecutionsApi.list_executions_by_job ..."
52
41
  end
53
42
  # verify the required parameter 'job_name' is set
54
- fail ArgumentError, "Missing the required parameter 'job_name' when calling ExecutionsApi.list_executions_by_job" if job_name.nil?
43
+ if @api_client.config.client_side_validation && job_name.nil?
44
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling ExecutionsApi.list_executions_by_job"
45
+ end
55
46
  # resource path
56
- local_var_path = "/executions/{job_name}".sub('{format}','json').sub('{' + 'job_name' + '}', job_name.to_s)
47
+ local_var_path = "/jobs/{job_name}/executions".sub('{' + 'job_name' + '}', job_name.to_s)
57
48
 
58
49
  # query parameters
59
50
  query_params = {}
60
51
 
61
52
  # header parameters
62
53
  header_params = {}
63
-
64
54
  # HTTP header 'Accept' (if needed)
65
- local_header_accept = ['application/json']
66
- local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
67
-
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
68
56
  # HTTP header 'Content-Type'
69
- local_header_content_type = ['application/json']
70
- header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
57
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
71
58
 
72
59
  # form parameters
73
60
  form_params = {}
@@ -3,21 +3,10 @@
3
3
 
4
4
  #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
5
 
6
- OpenAPI spec version: 0.9.2
6
+ OpenAPI spec version: 0.10.0
7
7
 
8
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.
9
+ Swagger Codegen version: 2.3.1
21
10
 
22
11
  =end
23
12
 
@@ -51,23 +40,21 @@ module Dkron
51
40
  @api_client.config.logger.debug "Calling API: JobsApi.create_or_update_job ..."
52
41
  end
53
42
  # verify the required parameter 'body' is set
54
- fail ArgumentError, "Missing the required parameter 'body' when calling JobsApi.create_or_update_job" if body.nil?
43
+ if @api_client.config.client_side_validation && body.nil?
44
+ fail ArgumentError, "Missing the required parameter 'body' when calling JobsApi.create_or_update_job"
45
+ end
55
46
  # resource path
56
- local_var_path = "/jobs".sub('{format}','json')
47
+ local_var_path = "/jobs"
57
48
 
58
49
  # query parameters
59
50
  query_params = {}
60
51
 
61
52
  # header parameters
62
53
  header_params = {}
63
-
64
54
  # HTTP header 'Accept' (if needed)
65
- local_header_accept = ['application/json']
66
- local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
67
-
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
68
56
  # HTTP header 'Content-Type'
69
- local_header_content_type = ['application/json']
70
- header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
57
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
71
58
 
72
59
  # form parameters
73
60
  form_params = {}
@@ -108,23 +95,21 @@ module Dkron
108
95
  @api_client.config.logger.debug "Calling API: JobsApi.delete_job ..."
109
96
  end
110
97
  # verify the required parameter 'job_name' is set
111
- fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.delete_job" if job_name.nil?
98
+ if @api_client.config.client_side_validation && job_name.nil?
99
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.delete_job"
100
+ end
112
101
  # resource path
113
- local_var_path = "/jobs/{job_name}".sub('{format}','json').sub('{' + 'job_name' + '}', job_name.to_s)
102
+ local_var_path = "/jobs/{job_name}".sub('{' + 'job_name' + '}', job_name.to_s)
114
103
 
115
104
  # query parameters
116
105
  query_params = {}
117
106
 
118
107
  # header parameters
119
108
  header_params = {}
120
-
121
109
  # HTTP header 'Accept' (if needed)
122
- local_header_accept = ['application/json']
123
- local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
124
-
110
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
111
  # HTTP header 'Content-Type'
126
- local_header_content_type = ['application/json']
127
- header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
112
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
128
113
 
129
114
  # form parameters
130
115
  form_params = {}
@@ -163,21 +148,17 @@ module Dkron
163
148
  @api_client.config.logger.debug "Calling API: JobsApi.get_jobs ..."
164
149
  end
165
150
  # resource path
166
- local_var_path = "/jobs".sub('{format}','json')
151
+ local_var_path = "/jobs"
167
152
 
168
153
  # query parameters
169
154
  query_params = {}
170
155
 
171
156
  # header parameters
172
157
  header_params = {}
173
-
174
158
  # HTTP header 'Accept' (if needed)
175
- local_header_accept = ['application/json']
176
- local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
177
-
159
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
178
160
  # HTTP header 'Content-Type'
179
- local_header_content_type = ['application/json']
180
- header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
161
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
181
162
 
182
163
  # form parameters
183
164
  form_params = {}
@@ -218,23 +199,21 @@ module Dkron
218
199
  @api_client.config.logger.debug "Calling API: JobsApi.run_job ..."
219
200
  end
220
201
  # verify the required parameter 'job_name' is set
221
- fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.run_job" if job_name.nil?
202
+ if @api_client.config.client_side_validation && job_name.nil?
203
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.run_job"
204
+ end
222
205
  # resource path
223
- local_var_path = "/jobs/{job_name}".sub('{format}','json').sub('{' + 'job_name' + '}', job_name.to_s)
206
+ local_var_path = "/jobs/{job_name}".sub('{' + 'job_name' + '}', job_name.to_s)
224
207
 
225
208
  # query parameters
226
209
  query_params = {}
227
210
 
228
211
  # header parameters
229
212
  header_params = {}
230
-
231
213
  # HTTP header 'Accept' (if needed)
232
- local_header_accept = ['application/json']
233
- local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
234
-
214
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
235
215
  # HTTP header 'Content-Type'
236
- local_header_content_type = ['application/json']
237
- header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
216
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
238
217
 
239
218
  # form parameters
240
219
  form_params = {}
@@ -275,23 +254,21 @@ module Dkron
275
254
  @api_client.config.logger.debug "Calling API: JobsApi.show_job_by_name ..."
276
255
  end
277
256
  # verify the required parameter 'job_name' is set
278
- fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.show_job_by_name" if job_name.nil?
257
+ if @api_client.config.client_side_validation && job_name.nil?
258
+ fail ArgumentError, "Missing the required parameter 'job_name' when calling JobsApi.show_job_by_name"
259
+ end
279
260
  # resource path
280
- local_var_path = "/jobs/{job_name}".sub('{format}','json').sub('{' + 'job_name' + '}', job_name.to_s)
261
+ local_var_path = "/jobs/{job_name}".sub('{' + 'job_name' + '}', job_name.to_s)
281
262
 
282
263
  # query parameters
283
264
  query_params = {}
284
265
 
285
266
  # header parameters
286
267
  header_params = {}
287
-
288
268
  # HTTP header 'Accept' (if needed)
289
- local_header_accept = ['application/json']
290
- local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
291
-
269
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
292
270
  # HTTP header 'Content-Type'
293
- local_header_content_type = ['application/json']
294
- header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
271
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
295
272
 
296
273
  # form parameters
297
274
  form_params = {}
@@ -3,21 +3,10 @@
3
3
 
4
4
  #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
5
 
6
- OpenAPI spec version: 0.9.2
6
+ OpenAPI spec version: 0.10.0
7
7
 
8
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.
9
+ Swagger Codegen version: 2.3.1
21
10
 
22
11
  =end
23
12
 
@@ -49,21 +38,17 @@ module Dkron
49
38
  @api_client.config.logger.debug "Calling API: MembersApi.get_member ..."
50
39
  end
51
40
  # resource path
52
- local_var_path = "/members".sub('{format}','json')
41
+ local_var_path = "/members"
53
42
 
54
43
  # query parameters
55
44
  query_params = {}
56
45
 
57
46
  # header parameters
58
47
  header_params = {}
59
-
60
48
  # HTTP header 'Accept' (if needed)
61
- local_header_accept = ['application/json']
62
- local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
63
-
49
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
64
50
  # HTTP header 'Content-Type'
65
- local_header_content_type = ['application/json']
66
- header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
51
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
67
52
 
68
53
  # form parameters
69
54
  form_params = {}
@@ -3,21 +3,10 @@
3
3
 
4
4
  #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
5
 
6
- OpenAPI spec version: 0.9.2
6
+ OpenAPI spec version: 0.10.0
7
7
 
8
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.
9
+ Swagger Codegen version: 2.3.1
21
10
 
22
11
  =end
23
12
 
@@ -66,10 +55,18 @@ module Dkron
66
55
  end
67
56
 
68
57
  unless response.success?
69
- fail ApiError.new(:code => response.code,
70
- :response_headers => response.headers,
71
- :response_body => response.body),
72
- response.status_message
58
+ if response.timed_out?
59
+ fail ApiError.new('Connection timed out')
60
+ elsif response.code == 0
61
+ # Errors from libcurl will be made visible here
62
+ fail ApiError.new(:code => 0,
63
+ :message => response.return_message)
64
+ else
65
+ fail ApiError.new(:code => response.code,
66
+ :response_headers => response.headers,
67
+ :response_body => response.body),
68
+ response.status_message
69
+ end
73
70
  end
74
71
 
75
72
  if opts[:return_type]
@@ -125,7 +122,9 @@ module Dkron
125
122
  end
126
123
  end
127
124
 
128
- Typhoeus::Request.new(url, req_opts)
125
+ request = Typhoeus::Request.new(url, req_opts)
126
+ download_file(request) if opts[:return_type] == 'File'
127
+ request
129
128
  end
130
129
 
131
130
  # Check if the given MIME is a JSON MIME.
@@ -133,10 +132,11 @@ module Dkron
133
132
  # application/json
134
133
  # application/json; charset=UTF8
135
134
  # APPLICATION/JSON
135
+ # */*
136
136
  # @param [String] mime MIME
137
- # @return [Boolean] True if the MIME is applicaton/json
137
+ # @return [Boolean] True if the MIME is application/json
138
138
  def json_mime?(mime)
139
- !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
139
+ (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
140
140
  end
141
141
 
142
142
  # Deserialize the response to the given return type.
@@ -145,14 +145,16 @@ module Dkron
145
145
  # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
146
146
  def deserialize(response, return_type)
147
147
  body = response.body
148
+
149
+ # handle file downloading - return the File instance processed in request callbacks
150
+ # note that response body is empty when the file is written in chunks in request on_body callback
151
+ return @tempfile if return_type == 'File'
152
+
148
153
  return nil if body.nil? || body.empty?
149
154
 
150
155
  # return response body directly for String return type
151
156
  return body if return_type == 'String'
152
157
 
153
- # handle file downloading - save response body into a tmp file and return the File instance
154
- return download_file(response) if return_type == 'File'
155
-
156
158
  # ensuring a default content type
157
159
  content_type = response.headers['Content-Type'] || 'application/json'
158
160
 
@@ -215,30 +217,38 @@ module Dkron
215
217
 
216
218
  # Save response body into a file in (the defined) temporary folder, using the filename
217
219
  # from the "Content-Disposition" header if provided, otherwise a random filename.
220
+ # The response body is written to the file in chunks in order to handle files which
221
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
222
+ # process can use.
218
223
  #
219
224
  # @see Configuration#temp_folder_path
220
- # @return [Tempfile] the file downloaded
221
- def download_file(response)
222
- content_disposition = response.headers['Content-Disposition']
223
- if content_disposition and content_disposition =~ /filename=/i
224
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
225
- prefix = sanitize_filename(filename)
226
- else
227
- prefix = 'download-'
228
- end
229
- prefix = prefix + '-' unless prefix.end_with?('-')
230
-
225
+ def download_file(request)
231
226
  tempfile = nil
232
- encoding = response.body.encoding
233
- Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) do |file|
234
- file.write(response.body)
235
- tempfile = file
227
+ encoding = nil
228
+ request.on_headers do |response|
229
+ content_disposition = response.headers['Content-Disposition']
230
+ if content_disposition and content_disposition =~ /filename=/i
231
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
232
+ prefix = sanitize_filename(filename)
233
+ else
234
+ prefix = 'download-'
235
+ end
236
+ prefix = prefix + '-' unless prefix.end_with?('-')
237
+ encoding = response.body.encoding
238
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
239
+ @tempfile = tempfile
240
+ end
241
+ request.on_body do |chunk|
242
+ chunk.force_encoding(encoding)
243
+ tempfile.write(chunk)
244
+ end
245
+ request.on_complete do |response|
246
+ tempfile.close
247
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
248
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
249
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
250
+ "explicitly with `tempfile.delete`"
236
251
  end
237
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
238
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
239
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
240
- "explicitly with `tempfile.delete`"
241
- tempfile
242
252
  end
243
253
 
244
254
  # Sanitize filename by removing path.
@@ -269,7 +279,7 @@ module Dkron
269
279
  data = {}
270
280
  form_params.each do |key, value|
271
281
  case value
272
- when File, Array, nil
282
+ when ::File, ::Array, nil
273
283
  # let typhoeus handle File, Array and nil parameters
274
284
  data[key] = value
275
285
  else
@@ -287,7 +297,7 @@ module Dkron
287
297
  # Update hearder and query params based on authentication settings.
288
298
  #
289
299
  # @param [Hash] header_params Header parameters
290
- # @param [Hash] form_params Query parameters
300
+ # @param [Hash] query_params Query parameters
291
301
  # @param [String] auth_names Authentication scheme name
292
302
  def update_params_for_auth!(header_params, query_params, auth_names)
293
303
  Array(auth_names).each do |auth_name|
@@ -3,21 +3,10 @@
3
3
 
4
4
  #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response.
5
5
 
6
- OpenAPI spec version: 0.9.2
6
+ OpenAPI spec version: 0.10.0
7
7
 
8
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.
9
+ Swagger Codegen version: 2.3.1
21
10
 
22
11
  =end
23
12
 
@@ -32,12 +21,14 @@ module Dkron
32
21
  # ApiError.new(:code => 404, :message => "Not Found")
33
22
  def initialize(arg = nil)
34
23
  if arg.is_a? Hash
24
+ if arg.key?(:message) || arg.key?('message')
25
+ super(arg[:message] || arg['message'])
26
+ else
27
+ super arg
28
+ end
29
+
35
30
  arg.each do |k, v|
36
- if k.to_s == 'message'
37
- super v
38
- else
39
- instance_variable_set "@#{k}", v
40
- end
31
+ instance_variable_set "@#{k}", v
41
32
  end
42
33
  else
43
34
  super arg