worker_ruby 0.5.7
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 +7 -0
- data/LICENSE +201 -0
- data/README.md +118 -0
- data/VERSION +1 -0
- data/VERSION.txt +1 -0
- data/docs/Complete.md +10 -0
- data/docs/CoreApi.md +200 -0
- data/docs/Error.md +8 -0
- data/docs/ErrorBody.md +9 -0
- data/docs/Group.md +12 -0
- data/docs/GroupWrapper.md +8 -0
- data/docs/GroupsApi.md +197 -0
- data/docs/GroupsWrapper.md +8 -0
- data/docs/IdStatus.md +9 -0
- data/docs/Image.md +10 -0
- data/docs/ImageWrapper.md +8 -0
- data/docs/ImagesApi.md +98 -0
- data/docs/ImagesWrapper.md +8 -0
- data/docs/Job.md +25 -0
- data/docs/JobWrapper.md +8 -0
- data/docs/JobsApi.md +684 -0
- data/docs/JobsWrapper.md +10 -0
- data/docs/Log.md +8 -0
- data/docs/NewJob.md +14 -0
- data/docs/NewJobWithImage.md +15 -0
- data/docs/NewJobsWrapper.md +8 -0
- data/docs/NewTask.md +14 -0
- data/docs/NewTasksWrapper.md +8 -0
- data/docs/Reason.md +7 -0
- data/docs/RunnerApi.md +170 -0
- data/docs/Start.md +8 -0
- data/docs/Task.md +25 -0
- data/docs/TaskWrapper.md +8 -0
- data/docs/TasksApi.md +684 -0
- data/docs/TasksWrapper.md +10 -0
- data/git_push.sh +67 -0
- data/iron_ruby.gemspec +55 -0
- data/iron_titan.gemspec +32 -0
- data/lib/iron_ruby.rb +66 -0
- data/lib/iron_ruby/api/groups_api.rb +262 -0
- data/lib/iron_ruby/api/runner_api.rb +229 -0
- data/lib/iron_ruby/api/tasks_api.rb +842 -0
- data/lib/iron_ruby/api_client.rb +378 -0
- data/lib/iron_ruby/api_error.rb +47 -0
- data/lib/iron_ruby/configuration.rb +207 -0
- data/lib/iron_ruby/models/complete.rb +220 -0
- data/lib/iron_ruby/models/error.rb +199 -0
- data/lib/iron_ruby/models/error_body.rb +208 -0
- data/lib/iron_ruby/models/group.rb +242 -0
- data/lib/iron_ruby/models/group_wrapper.rb +200 -0
- data/lib/iron_ruby/models/groups_wrapper.rb +202 -0
- data/lib/iron_ruby/models/id_status.rb +243 -0
- data/lib/iron_ruby/models/new_task.rb +270 -0
- data/lib/iron_ruby/models/new_tasks_wrapper.rb +202 -0
- data/lib/iron_ruby/models/start.rb +200 -0
- data/lib/iron_ruby/models/task.rb +427 -0
- data/lib/iron_ruby/models/task_wrapper.rb +200 -0
- data/lib/iron_ruby/models/tasks_wrapper.rb +221 -0
- data/lib/iron_ruby/version.rb +26 -0
- data/lib/iron_titan.rb +66 -0
- data/lib/iron_titan/api/core_api.rb +260 -0
- data/lib/iron_titan/api/groups_api.rb +262 -0
- data/lib/iron_titan/api/images_api.rb +138 -0
- data/lib/iron_titan/api/jobs_api.rb +842 -0
- data/lib/iron_titan/api/runner_api.rb +229 -0
- data/lib/iron_titan/api_client.rb +372 -0
- data/lib/iron_titan/api_error.rb +47 -0
- data/lib/iron_titan/configuration.rb +186 -0
- data/lib/iron_titan/models/complete.rb +220 -0
- data/lib/iron_titan/models/error.rb +199 -0
- data/lib/iron_titan/models/error_body.rb +208 -0
- data/lib/iron_titan/models/group.rb +242 -0
- data/lib/iron_titan/models/group_wrapper.rb +200 -0
- data/lib/iron_titan/models/groups_wrapper.rb +202 -0
- data/lib/iron_titan/models/id_status.rb +243 -0
- data/lib/iron_titan/models/image.rb +184 -0
- data/lib/iron_titan/models/image_wrapper.rb +161 -0
- data/lib/iron_titan/models/images_wrapper.rb +163 -0
- data/lib/iron_titan/models/job.rb +427 -0
- data/lib/iron_titan/models/job_array.rb +160 -0
- data/lib/iron_titan/models/job_wrapper.rb +200 -0
- data/lib/iron_titan/models/jobs_wrapper.rb +221 -0
- data/lib/iron_titan/models/log.rb +161 -0
- data/lib/iron_titan/models/new_job.rb +270 -0
- data/lib/iron_titan/models/new_job_array.rb +160 -0
- data/lib/iron_titan/models/new_job_with_image.rb +249 -0
- data/lib/iron_titan/models/new_jobs_wrapper.rb +202 -0
- data/lib/iron_titan/models/reason.rb +164 -0
- data/lib/iron_titan/models/start.rb +200 -0
- data/lib/iron_titan/version.rb +26 -0
- data/lib/worker_ruby.rb +66 -0
- data/lib/worker_ruby/api/groups_api.rb +262 -0
- data/lib/worker_ruby/api/runner_api.rb +229 -0
- data/lib/worker_ruby/api/tasks_api.rb +842 -0
- data/lib/worker_ruby/api_client.rb +378 -0
- data/lib/worker_ruby/api_error.rb +47 -0
- data/lib/worker_ruby/configuration.rb +207 -0
- data/lib/worker_ruby/models/complete.rb +220 -0
- data/lib/worker_ruby/models/error.rb +199 -0
- data/lib/worker_ruby/models/error_body.rb +208 -0
- data/lib/worker_ruby/models/group.rb +242 -0
- data/lib/worker_ruby/models/group_wrapper.rb +200 -0
- data/lib/worker_ruby/models/groups_wrapper.rb +202 -0
- data/lib/worker_ruby/models/id_status.rb +243 -0
- data/lib/worker_ruby/models/new_task.rb +270 -0
- data/lib/worker_ruby/models/new_tasks_wrapper.rb +202 -0
- data/lib/worker_ruby/models/start.rb +200 -0
- data/lib/worker_ruby/models/task.rb +427 -0
- data/lib/worker_ruby/models/task_wrapper.rb +200 -0
- data/lib/worker_ruby/models/tasks_wrapper.rb +221 -0
- data/lib/worker_ruby/version.rb +26 -0
- data/spec/api/CoreApi_spec.rb +99 -0
- data/spec/api/JobsApi_spec.rb +131 -0
- data/spec/api/core_api_spec.rb +99 -0
- data/spec/api/groups_api_spec.rb +94 -0
- data/spec/api/images_api_spec.rb +66 -0
- data/spec/api/jobs_api_spec.rb +220 -0
- data/spec/api/runner_api_spec.rb +88 -0
- data/spec/api/tasks_api_spec.rb +220 -0
- data/spec/api_client_spec.rb +237 -0
- data/spec/configuration_spec.rb +53 -0
- data/spec/models/ErrorBody_spec.rb +56 -0
- data/spec/models/JobArray_spec.rb +46 -0
- data/spec/models/JobWrapper_spec.rb +46 -0
- data/spec/models/NewJobArray_spec.rb +46 -0
- data/spec/models/NewJob_spec.rb +96 -0
- data/spec/models/complete_spec.rb +65 -0
- data/spec/models/error_body_spec.rb +59 -0
- data/spec/models/error_spec.rb +53 -0
- data/spec/models/group_spec.rb +77 -0
- data/spec/models/group_wrapper_spec.rb +53 -0
- data/spec/models/groups_wrapper_spec.rb +53 -0
- data/spec/models/id_status_spec.rb +63 -0
- data/spec/models/image_spec.rb +66 -0
- data/spec/models/image_wrapper_spec.rb +46 -0
- data/spec/models/images_wrapper_spec.rb +46 -0
- data/spec/models/job_array_spec.rb +46 -0
- data/spec/models/job_spec.rb +161 -0
- data/spec/models/job_wrapper_spec.rb +53 -0
- data/spec/models/jobs_wrapper_spec.rb +65 -0
- data/spec/models/log_spec.rb +46 -0
- data/spec/models/new_job_array_spec.rb +46 -0
- data/spec/models/new_job_spec.rb +89 -0
- data/spec/models/new_job_with_image_spec.rb +116 -0
- data/spec/models/new_jobs_wrapper_spec.rb +53 -0
- data/spec/models/new_task_spec.rb +89 -0
- data/spec/models/new_tasks_wrapper_spec.rb +53 -0
- data/spec/models/reason_spec.rb +36 -0
- data/spec/models/start_spec.rb +53 -0
- data/spec/models/task_spec.rb +163 -0
- data/spec/models/task_wrapper_spec.rb +53 -0
- data/spec/models/tasks_wrapper_spec.rb +65 -0
- data/spec/spec_helper.rb +122 -0
- data/worker_ruby-0.5.5.gem +0 -0
- data/worker_ruby.gemspec +55 -0
- metadata +420 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Titan API
|
|
3
|
+
|
|
4
|
+
The ultimate, language agnostic, container based job processing framework.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 0.2.17
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module IronTitan
|
|
16
|
+
class Image
|
|
17
|
+
# Name of this image/package/code. Can and should be different than the image name (shoudn't include tag). TODO: Should we strip tag automatically if only image is passed in?
|
|
18
|
+
attr_accessor :name
|
|
19
|
+
|
|
20
|
+
# Docker image to use for job, including the tag.
|
|
21
|
+
attr_accessor :image
|
|
22
|
+
|
|
23
|
+
# Time when image first used/created.
|
|
24
|
+
attr_accessor :created_at
|
|
25
|
+
|
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
27
|
+
def self.attribute_map
|
|
28
|
+
{
|
|
29
|
+
|
|
30
|
+
:'name' => :'name',
|
|
31
|
+
|
|
32
|
+
:'image' => :'image',
|
|
33
|
+
|
|
34
|
+
:'created_at' => :'created_at'
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Attribute type mapping.
|
|
40
|
+
def self.swagger_types
|
|
41
|
+
{
|
|
42
|
+
:'name' => :'String',
|
|
43
|
+
:'image' => :'String',
|
|
44
|
+
:'created_at' => :'DateTime'
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def initialize(attributes = {})
|
|
50
|
+
return unless attributes.is_a?(Hash)
|
|
51
|
+
|
|
52
|
+
# convert string to symbol for hash key
|
|
53
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if attributes[:'name']
|
|
57
|
+
self.name = attributes[:'name']
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
if attributes[:'image']
|
|
61
|
+
self.image = attributes[:'image']
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if attributes[:'created_at']
|
|
65
|
+
self.created_at = attributes[:'created_at']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Check equality by comparing each attribute.
|
|
71
|
+
def ==(o)
|
|
72
|
+
return true if self.equal?(o)
|
|
73
|
+
self.class == o.class &&
|
|
74
|
+
name == o.name &&
|
|
75
|
+
image == o.image &&
|
|
76
|
+
created_at == o.created_at
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# @see the `==` method
|
|
80
|
+
def eql?(o)
|
|
81
|
+
self == o
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Calculate hash code according to all attributes.
|
|
85
|
+
def hash
|
|
86
|
+
[name, image, created_at].hash
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# build the object from hash
|
|
90
|
+
def build_from_hash(attributes)
|
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
|
92
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
93
|
+
if type =~ /^Array<(.*)>/i
|
|
94
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
95
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
96
|
+
else
|
|
97
|
+
#TODO show warning in debug mode
|
|
98
|
+
end
|
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
100
|
+
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
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
self
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def _deserialize(type, value)
|
|
110
|
+
case type.to_sym
|
|
111
|
+
when :DateTime
|
|
112
|
+
DateTime.parse(value)
|
|
113
|
+
when :Date
|
|
114
|
+
Date.parse(value)
|
|
115
|
+
when :String
|
|
116
|
+
value.to_s
|
|
117
|
+
when :Integer
|
|
118
|
+
value.to_i
|
|
119
|
+
when :Float
|
|
120
|
+
value.to_f
|
|
121
|
+
when :BOOLEAN
|
|
122
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
|
123
|
+
true
|
|
124
|
+
else
|
|
125
|
+
false
|
|
126
|
+
end
|
|
127
|
+
when :Object
|
|
128
|
+
# generic object (usually a Hash), return directly
|
|
129
|
+
value
|
|
130
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
131
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
132
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
133
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
|
134
|
+
k_type = Regexp.last_match[:k_type]
|
|
135
|
+
v_type = Regexp.last_match[:v_type]
|
|
136
|
+
{}.tap do |hash|
|
|
137
|
+
value.each do |k, v|
|
|
138
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
else # model
|
|
142
|
+
_model = IronTitan.const_get(type).new
|
|
143
|
+
_model.build_from_hash(value)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def to_s
|
|
148
|
+
to_hash.to_s
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# to_body is an alias to to_body (backward compatibility))
|
|
152
|
+
def to_body
|
|
153
|
+
to_hash
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# return the object in the form of hash
|
|
157
|
+
def to_hash
|
|
158
|
+
hash = {}
|
|
159
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
160
|
+
value = self.send(attr)
|
|
161
|
+
next if value.nil?
|
|
162
|
+
hash[param] = _to_hash(value)
|
|
163
|
+
end
|
|
164
|
+
hash
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Method to output non-array value in the form of hash
|
|
168
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
169
|
+
def _to_hash(value)
|
|
170
|
+
if value.is_a?(Array)
|
|
171
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
172
|
+
elsif value.is_a?(Hash)
|
|
173
|
+
{}.tap do |hash|
|
|
174
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
175
|
+
end
|
|
176
|
+
elsif value.respond_to? :to_hash
|
|
177
|
+
value.to_hash
|
|
178
|
+
else
|
|
179
|
+
value
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
end
|
|
184
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Titan API
|
|
3
|
+
|
|
4
|
+
The ultimate, language agnostic, container based job processing framework.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 0.2.17
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module IronTitan
|
|
16
|
+
class ImageWrapper
|
|
17
|
+
attr_accessor :image
|
|
18
|
+
|
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
20
|
+
def self.attribute_map
|
|
21
|
+
{
|
|
22
|
+
|
|
23
|
+
:'image' => :'image'
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Attribute type mapping.
|
|
29
|
+
def self.swagger_types
|
|
30
|
+
{
|
|
31
|
+
:'image' => :'Image'
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize(attributes = {})
|
|
37
|
+
return unless attributes.is_a?(Hash)
|
|
38
|
+
|
|
39
|
+
# convert string to symbol for hash key
|
|
40
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if attributes[:'image']
|
|
44
|
+
self.image = attributes[:'image']
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Check equality by comparing each attribute.
|
|
50
|
+
def ==(o)
|
|
51
|
+
return true if self.equal?(o)
|
|
52
|
+
self.class == o.class &&
|
|
53
|
+
image == o.image
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @see the `==` method
|
|
57
|
+
def eql?(o)
|
|
58
|
+
self == o
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Calculate hash code according to all attributes.
|
|
62
|
+
def hash
|
|
63
|
+
[image].hash
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# build the object from hash
|
|
67
|
+
def build_from_hash(attributes)
|
|
68
|
+
return nil unless attributes.is_a?(Hash)
|
|
69
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
70
|
+
if type =~ /^Array<(.*)>/i
|
|
71
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
72
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
73
|
+
else
|
|
74
|
+
#TODO show warning in debug mode
|
|
75
|
+
end
|
|
76
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
77
|
+
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
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
self
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def _deserialize(type, value)
|
|
87
|
+
case type.to_sym
|
|
88
|
+
when :DateTime
|
|
89
|
+
DateTime.parse(value)
|
|
90
|
+
when :Date
|
|
91
|
+
Date.parse(value)
|
|
92
|
+
when :String
|
|
93
|
+
value.to_s
|
|
94
|
+
when :Integer
|
|
95
|
+
value.to_i
|
|
96
|
+
when :Float
|
|
97
|
+
value.to_f
|
|
98
|
+
when :BOOLEAN
|
|
99
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
|
100
|
+
true
|
|
101
|
+
else
|
|
102
|
+
false
|
|
103
|
+
end
|
|
104
|
+
when :Object
|
|
105
|
+
# generic object (usually a Hash), return directly
|
|
106
|
+
value
|
|
107
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
108
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
109
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
110
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
|
111
|
+
k_type = Regexp.last_match[:k_type]
|
|
112
|
+
v_type = Regexp.last_match[:v_type]
|
|
113
|
+
{}.tap do |hash|
|
|
114
|
+
value.each do |k, v|
|
|
115
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
else # model
|
|
119
|
+
_model = IronTitan.const_get(type).new
|
|
120
|
+
_model.build_from_hash(value)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def to_s
|
|
125
|
+
to_hash.to_s
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# to_body is an alias to to_body (backward compatibility))
|
|
129
|
+
def to_body
|
|
130
|
+
to_hash
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# return the object in the form of hash
|
|
134
|
+
def to_hash
|
|
135
|
+
hash = {}
|
|
136
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
137
|
+
value = self.send(attr)
|
|
138
|
+
next if value.nil?
|
|
139
|
+
hash[param] = _to_hash(value)
|
|
140
|
+
end
|
|
141
|
+
hash
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Method to output non-array value in the form of hash
|
|
145
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
146
|
+
def _to_hash(value)
|
|
147
|
+
if value.is_a?(Array)
|
|
148
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
149
|
+
elsif value.is_a?(Hash)
|
|
150
|
+
{}.tap do |hash|
|
|
151
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
152
|
+
end
|
|
153
|
+
elsif value.respond_to? :to_hash
|
|
154
|
+
value.to_hash
|
|
155
|
+
else
|
|
156
|
+
value
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
end
|
|
161
|
+
end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Titan API
|
|
3
|
+
|
|
4
|
+
The ultimate, language agnostic, container based job processing framework.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 0.2.17
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module IronTitan
|
|
16
|
+
class ImagesWrapper
|
|
17
|
+
attr_accessor :images
|
|
18
|
+
|
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
20
|
+
def self.attribute_map
|
|
21
|
+
{
|
|
22
|
+
|
|
23
|
+
:'images' => :'images'
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Attribute type mapping.
|
|
29
|
+
def self.swagger_types
|
|
30
|
+
{
|
|
31
|
+
:'images' => :'Array<Image>'
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize(attributes = {})
|
|
37
|
+
return unless attributes.is_a?(Hash)
|
|
38
|
+
|
|
39
|
+
# convert string to symbol for hash key
|
|
40
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if attributes[:'images']
|
|
44
|
+
if (value = attributes[:'images']).is_a?(Array)
|
|
45
|
+
self.images = value
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Check equality by comparing each attribute.
|
|
52
|
+
def ==(o)
|
|
53
|
+
return true if self.equal?(o)
|
|
54
|
+
self.class == o.class &&
|
|
55
|
+
images == o.images
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# @see the `==` method
|
|
59
|
+
def eql?(o)
|
|
60
|
+
self == o
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Calculate hash code according to all attributes.
|
|
64
|
+
def hash
|
|
65
|
+
[images].hash
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# build the object from hash
|
|
69
|
+
def build_from_hash(attributes)
|
|
70
|
+
return nil unless attributes.is_a?(Hash)
|
|
71
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
72
|
+
if type =~ /^Array<(.*)>/i
|
|
73
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
74
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
75
|
+
else
|
|
76
|
+
#TODO show warning in debug mode
|
|
77
|
+
end
|
|
78
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
79
|
+
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
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
self
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def _deserialize(type, value)
|
|
89
|
+
case type.to_sym
|
|
90
|
+
when :DateTime
|
|
91
|
+
DateTime.parse(value)
|
|
92
|
+
when :Date
|
|
93
|
+
Date.parse(value)
|
|
94
|
+
when :String
|
|
95
|
+
value.to_s
|
|
96
|
+
when :Integer
|
|
97
|
+
value.to_i
|
|
98
|
+
when :Float
|
|
99
|
+
value.to_f
|
|
100
|
+
when :BOOLEAN
|
|
101
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
|
102
|
+
true
|
|
103
|
+
else
|
|
104
|
+
false
|
|
105
|
+
end
|
|
106
|
+
when :Object
|
|
107
|
+
# generic object (usually a Hash), return directly
|
|
108
|
+
value
|
|
109
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
110
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
111
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
112
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
|
113
|
+
k_type = Regexp.last_match[:k_type]
|
|
114
|
+
v_type = Regexp.last_match[:v_type]
|
|
115
|
+
{}.tap do |hash|
|
|
116
|
+
value.each do |k, v|
|
|
117
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
else # model
|
|
121
|
+
_model = IronTitan.const_get(type).new
|
|
122
|
+
_model.build_from_hash(value)
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def to_s
|
|
127
|
+
to_hash.to_s
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# to_body is an alias to to_body (backward compatibility))
|
|
131
|
+
def to_body
|
|
132
|
+
to_hash
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# return the object in the form of hash
|
|
136
|
+
def to_hash
|
|
137
|
+
hash = {}
|
|
138
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
139
|
+
value = self.send(attr)
|
|
140
|
+
next if value.nil?
|
|
141
|
+
hash[param] = _to_hash(value)
|
|
142
|
+
end
|
|
143
|
+
hash
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Method to output non-array value in the form of hash
|
|
147
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
148
|
+
def _to_hash(value)
|
|
149
|
+
if value.is_a?(Array)
|
|
150
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
151
|
+
elsif value.is_a?(Hash)
|
|
152
|
+
{}.tap do |hash|
|
|
153
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
154
|
+
end
|
|
155
|
+
elsif value.respond_to? :to_hash
|
|
156
|
+
value.to_hash
|
|
157
|
+
else
|
|
158
|
+
value
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
end
|
|
163
|
+
end
|