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,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 GroupWrapper
|
17
29
|
attr_accessor :group
|
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
|
:'group' => :'group'
|
24
|
-
|
25
36
|
}
|
26
37
|
end
|
27
38
|
|
@@ -29,24 +40,39 @@ module IronTitan
|
|
29
40
|
def self.swagger_types
|
30
41
|
{
|
31
42
|
:'group' => :'Group'
|
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[:'group']
|
54
|
+
if attributes.has_key?(:'group')
|
44
55
|
self.group = attributes[:'group']
|
45
56
|
end
|
46
|
-
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
61
|
+
# @return Array for valid properies with the reasons
|
62
|
+
def list_invalid_properties
|
63
|
+
invalid_properties = Array.new
|
64
|
+
return invalid_properties
|
65
|
+
end
|
66
|
+
|
67
|
+
# Check to see if the all the properties in the model are valid
|
68
|
+
# @return true if the model is valid
|
69
|
+
def valid?
|
70
|
+
return false if @group.nil?
|
71
|
+
return true
|
47
72
|
end
|
48
73
|
|
49
|
-
#
|
74
|
+
# Checks equality by comparing each attribute.
|
75
|
+
# @param [Object] Object to be compared
|
50
76
|
def ==(o)
|
51
77
|
return true if self.equal?(o)
|
52
78
|
self.class == o.class &&
|
@@ -54,35 +80,41 @@ module IronTitan
|
|
54
80
|
end
|
55
81
|
|
56
82
|
# @see the `==` method
|
83
|
+
# @param [Object] Object to be compared
|
57
84
|
def eql?(o)
|
58
85
|
self == o
|
59
86
|
end
|
60
87
|
|
61
|
-
#
|
88
|
+
# Calculates hash code according to all attributes.
|
89
|
+
# @return [Fixnum] Hash code
|
62
90
|
def hash
|
63
91
|
[group].hash
|
64
92
|
end
|
65
93
|
|
66
|
-
#
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
67
97
|
def build_from_hash(attributes)
|
68
98
|
return nil unless attributes.is_a?(Hash)
|
69
99
|
self.class.swagger_types.each_pair do |key, type|
|
70
100
|
if type =~ /^Array<(.*)>/i
|
101
|
+
# check to ensure the input is an array given that the the attribute
|
102
|
+
# is documented as an array but the input is not
|
71
103
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
72
104
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
73
|
-
else
|
74
|
-
#TODO show warning in debug mode
|
75
105
|
end
|
76
106
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
77
107
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
78
|
-
else
|
79
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
80
|
-
end
|
108
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
81
109
|
end
|
82
110
|
|
83
111
|
self
|
84
112
|
end
|
85
113
|
|
114
|
+
# Deserializes the data based on type
|
115
|
+
# @param string type Data type
|
116
|
+
# @param string value Value to be deserialized
|
117
|
+
# @return [Object] Deserialized data
|
86
118
|
def _deserialize(type, value)
|
87
119
|
case type.to_sym
|
88
120
|
when :DateTime
|
@@ -116,21 +148,25 @@ module IronTitan
|
|
116
148
|
end
|
117
149
|
end
|
118
150
|
else # model
|
119
|
-
|
120
|
-
|
151
|
+
temp_model = IronTitan.const_get(type).new
|
152
|
+
temp_model.build_from_hash(value)
|
121
153
|
end
|
122
154
|
end
|
123
155
|
|
156
|
+
# Returns the string representation of the object
|
157
|
+
# @return [String] String presentation of the object
|
124
158
|
def to_s
|
125
159
|
to_hash.to_s
|
126
160
|
end
|
127
161
|
|
128
|
-
# to_body is an alias to
|
162
|
+
# to_body is an alias to to_hash (backward compatibility)
|
163
|
+
# @return [Hash] Returns the object in the form of hash
|
129
164
|
def to_body
|
130
165
|
to_hash
|
131
166
|
end
|
132
167
|
|
133
|
-
#
|
168
|
+
# Returns the object in the form of hash
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
134
170
|
def to_hash
|
135
171
|
hash = {}
|
136
172
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -141,8 +177,10 @@ module IronTitan
|
|
141
177
|
hash
|
142
178
|
end
|
143
179
|
|
144
|
-
#
|
180
|
+
# Outputs non-array value in the form of hash
|
145
181
|
# For object, use to_hash. Otherwise, just return the value
|
182
|
+
# @param [Object] value Any valid value
|
183
|
+
# @return [Hash] Returns the value in the form of hash
|
146
184
|
def _to_hash(value)
|
147
185
|
if value.is_a?(Array)
|
148
186
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -158,4 +196,5 @@ module IronTitan
|
|
158
196
|
end
|
159
197
|
|
160
198
|
end
|
199
|
+
|
161
200
|
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 GroupsWrapper
|
17
29
|
attr_accessor :groups
|
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
|
:'groups' => :'groups'
|
24
|
-
|
25
36
|
}
|
26
37
|
end
|
27
38
|
|
@@ -29,26 +40,41 @@ module IronTitan
|
|
29
40
|
def self.swagger_types
|
30
41
|
{
|
31
42
|
:'groups' => :'Array<Group>'
|
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[:'groups']
|
54
|
+
if attributes.has_key?(:'groups')
|
44
55
|
if (value = attributes[:'groups']).is_a?(Array)
|
45
56
|
self.groups = 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 @groups.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
|
[groups].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
|
@@ -3,31 +3,62 @@ 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 IdStatus
|
17
29
|
# Unique identifier representing a specific job.
|
18
30
|
attr_accessor :id
|
19
31
|
|
20
|
-
# States and valid transitions
|
32
|
+
# States and valid transitions. +---------+ +---------> delayed <----------------+ +----+----+ | | | | | +----v----+ | +---------> queued <----------------+ +----+----+ * | * | retry * creates new job +----v----+ * | running | * +--+-+-+--+ | +---------|-|-|-----+-------------+ +---|---------+ | +-----|---------+ | | | | | | | +-----v---^-+ +--v-------^+ +--v---^-+ | success | | cancelled | | error | +-----------+ +-----------+ +--------+ * delayed - has a delay. * queued - Ready to be consumed when it's turn comes. * running - Currently consumed by a runner which will attempt to process it. * success - (or complete? success/error is common javascript terminology) * error - Something went wrong. In this case more information can be obtained by inspecting the \"reason\" field. - timeout - killed - forcibly killed by worker due to resource restrictions or access violations. - bad_exit - exited with non-zero status due to program termination/crash. * cancelled - cancelled via API. More information in the reason field. - client_request - Request was cancelled by a client.
|
21
33
|
attr_accessor :status
|
22
34
|
|
35
|
+
class EnumAttributeValidator
|
36
|
+
attr_reader :datatype
|
37
|
+
attr_reader :allowable_values
|
38
|
+
|
39
|
+
def initialize(datatype, allowable_values)
|
40
|
+
@allowable_values = allowable_values.map do |value|
|
41
|
+
case datatype.to_s
|
42
|
+
when /Integer/i
|
43
|
+
value.to_i
|
44
|
+
when /Float/i
|
45
|
+
value.to_f
|
46
|
+
else
|
47
|
+
value
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def valid?(value)
|
53
|
+
!value || allowable_values.include?(value)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
23
57
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
58
|
def self.attribute_map
|
25
59
|
{
|
26
|
-
|
27
60
|
:'id' => :'id',
|
28
|
-
|
29
61
|
:'status' => :'status'
|
30
|
-
|
31
62
|
}
|
32
63
|
end
|
33
64
|
|
@@ -36,37 +67,54 @@ module IronTitan
|
|
36
67
|
{
|
37
68
|
:'id' => :'String',
|
38
69
|
:'status' => :'String'
|
39
|
-
|
40
70
|
}
|
41
71
|
end
|
42
72
|
|
73
|
+
# Initializes the object
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
75
|
def initialize(attributes = {})
|
44
76
|
return unless attributes.is_a?(Hash)
|
45
77
|
|
46
78
|
# convert string to symbol for hash key
|
47
|
-
attributes = attributes.
|
79
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
48
80
|
|
49
|
-
|
50
|
-
if attributes[:'id']
|
81
|
+
if attributes.has_key?(:'id')
|
51
82
|
self.id = attributes[:'id']
|
52
83
|
end
|
53
|
-
|
54
|
-
if attributes
|
84
|
+
|
85
|
+
if attributes.has_key?(:'status')
|
55
86
|
self.status = attributes[:'status']
|
56
87
|
end
|
57
|
-
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properies with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
invalid_properties = Array.new
|
95
|
+
return invalid_properties
|
96
|
+
end
|
97
|
+
|
98
|
+
# Check to see if the all the properties in the model are valid
|
99
|
+
# @return true if the model is valid
|
100
|
+
def valid?
|
101
|
+
status_validator = EnumAttributeValidator.new('String', ["delayed", "queued", "running", "success", "error", "cancelled"])
|
102
|
+
return false unless status_validator.valid?(@status)
|
103
|
+
return true
|
58
104
|
end
|
59
105
|
|
60
106
|
# Custom attribute writer method checking allowed values (enum).
|
107
|
+
# @param [Object] status Object to be assigned
|
61
108
|
def status=(status)
|
62
|
-
|
63
|
-
|
64
|
-
fail "invalid value for 'status', must be one of #{
|
109
|
+
validator = EnumAttributeValidator.new('String', ["delayed", "queued", "running", "success", "error", "cancelled"])
|
110
|
+
unless validator.valid?(status)
|
111
|
+
fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
|
65
112
|
end
|
66
113
|
@status = status
|
67
114
|
end
|
68
115
|
|
69
|
-
#
|
116
|
+
# Checks equality by comparing each attribute.
|
117
|
+
# @param [Object] Object to be compared
|
70
118
|
def ==(o)
|
71
119
|
return true if self.equal?(o)
|
72
120
|
self.class == o.class &&
|
@@ -75,35 +123,41 @@ module IronTitan
|
|
75
123
|
end
|
76
124
|
|
77
125
|
# @see the `==` method
|
126
|
+
# @param [Object] Object to be compared
|
78
127
|
def eql?(o)
|
79
128
|
self == o
|
80
129
|
end
|
81
130
|
|
82
|
-
#
|
131
|
+
# Calculates hash code according to all attributes.
|
132
|
+
# @return [Fixnum] Hash code
|
83
133
|
def hash
|
84
134
|
[id, status].hash
|
85
135
|
end
|
86
136
|
|
87
|
-
#
|
137
|
+
# Builds the object from hash
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
139
|
+
# @return [Object] Returns the model itself
|
88
140
|
def build_from_hash(attributes)
|
89
141
|
return nil unless attributes.is_a?(Hash)
|
90
142
|
self.class.swagger_types.each_pair do |key, type|
|
91
143
|
if type =~ /^Array<(.*)>/i
|
144
|
+
# check to ensure the input is an array given that the the attribute
|
145
|
+
# is documented as an array but the input is not
|
92
146
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
93
147
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
94
|
-
else
|
95
|
-
#TODO show warning in debug mode
|
96
148
|
end
|
97
149
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
98
150
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
99
|
-
else
|
100
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
101
|
-
end
|
151
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
102
152
|
end
|
103
153
|
|
104
154
|
self
|
105
155
|
end
|
106
156
|
|
157
|
+
# Deserializes the data based on type
|
158
|
+
# @param string type Data type
|
159
|
+
# @param string value Value to be deserialized
|
160
|
+
# @return [Object] Deserialized data
|
107
161
|
def _deserialize(type, value)
|
108
162
|
case type.to_sym
|
109
163
|
when :DateTime
|
@@ -137,21 +191,25 @@ module IronTitan
|
|
137
191
|
end
|
138
192
|
end
|
139
193
|
else # model
|
140
|
-
|
141
|
-
|
194
|
+
temp_model = IronTitan.const_get(type).new
|
195
|
+
temp_model.build_from_hash(value)
|
142
196
|
end
|
143
197
|
end
|
144
198
|
|
199
|
+
# Returns the string representation of the object
|
200
|
+
# @return [String] String presentation of the object
|
145
201
|
def to_s
|
146
202
|
to_hash.to_s
|
147
203
|
end
|
148
204
|
|
149
|
-
# to_body is an alias to
|
205
|
+
# to_body is an alias to to_hash (backward compatibility)
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
150
207
|
def to_body
|
151
208
|
to_hash
|
152
209
|
end
|
153
210
|
|
154
|
-
#
|
211
|
+
# Returns the object in the form of hash
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
155
213
|
def to_hash
|
156
214
|
hash = {}
|
157
215
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -162,8 +220,10 @@ module IronTitan
|
|
162
220
|
hash
|
163
221
|
end
|
164
222
|
|
165
|
-
#
|
223
|
+
# Outputs non-array value in the form of hash
|
166
224
|
# For object, use to_hash. Otherwise, just return the value
|
225
|
+
# @param [Object] value Any valid value
|
226
|
+
# @return [Hash] Returns the value in the form of hash
|
167
227
|
def _to_hash(value)
|
168
228
|
if value.is_a?(Array)
|
169
229
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -179,4 +239,5 @@ module IronTitan
|
|
179
239
|
end
|
180
240
|
|
181
241
|
end
|
242
|
+
|
182
243
|
end
|