iron_titan 0.3.10 → 0.4.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.
- checksums.yaml +4 -4
- data/LICENSE +201 -0
- data/README.md +6 -5
- data/lib/iron_titan/api/groups_api.rb +34 -31
- data/lib/iron_titan/api/jobs_api.rb +140 -182
- data/lib/iron_titan/api/runner_api.rb +43 -47
- data/lib/iron_titan/api_client.rb +48 -8
- data/lib/iron_titan/api_error.rb +12 -1
- data/lib/iron_titan/configuration.rb +23 -0
- data/lib/iron_titan/models/complete.rb +63 -27
- data/lib/iron_titan/models/error.rb +59 -21
- data/lib/iron_titan/models/error_body.rb +61 -24
- data/lib/iron_titan/models/group.rb +112 -28
- data/lib/iron_titan/models/group_wrapper.rb +60 -21
- data/lib/iron_titan/models/groups_wrapper.rb +60 -21
- data/lib/iron_titan/models/id_status.rb +89 -28
- data/lib/iron_titan/models/job.rb +168 -90
- data/lib/iron_titan/models/job_wrapper.rb +60 -21
- data/lib/iron_titan/models/jobs_wrapper.rb +62 -24
- data/lib/iron_titan/models/new_job.rb +91 -42
- data/lib/iron_titan/models/new_jobs_wrapper.rb +60 -21
- data/lib/iron_titan/models/start.rb +59 -21
- data/lib/iron_titan/version.rb +13 -2
- data/lib/iron_titan.rb +12 -1
- data/spec/api/groups_api_spec.rb +16 -17
- data/spec/api/jobs_api_spec.rb +37 -78
- data/spec/api/runner_api_spec.rb +20 -21
- data/spec/api_client_spec.rb +296 -0
- data/spec/configuration_spec.rb +48 -0
- data/spec/models/complete_spec.rb +16 -17
- data/spec/models/error_body_spec.rb +15 -12
- data/spec/models/error_spec.rb +14 -7
- data/spec/models/group_spec.rb +33 -12
- data/spec/models/group_wrapper_spec.rb +14 -7
- data/spec/models/groups_wrapper_spec.rb +14 -7
- data/spec/models/id_status_spec.rb +18 -12
- data/spec/models/job_spec.rb +43 -88
- data/spec/models/job_wrapper_spec.rb +14 -7
- data/spec/models/jobs_wrapper_spec.rb +15 -12
- data/spec/models/new_job_spec.rb +20 -37
- data/spec/models/new_jobs_wrapper_spec.rb +14 -7
- data/spec/models/start_spec.rb +14 -7
- data/spec/spec_helper.rb +122 -0
- metadata +9 -2
@@ -3,29 +3,39 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
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 JobsWrapper
|
17
29
|
attr_accessor :jobs
|
18
30
|
|
19
31
|
attr_accessor :error
|
20
32
|
|
33
|
+
|
21
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
35
|
def self.attribute_map
|
23
36
|
{
|
24
|
-
|
25
37
|
:'jobs' => :'jobs',
|
26
|
-
|
27
38
|
:'error' => :'error'
|
28
|
-
|
29
39
|
}
|
30
40
|
end
|
31
41
|
|
@@ -34,30 +44,45 @@ module IronTitan
|
|
34
44
|
{
|
35
45
|
:'jobs' => :'Array<Job>',
|
36
46
|
:'error' => :'ErrorBody'
|
37
|
-
|
38
47
|
}
|
39
48
|
end
|
40
49
|
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
52
|
def initialize(attributes = {})
|
42
53
|
return unless attributes.is_a?(Hash)
|
43
54
|
|
44
55
|
# convert string to symbol for hash key
|
45
|
-
attributes = attributes.
|
56
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
46
57
|
|
47
|
-
|
48
|
-
if attributes[:'jobs']
|
58
|
+
if attributes.has_key?(:'jobs')
|
49
59
|
if (value = attributes[:'jobs']).is_a?(Array)
|
50
60
|
self.jobs = value
|
51
61
|
end
|
52
62
|
end
|
53
|
-
|
54
|
-
if attributes
|
63
|
+
|
64
|
+
if attributes.has_key?(:'error')
|
55
65
|
self.error = attributes[:'error']
|
56
66
|
end
|
57
|
-
|
67
|
+
|
58
68
|
end
|
59
69
|
|
60
|
-
#
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properies with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
return invalid_properties
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the all the properties in the model are valid
|
78
|
+
# @return true if the model is valid
|
79
|
+
def valid?
|
80
|
+
return false if @jobs.nil?
|
81
|
+
return true
|
82
|
+
end
|
83
|
+
|
84
|
+
# Checks equality by comparing each attribute.
|
85
|
+
# @param [Object] Object to be compared
|
61
86
|
def ==(o)
|
62
87
|
return true if self.equal?(o)
|
63
88
|
self.class == o.class &&
|
@@ -66,35 +91,41 @@ module IronTitan
|
|
66
91
|
end
|
67
92
|
|
68
93
|
# @see the `==` method
|
94
|
+
# @param [Object] Object to be compared
|
69
95
|
def eql?(o)
|
70
96
|
self == o
|
71
97
|
end
|
72
98
|
|
73
|
-
#
|
99
|
+
# Calculates hash code according to all attributes.
|
100
|
+
# @return [Fixnum] Hash code
|
74
101
|
def hash
|
75
102
|
[jobs, error].hash
|
76
103
|
end
|
77
104
|
|
78
|
-
#
|
105
|
+
# Builds the object from hash
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
# @return [Object] Returns the model itself
|
79
108
|
def build_from_hash(attributes)
|
80
109
|
return nil unless attributes.is_a?(Hash)
|
81
110
|
self.class.swagger_types.each_pair do |key, type|
|
82
111
|
if type =~ /^Array<(.*)>/i
|
112
|
+
# check to ensure the input is an array given that the the attribute
|
113
|
+
# is documented as an array but the input is not
|
83
114
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
84
115
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
85
|
-
else
|
86
|
-
#TODO show warning in debug mode
|
87
116
|
end
|
88
117
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
89
118
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
90
|
-
else
|
91
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
92
|
-
end
|
119
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
93
120
|
end
|
94
121
|
|
95
122
|
self
|
96
123
|
end
|
97
124
|
|
125
|
+
# Deserializes the data based on type
|
126
|
+
# @param string type Data type
|
127
|
+
# @param string value Value to be deserialized
|
128
|
+
# @return [Object] Deserialized data
|
98
129
|
def _deserialize(type, value)
|
99
130
|
case type.to_sym
|
100
131
|
when :DateTime
|
@@ -128,21 +159,25 @@ module IronTitan
|
|
128
159
|
end
|
129
160
|
end
|
130
161
|
else # model
|
131
|
-
|
132
|
-
|
162
|
+
temp_model = IronTitan.const_get(type).new
|
163
|
+
temp_model.build_from_hash(value)
|
133
164
|
end
|
134
165
|
end
|
135
166
|
|
167
|
+
# Returns the string representation of the object
|
168
|
+
# @return [String] String presentation of the object
|
136
169
|
def to_s
|
137
170
|
to_hash.to_s
|
138
171
|
end
|
139
172
|
|
140
|
-
# to_body is an alias to
|
173
|
+
# to_body is an alias to to_hash (backward compatibility)
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
141
175
|
def to_body
|
142
176
|
to_hash
|
143
177
|
end
|
144
178
|
|
145
|
-
#
|
179
|
+
# Returns the object in the form of hash
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
146
181
|
def to_hash
|
147
182
|
hash = {}
|
148
183
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -153,8 +188,10 @@ module IronTitan
|
|
153
188
|
hash
|
154
189
|
end
|
155
190
|
|
156
|
-
#
|
191
|
+
# Outputs non-array value in the form of hash
|
157
192
|
# For object, use to_hash. Otherwise, just return the value
|
193
|
+
# @param [Object] value Any valid value
|
194
|
+
# @return [Hash] Returns the value in the form of hash
|
158
195
|
def _to_hash(value)
|
159
196
|
if value.is_a?(Array)
|
160
197
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -170,4 +207,5 @@ module IronTitan
|
|
170
207
|
end
|
171
208
|
|
172
209
|
end
|
210
|
+
|
173
211
|
end
|
@@ -3,18 +3,30 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
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 NewJob
|
17
|
-
# Name of image to use.
|
29
|
+
# Name of Docker image to use. This is optional and can be used to override the image defined at the group level.
|
18
30
|
attr_accessor :image
|
19
31
|
|
20
32
|
# Payload for the job. This is what you pass into each job to make it do something.
|
@@ -23,36 +35,29 @@ module IronTitan
|
|
23
35
|
# Number of seconds to wait before queueing the job for consumption for the first time. Must be a positive integer. Jobs with a delay start in state \"delayed\" and transition to \"running\" after delay seconds.
|
24
36
|
attr_accessor :delay
|
25
37
|
|
26
|
-
# Maximum runtime in seconds. If a consumer retrieves the
|
38
|
+
# Maximum runtime in seconds. If a consumer retrieves the job, but does not change it's status within timeout seconds, the job is considered failed, with reason timeout (Titan may allow a small grace period). The consumer should also kill the job after timeout seconds. If a consumer tries to change status after Titan has already timed out the job, the consumer will be ignored.
|
27
39
|
attr_accessor :timeout
|
28
40
|
|
29
41
|
# Priority of the job. Higher has more priority. 3 levels from 0-2. Jobs at same priority are processed in FIFO order.
|
30
42
|
attr_accessor :priority
|
31
43
|
|
32
|
-
# \"Number of automatic retries this job is allowed. A retry will be attempted if a task fails. Max 25. Automatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new job with the same image id and payload. The new job's max_retries is one less than the original. The new job's `retry_of` field is set to the original Job ID. Titan will delay the new job for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried.\"
|
44
|
+
# \"Number of automatic retries this job is allowed. A retry will be attempted if a task fails. Max 25. Automatic retries are performed by titan when a task reaches a failed state and has `max_retries` > 0. A retry is performed by queueing a new job with the same image id and payload. The new job's max_retries is one less than the original. The new job's `retry_of` field is set to the original Job ID. Titan will delay the new job for retries_delay seconds before queueing it. Cancelled or successful tasks are never automatically retried.\"
|
33
45
|
attr_accessor :max_retries
|
34
46
|
|
35
47
|
# Time in seconds to wait before retrying the job. Must be a non-negative integer.
|
36
48
|
attr_accessor :retries_delay
|
37
49
|
|
50
|
+
|
38
51
|
# Attribute mapping from ruby-style variable name to JSON key.
|
39
52
|
def self.attribute_map
|
40
53
|
{
|
41
|
-
|
42
54
|
:'image' => :'image',
|
43
|
-
|
44
55
|
:'payload' => :'payload',
|
45
|
-
|
46
56
|
:'delay' => :'delay',
|
47
|
-
|
48
57
|
:'timeout' => :'timeout',
|
49
|
-
|
50
58
|
:'priority' => :'priority',
|
51
|
-
|
52
59
|
:'max_retries' => :'max_retries',
|
53
|
-
|
54
60
|
:'retries_delay' => :'retries_delay'
|
55
|
-
|
56
61
|
}
|
57
62
|
end
|
58
63
|
|
@@ -66,56 +71,87 @@ module IronTitan
|
|
66
71
|
:'priority' => :'Integer',
|
67
72
|
:'max_retries' => :'Integer',
|
68
73
|
:'retries_delay' => :'Integer'
|
69
|
-
|
70
74
|
}
|
71
75
|
end
|
72
76
|
|
77
|
+
# Initializes the object
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
79
|
def initialize(attributes = {})
|
74
80
|
return unless attributes.is_a?(Hash)
|
75
81
|
|
76
82
|
# convert string to symbol for hash key
|
77
|
-
attributes = attributes.
|
83
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
78
84
|
|
79
|
-
|
80
|
-
if attributes[:'image']
|
85
|
+
if attributes.has_key?(:'image')
|
81
86
|
self.image = attributes[:'image']
|
82
87
|
end
|
83
|
-
|
84
|
-
if attributes
|
88
|
+
|
89
|
+
if attributes.has_key?(:'payload')
|
85
90
|
self.payload = attributes[:'payload']
|
86
91
|
end
|
87
|
-
|
88
|
-
if attributes
|
92
|
+
|
93
|
+
if attributes.has_key?(:'delay')
|
89
94
|
self.delay = attributes[:'delay']
|
90
95
|
else
|
91
96
|
self.delay = 0
|
92
97
|
end
|
93
|
-
|
94
|
-
if attributes
|
98
|
+
|
99
|
+
if attributes.has_key?(:'timeout')
|
95
100
|
self.timeout = attributes[:'timeout']
|
96
101
|
else
|
97
102
|
self.timeout = 60
|
98
103
|
end
|
99
|
-
|
100
|
-
if attributes
|
104
|
+
|
105
|
+
if attributes.has_key?(:'priority')
|
101
106
|
self.priority = attributes[:'priority']
|
102
107
|
end
|
103
|
-
|
104
|
-
if attributes
|
108
|
+
|
109
|
+
if attributes.has_key?(:'max_retries')
|
105
110
|
self.max_retries = attributes[:'max_retries']
|
106
111
|
else
|
107
112
|
self.max_retries = 0
|
108
113
|
end
|
109
|
-
|
110
|
-
if attributes
|
114
|
+
|
115
|
+
if attributes.has_key?(:'retries_delay')
|
111
116
|
self.retries_delay = attributes[:'retries_delay']
|
112
117
|
else
|
113
118
|
self.retries_delay = 60
|
114
119
|
end
|
115
|
-
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
124
|
+
# @return Array for valid properies with the reasons
|
125
|
+
def list_invalid_properties
|
126
|
+
invalid_properties = Array.new
|
127
|
+
return invalid_properties
|
128
|
+
end
|
129
|
+
|
130
|
+
# Check to see if the all the properties in the model are valid
|
131
|
+
# @return true if the model is valid
|
132
|
+
def valid?
|
133
|
+
return false if @image.nil?
|
134
|
+
return false if @payload.to_s.length <
|
135
|
+
return false if @priority.nil?
|
136
|
+
return true
|
137
|
+
end
|
138
|
+
|
139
|
+
# Custom attribute writer method with validation
|
140
|
+
# @param [Object] payload Value to be assigned
|
141
|
+
def payload=(payload)
|
142
|
+
if payload.nil?
|
143
|
+
fail ArgumentError, "payload cannot be nil"
|
144
|
+
end
|
145
|
+
|
146
|
+
if payload.to_s.length <
|
147
|
+
fail ArgumentError, "invalid value for 'payload', the character length must be great than or equal to ."
|
148
|
+
end
|
149
|
+
|
150
|
+
@payload = payload
|
116
151
|
end
|
117
152
|
|
118
|
-
#
|
153
|
+
# Checks equality by comparing each attribute.
|
154
|
+
# @param [Object] Object to be compared
|
119
155
|
def ==(o)
|
120
156
|
return true if self.equal?(o)
|
121
157
|
self.class == o.class &&
|
@@ -129,35 +165,41 @@ module IronTitan
|
|
129
165
|
end
|
130
166
|
|
131
167
|
# @see the `==` method
|
168
|
+
# @param [Object] Object to be compared
|
132
169
|
def eql?(o)
|
133
170
|
self == o
|
134
171
|
end
|
135
172
|
|
136
|
-
#
|
173
|
+
# Calculates hash code according to all attributes.
|
174
|
+
# @return [Fixnum] Hash code
|
137
175
|
def hash
|
138
176
|
[image, payload, delay, timeout, priority, max_retries, retries_delay].hash
|
139
177
|
end
|
140
178
|
|
141
|
-
#
|
179
|
+
# Builds the object from hash
|
180
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
181
|
+
# @return [Object] Returns the model itself
|
142
182
|
def build_from_hash(attributes)
|
143
183
|
return nil unless attributes.is_a?(Hash)
|
144
184
|
self.class.swagger_types.each_pair do |key, type|
|
145
185
|
if type =~ /^Array<(.*)>/i
|
186
|
+
# check to ensure the input is an array given that the the attribute
|
187
|
+
# is documented as an array but the input is not
|
146
188
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
147
189
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
148
|
-
else
|
149
|
-
#TODO show warning in debug mode
|
150
190
|
end
|
151
191
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
152
192
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
153
|
-
else
|
154
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
155
|
-
end
|
193
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
156
194
|
end
|
157
195
|
|
158
196
|
self
|
159
197
|
end
|
160
198
|
|
199
|
+
# Deserializes the data based on type
|
200
|
+
# @param string type Data type
|
201
|
+
# @param string value Value to be deserialized
|
202
|
+
# @return [Object] Deserialized data
|
161
203
|
def _deserialize(type, value)
|
162
204
|
case type.to_sym
|
163
205
|
when :DateTime
|
@@ -191,21 +233,25 @@ module IronTitan
|
|
191
233
|
end
|
192
234
|
end
|
193
235
|
else # model
|
194
|
-
|
195
|
-
|
236
|
+
temp_model = IronTitan.const_get(type).new
|
237
|
+
temp_model.build_from_hash(value)
|
196
238
|
end
|
197
239
|
end
|
198
240
|
|
241
|
+
# Returns the string representation of the object
|
242
|
+
# @return [String] String presentation of the object
|
199
243
|
def to_s
|
200
244
|
to_hash.to_s
|
201
245
|
end
|
202
246
|
|
203
|
-
# to_body is an alias to
|
247
|
+
# to_body is an alias to to_hash (backward compatibility)
|
248
|
+
# @return [Hash] Returns the object in the form of hash
|
204
249
|
def to_body
|
205
250
|
to_hash
|
206
251
|
end
|
207
252
|
|
208
|
-
#
|
253
|
+
# Returns the object in the form of hash
|
254
|
+
# @return [Hash] Returns the object in the form of hash
|
209
255
|
def to_hash
|
210
256
|
hash = {}
|
211
257
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -216,8 +262,10 @@ module IronTitan
|
|
216
262
|
hash
|
217
263
|
end
|
218
264
|
|
219
|
-
#
|
265
|
+
# Outputs non-array value in the form of hash
|
220
266
|
# For object, use to_hash. Otherwise, just return the value
|
267
|
+
# @param [Object] value Any valid value
|
268
|
+
# @return [Hash] Returns the value in the form of hash
|
221
269
|
def _to_hash(value)
|
222
270
|
if value.is_a?(Array)
|
223
271
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -233,4 +281,5 @@ module IronTitan
|
|
233
281
|
end
|
234
282
|
|
235
283
|
end
|
284
|
+
|
236
285
|
end
|
@@ -3,25 +3,36 @@ Titan API
|
|
3
3
|
|
4
4
|
The ultimate, language agnostic, container based job processing framework.
|
5
5
|
|
6
|
-
OpenAPI spec version: 0.
|
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 NewJobsWrapper
|
17
29
|
attr_accessor :jobs
|
18
30
|
|
31
|
+
|
19
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
20
33
|
def self.attribute_map
|
21
34
|
{
|
22
|
-
|
23
35
|
:'jobs' => :'jobs'
|
24
|
-
|
25
36
|
}
|
26
37
|
end
|
27
38
|
|
@@ -29,26 +40,41 @@ module IronTitan
|
|
29
40
|
def self.swagger_types
|
30
41
|
{
|
31
42
|
:'jobs' => :'Array<NewJob>'
|
32
|
-
|
33
43
|
}
|
34
44
|
end
|
35
45
|
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
48
|
def initialize(attributes = {})
|
37
49
|
return unless attributes.is_a?(Hash)
|
38
50
|
|
39
51
|
# convert string to symbol for hash key
|
40
|
-
attributes = attributes.
|
52
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
41
53
|
|
42
|
-
|
43
|
-
if attributes[:'jobs']
|
54
|
+
if attributes.has_key?(:'jobs')
|
44
55
|
if (value = attributes[:'jobs']).is_a?(Array)
|
45
56
|
self.jobs = value
|
46
57
|
end
|
47
58
|
end
|
48
|
-
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
63
|
+
# @return Array for valid properies with the reasons
|
64
|
+
def list_invalid_properties
|
65
|
+
invalid_properties = Array.new
|
66
|
+
return invalid_properties
|
67
|
+
end
|
68
|
+
|
69
|
+
# Check to see if the all the properties in the model are valid
|
70
|
+
# @return true if the model is valid
|
71
|
+
def valid?
|
72
|
+
return false if @jobs.nil?
|
73
|
+
return true
|
49
74
|
end
|
50
75
|
|
51
|
-
#
|
76
|
+
# Checks equality by comparing each attribute.
|
77
|
+
# @param [Object] Object to be compared
|
52
78
|
def ==(o)
|
53
79
|
return true if self.equal?(o)
|
54
80
|
self.class == o.class &&
|
@@ -56,35 +82,41 @@ module IronTitan
|
|
56
82
|
end
|
57
83
|
|
58
84
|
# @see the `==` method
|
85
|
+
# @param [Object] Object to be compared
|
59
86
|
def eql?(o)
|
60
87
|
self == o
|
61
88
|
end
|
62
89
|
|
63
|
-
#
|
90
|
+
# Calculates hash code according to all attributes.
|
91
|
+
# @return [Fixnum] Hash code
|
64
92
|
def hash
|
65
93
|
[jobs].hash
|
66
94
|
end
|
67
95
|
|
68
|
-
#
|
96
|
+
# Builds the object from hash
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
98
|
+
# @return [Object] Returns the model itself
|
69
99
|
def build_from_hash(attributes)
|
70
100
|
return nil unless attributes.is_a?(Hash)
|
71
101
|
self.class.swagger_types.each_pair do |key, type|
|
72
102
|
if type =~ /^Array<(.*)>/i
|
103
|
+
# check to ensure the input is an array given that the the attribute
|
104
|
+
# is documented as an array but the input is not
|
73
105
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
74
106
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
75
|
-
else
|
76
|
-
#TODO show warning in debug mode
|
77
107
|
end
|
78
108
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
79
109
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
80
|
-
else
|
81
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
82
|
-
end
|
110
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
83
111
|
end
|
84
112
|
|
85
113
|
self
|
86
114
|
end
|
87
115
|
|
116
|
+
# Deserializes the data based on type
|
117
|
+
# @param string type Data type
|
118
|
+
# @param string value Value to be deserialized
|
119
|
+
# @return [Object] Deserialized data
|
88
120
|
def _deserialize(type, value)
|
89
121
|
case type.to_sym
|
90
122
|
when :DateTime
|
@@ -118,21 +150,25 @@ module IronTitan
|
|
118
150
|
end
|
119
151
|
end
|
120
152
|
else # model
|
121
|
-
|
122
|
-
|
153
|
+
temp_model = IronTitan.const_get(type).new
|
154
|
+
temp_model.build_from_hash(value)
|
123
155
|
end
|
124
156
|
end
|
125
157
|
|
158
|
+
# Returns the string representation of the object
|
159
|
+
# @return [String] String presentation of the object
|
126
160
|
def to_s
|
127
161
|
to_hash.to_s
|
128
162
|
end
|
129
163
|
|
130
|
-
# to_body is an alias to
|
164
|
+
# to_body is an alias to to_hash (backward compatibility)
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
131
166
|
def to_body
|
132
167
|
to_hash
|
133
168
|
end
|
134
169
|
|
135
|
-
#
|
170
|
+
# Returns the object in the form of hash
|
171
|
+
# @return [Hash] Returns the object in the form of hash
|
136
172
|
def to_hash
|
137
173
|
hash = {}
|
138
174
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -143,8 +179,10 @@ module IronTitan
|
|
143
179
|
hash
|
144
180
|
end
|
145
181
|
|
146
|
-
#
|
182
|
+
# Outputs non-array value in the form of hash
|
147
183
|
# For object, use to_hash. Otherwise, just return the value
|
184
|
+
# @param [Object] value Any valid value
|
185
|
+
# @return [Hash] Returns the value in the form of hash
|
148
186
|
def _to_hash(value)
|
149
187
|
if value.is_a?(Array)
|
150
188
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -160,4 +198,5 @@ module IronTitan
|
|
160
198
|
end
|
161
199
|
|
162
200
|
end
|
201
|
+
|
163
202
|
end
|