rokka_client_codegen 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +123 -0
- data/Rakefile +8 -0
- data/config.json +5 -0
- data/docs/AdminApi.md +398 -0
- data/docs/ListSourceImagesResponse.md +11 -0
- data/docs/ListStacksResponse.md +8 -0
- data/docs/Membership.md +11 -0
- data/docs/Organization.md +14 -0
- data/docs/OrganizationDefinition.md +10 -0
- data/docs/OrganizationOptions.md +10 -0
- data/docs/Role.md +8 -0
- data/docs/SourceImage.md +24 -0
- data/docs/SourceimagesApi.md +1032 -0
- data/docs/Stack.md +14 -0
- data/docs/StackDefinition.md +10 -0
- data/docs/StackExpression.md +9 -0
- data/docs/StackExpressionOverrides.md +8 -0
- data/docs/StackOperation.md +9 -0
- data/docs/StackOperationDescription.md +11 -0
- data/docs/StackOptions.md +8 -0
- data/docs/StacksApi.md +329 -0
- data/docs/User.md +11 -0
- data/docs/UserDefinition.md +9 -0
- data/examples/createstack.rb +33 -0
- data/examples/liststacks.rb +19 -0
- data/examples/setsubjectarea.rb +37 -0
- data/examples/uploadimage.rb +28 -0
- data/generate.sh +3 -0
- data/git_push.sh +55 -0
- data/lib/rokka_client_codegen.rb +59 -0
- data/lib/rokka_client_codegen/api/admin_api.rb +439 -0
- data/lib/rokka_client_codegen/api/sourceimages_api.rb +1225 -0
- data/lib/rokka_client_codegen/api/stacks_api.rb +371 -0
- data/lib/rokka_client_codegen/api_client.rb +389 -0
- data/lib/rokka_client_codegen/api_error.rb +38 -0
- data/lib/rokka_client_codegen/configuration.rb +209 -0
- data/lib/rokka_client_codegen/models/list_source_images_response.rb +217 -0
- data/lib/rokka_client_codegen/models/list_stacks_response.rb +190 -0
- data/lib/rokka_client_codegen/models/membership.rb +215 -0
- data/lib/rokka_client_codegen/models/organization.rb +264 -0
- data/lib/rokka_client_codegen/models/organization_definition.rb +211 -0
- data/lib/rokka_client_codegen/models/organization_options.rb +208 -0
- data/lib/rokka_client_codegen/models/role.rb +194 -0
- data/lib/rokka_client_codegen/models/source_image.rb +333 -0
- data/lib/rokka_client_codegen/models/stack.rb +246 -0
- data/lib/rokka_client_codegen/models/stack_definition.rb +217 -0
- data/lib/rokka_client_codegen/models/stack_expression.rb +207 -0
- data/lib/rokka_client_codegen/models/stack_expression_overrides.rb +188 -0
- data/lib/rokka_client_codegen/models/stack_operation.rb +203 -0
- data/lib/rokka_client_codegen/models/stack_operation_description.rb +231 -0
- data/lib/rokka_client_codegen/models/stack_options.rb +193 -0
- data/lib/rokka_client_codegen/models/user.rb +216 -0
- data/lib/rokka_client_codegen/models/user_definition.rb +204 -0
- data/lib/rokka_client_codegen/version.rb +15 -0
- data/patches/README.patch +59 -0
- data/patches/sourceimage_hash_long_hash.patch +62 -0
- data/rokka_client_codegen.gemspec +45 -0
- data/spec/api/admin_api_spec.rb +125 -0
- data/spec/api/sourceimages_api_spec.rb +274 -0
- data/spec/api/stacks_api_spec.rb +110 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/list_source_images_response_spec.rb +60 -0
- data/spec/models/list_stacks_response_spec.rb +42 -0
- data/spec/models/membership_spec.rb +60 -0
- data/spec/models/organization_definition_spec.rb +54 -0
- data/spec/models/organization_options_spec.rb +54 -0
- data/spec/models/organization_spec.rb +78 -0
- data/spec/models/role_spec.rb +42 -0
- data/spec/models/source_image_spec.rb +138 -0
- data/spec/models/stack_definition_spec.rb +54 -0
- data/spec/models/stack_expression_overrides_spec.rb +42 -0
- data/spec/models/stack_expression_spec.rb +48 -0
- data/spec/models/stack_operation_description_spec.rb +60 -0
- data/spec/models/stack_operation_spec.rb +48 -0
- data/spec/models/stack_options_spec.rb +42 -0
- data/spec/models/stack_spec.rb +78 -0
- data/spec/models/user_definition_spec.rb +48 -0
- data/spec/models/user_spec.rb +60 -0
- data/spec/spec_helper.rb +111 -0
- metadata +330 -0
@@ -0,0 +1,333 @@
|
|
1
|
+
=begin
|
2
|
+
#rokka.io
|
3
|
+
|
4
|
+
#digital image processing done right. [Documentation](https://rokka.io/documentation). [Changelog](https://api.rokka.io/changelog.md).
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module RokkaClientCodegen
|
16
|
+
|
17
|
+
class SourceImage
|
18
|
+
attr_accessor :long_hash
|
19
|
+
|
20
|
+
attr_accessor :short_hash
|
21
|
+
|
22
|
+
attr_accessor :binary_hash
|
23
|
+
|
24
|
+
attr_accessor :created
|
25
|
+
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
attr_accessor :mimetype
|
29
|
+
|
30
|
+
attr_accessor :format
|
31
|
+
|
32
|
+
attr_accessor :size
|
33
|
+
|
34
|
+
attr_accessor :width
|
35
|
+
|
36
|
+
attr_accessor :height
|
37
|
+
|
38
|
+
attr_accessor :organization
|
39
|
+
|
40
|
+
attr_accessor :link
|
41
|
+
|
42
|
+
attr_accessor :dynamic_metadata
|
43
|
+
|
44
|
+
attr_accessor :static_metadata
|
45
|
+
|
46
|
+
attr_accessor :user_metadata
|
47
|
+
|
48
|
+
# Null as default (means false)
|
49
|
+
attr_accessor :deleted
|
50
|
+
|
51
|
+
attr_accessor :deleted_date
|
52
|
+
|
53
|
+
|
54
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
55
|
+
def self.attribute_map
|
56
|
+
{
|
57
|
+
:'long_hash' => :'hash',
|
58
|
+
:'short_hash' => :'short_hash',
|
59
|
+
:'binary_hash' => :'binary_hash',
|
60
|
+
:'created' => :'created',
|
61
|
+
:'name' => :'name',
|
62
|
+
:'mimetype' => :'mimetype',
|
63
|
+
:'format' => :'format',
|
64
|
+
:'size' => :'size',
|
65
|
+
:'width' => :'width',
|
66
|
+
:'height' => :'height',
|
67
|
+
:'organization' => :'organization',
|
68
|
+
:'link' => :'link',
|
69
|
+
:'dynamic_metadata' => :'dynamic_metadata',
|
70
|
+
:'static_metadata' => :'static_metadata',
|
71
|
+
:'user_metadata' => :'user_metadata',
|
72
|
+
:'deleted' => :'deleted',
|
73
|
+
:'deleted_date' => :'deleted_date'
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
# Attribute type mapping.
|
78
|
+
def self.swagger_types
|
79
|
+
{
|
80
|
+
:'long_hash' => :'String',
|
81
|
+
:'short_hash' => :'String',
|
82
|
+
:'binary_hash' => :'String',
|
83
|
+
:'created' => :'DateTime',
|
84
|
+
:'name' => :'String',
|
85
|
+
:'mimetype' => :'String',
|
86
|
+
:'format' => :'String',
|
87
|
+
:'size' => :'Integer',
|
88
|
+
:'width' => :'Integer',
|
89
|
+
:'height' => :'Integer',
|
90
|
+
:'organization' => :'String',
|
91
|
+
:'link' => :'String',
|
92
|
+
:'dynamic_metadata' => :'Object',
|
93
|
+
:'static_metadata' => :'Object',
|
94
|
+
:'user_metadata' => :'Object',
|
95
|
+
:'deleted' => :'BOOLEAN',
|
96
|
+
:'deleted_date' => :'DateTime'
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
# Initializes the object
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
def initialize(attributes = {})
|
103
|
+
return unless attributes.is_a?(Hash)
|
104
|
+
|
105
|
+
# convert string to symbol for hash key
|
106
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
107
|
+
|
108
|
+
if attributes.has_key?(:'hash')
|
109
|
+
self.long_hash = attributes[:'hash']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.has_key?(:'short_hash')
|
113
|
+
self.short_hash = attributes[:'short_hash']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.has_key?(:'binary_hash')
|
117
|
+
self.binary_hash = attributes[:'binary_hash']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.has_key?(:'created')
|
121
|
+
self.created = attributes[:'created']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'name')
|
125
|
+
self.name = attributes[:'name']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'mimetype')
|
129
|
+
self.mimetype = attributes[:'mimetype']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'format')
|
133
|
+
self.format = attributes[:'format']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'size')
|
137
|
+
self.size = attributes[:'size']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'width')
|
141
|
+
self.width = attributes[:'width']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.has_key?(:'height')
|
145
|
+
self.height = attributes[:'height']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.has_key?(:'organization')
|
149
|
+
self.organization = attributes[:'organization']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.has_key?(:'link')
|
153
|
+
self.link = attributes[:'link']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.has_key?(:'dynamic_metadata')
|
157
|
+
self.dynamic_metadata = attributes[:'dynamic_metadata']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.has_key?(:'static_metadata')
|
161
|
+
self.static_metadata = attributes[:'static_metadata']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.has_key?(:'user_metadata')
|
165
|
+
self.user_metadata = attributes[:'user_metadata']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.has_key?(:'deleted')
|
169
|
+
self.deleted = attributes[:'deleted']
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.has_key?(:'deleted_date')
|
173
|
+
self.deleted_date = attributes[:'deleted_date']
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
179
|
+
# @return Array for valid properties with the reasons
|
180
|
+
def list_invalid_properties
|
181
|
+
invalid_properties = Array.new
|
182
|
+
return invalid_properties
|
183
|
+
end
|
184
|
+
|
185
|
+
# Check to see if the all the properties in the model are valid
|
186
|
+
# @return true if the model is valid
|
187
|
+
def valid?
|
188
|
+
return true
|
189
|
+
end
|
190
|
+
|
191
|
+
# Checks equality by comparing each attribute.
|
192
|
+
# @param [Object] Object to be compared
|
193
|
+
def ==(o)
|
194
|
+
return true if self.equal?(o)
|
195
|
+
self.class == o.class &&
|
196
|
+
hash == o.hash &&
|
197
|
+
short_hash == o.short_hash &&
|
198
|
+
binary_hash == o.binary_hash &&
|
199
|
+
created == o.created &&
|
200
|
+
name == o.name &&
|
201
|
+
mimetype == o.mimetype &&
|
202
|
+
format == o.format &&
|
203
|
+
size == o.size &&
|
204
|
+
width == o.width &&
|
205
|
+
height == o.height &&
|
206
|
+
organization == o.organization &&
|
207
|
+
link == o.link &&
|
208
|
+
dynamic_metadata == o.dynamic_metadata &&
|
209
|
+
static_metadata == o.static_metadata &&
|
210
|
+
user_metadata == o.user_metadata &&
|
211
|
+
deleted == o.deleted &&
|
212
|
+
deleted_date == o.deleted_date
|
213
|
+
end
|
214
|
+
|
215
|
+
# @see the `==` method
|
216
|
+
# @param [Object] Object to be compared
|
217
|
+
def eql?(o)
|
218
|
+
self == o
|
219
|
+
end
|
220
|
+
|
221
|
+
# Calculates hash code according to all attributes.
|
222
|
+
# @return [Fixnum] Hash code
|
223
|
+
def hash
|
224
|
+
[long_hash, short_hash, binary_hash, created, name, mimetype, format, size, width, height, organization, link, dynamic_metadata, static_metadata, user_metadata, deleted, deleted_date].hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Builds the object from hash
|
228
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
229
|
+
# @return [Object] Returns the model itself
|
230
|
+
def build_from_hash(attributes)
|
231
|
+
return nil unless attributes.is_a?(Hash)
|
232
|
+
self.class.swagger_types.each_pair do |key, type|
|
233
|
+
if type =~ /\AArray<(.*)>/i
|
234
|
+
# check to ensure the input is an array given that the the attribute
|
235
|
+
# is documented as an array but the input is not
|
236
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
237
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
238
|
+
end
|
239
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
240
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
241
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
242
|
+
end
|
243
|
+
|
244
|
+
self
|
245
|
+
end
|
246
|
+
|
247
|
+
# Deserializes the data based on type
|
248
|
+
# @param string type Data type
|
249
|
+
# @param string value Value to be deserialized
|
250
|
+
# @return [Object] Deserialized data
|
251
|
+
def _deserialize(type, value)
|
252
|
+
case type.to_sym
|
253
|
+
when :DateTime
|
254
|
+
DateTime.parse(value)
|
255
|
+
when :Date
|
256
|
+
Date.parse(value)
|
257
|
+
when :String
|
258
|
+
value.to_s
|
259
|
+
when :Integer
|
260
|
+
value.to_i
|
261
|
+
when :Float
|
262
|
+
value.to_f
|
263
|
+
when :BOOLEAN
|
264
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
265
|
+
true
|
266
|
+
else
|
267
|
+
false
|
268
|
+
end
|
269
|
+
when :Object
|
270
|
+
# generic object (usually a Hash), return directly
|
271
|
+
value
|
272
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
273
|
+
inner_type = Regexp.last_match[:inner_type]
|
274
|
+
value.map { |v| _deserialize(inner_type, v) }
|
275
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
276
|
+
k_type = Regexp.last_match[:k_type]
|
277
|
+
v_type = Regexp.last_match[:v_type]
|
278
|
+
{}.tap do |hash|
|
279
|
+
value.each do |k, v|
|
280
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
else # model
|
284
|
+
temp_model = RokkaClientCodegen.const_get(type).new
|
285
|
+
temp_model.build_from_hash(value)
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
# Returns the string representation of the object
|
290
|
+
# @return [String] String presentation of the object
|
291
|
+
def to_s
|
292
|
+
to_hash.to_s
|
293
|
+
end
|
294
|
+
|
295
|
+
# to_body is an alias to to_hash (backward compatibility)
|
296
|
+
# @return [Hash] Returns the object in the form of hash
|
297
|
+
def to_body
|
298
|
+
to_hash
|
299
|
+
end
|
300
|
+
|
301
|
+
# Returns the object in the form of hash
|
302
|
+
# @return [Hash] Returns the object in the form of hash
|
303
|
+
def to_hash
|
304
|
+
hash = {}
|
305
|
+
self.class.attribute_map.each_pair do |attr, param|
|
306
|
+
value = self.send(attr)
|
307
|
+
next if value.nil?
|
308
|
+
hash[param] = _to_hash(value)
|
309
|
+
end
|
310
|
+
hash
|
311
|
+
end
|
312
|
+
|
313
|
+
# Outputs non-array value in the form of hash
|
314
|
+
# For object, use to_hash. Otherwise, just return the value
|
315
|
+
# @param [Object] value Any valid value
|
316
|
+
# @return [Hash] Returns the value in the form of hash
|
317
|
+
def _to_hash(value)
|
318
|
+
if value.is_a?(Array)
|
319
|
+
value.compact.map{ |v| _to_hash(v) }
|
320
|
+
elsif value.is_a?(Hash)
|
321
|
+
{}.tap do |hash|
|
322
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
323
|
+
end
|
324
|
+
elsif value.respond_to? :to_hash
|
325
|
+
value.to_hash
|
326
|
+
else
|
327
|
+
value
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
|
333
|
+
end
|
@@ -0,0 +1,246 @@
|
|
1
|
+
=begin
|
2
|
+
#rokka.io
|
3
|
+
|
4
|
+
#digital image processing done right. [Documentation](https://rokka.io/documentation). [Changelog](https://api.rokka.io/changelog.md).
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module RokkaClientCodegen
|
16
|
+
|
17
|
+
class Stack
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
attr_accessor :organization
|
21
|
+
|
22
|
+
attr_accessor :created
|
23
|
+
|
24
|
+
attr_accessor :stack_operations
|
25
|
+
|
26
|
+
attr_accessor :stack_options
|
27
|
+
|
28
|
+
attr_accessor :stack_expressions
|
29
|
+
|
30
|
+
attr_accessor :link
|
31
|
+
|
32
|
+
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
+
def self.attribute_map
|
35
|
+
{
|
36
|
+
:'name' => :'name',
|
37
|
+
:'organization' => :'organization',
|
38
|
+
:'created' => :'created',
|
39
|
+
:'stack_operations' => :'stack_operations',
|
40
|
+
:'stack_options' => :'stack_options',
|
41
|
+
:'stack_expressions' => :'stack_expressions',
|
42
|
+
:'link' => :'link'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute type mapping.
|
47
|
+
def self.swagger_types
|
48
|
+
{
|
49
|
+
:'name' => :'String',
|
50
|
+
:'organization' => :'String',
|
51
|
+
:'created' => :'DateTime',
|
52
|
+
:'stack_operations' => :'Array<StackOperation>',
|
53
|
+
:'stack_options' => :'Object',
|
54
|
+
:'stack_expressions' => :'Array<StackExpression>',
|
55
|
+
:'link' => :'String'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initializes the object
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
+
def initialize(attributes = {})
|
62
|
+
return unless attributes.is_a?(Hash)
|
63
|
+
|
64
|
+
# convert string to symbol for hash key
|
65
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
66
|
+
|
67
|
+
if attributes.has_key?(:'name')
|
68
|
+
self.name = attributes[:'name']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.has_key?(:'organization')
|
72
|
+
self.organization = attributes[:'organization']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.has_key?(:'created')
|
76
|
+
self.created = attributes[:'created']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.has_key?(:'stack_operations')
|
80
|
+
if (value = attributes[:'stack_operations']).is_a?(Array)
|
81
|
+
self.stack_operations = value
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'stack_options')
|
86
|
+
self.stack_options = attributes[:'stack_options']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'stack_expressions')
|
90
|
+
if (value = attributes[:'stack_expressions']).is_a?(Array)
|
91
|
+
self.stack_expressions = value
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'link')
|
96
|
+
self.link = attributes[:'link']
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
102
|
+
# @return Array for valid properties with the reasons
|
103
|
+
def list_invalid_properties
|
104
|
+
invalid_properties = Array.new
|
105
|
+
return invalid_properties
|
106
|
+
end
|
107
|
+
|
108
|
+
# Check to see if the all the properties in the model are valid
|
109
|
+
# @return true if the model is valid
|
110
|
+
def valid?
|
111
|
+
return true
|
112
|
+
end
|
113
|
+
|
114
|
+
# Checks equality by comparing each attribute.
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def ==(o)
|
117
|
+
return true if self.equal?(o)
|
118
|
+
self.class == o.class &&
|
119
|
+
name == o.name &&
|
120
|
+
organization == o.organization &&
|
121
|
+
created == o.created &&
|
122
|
+
stack_operations == o.stack_operations &&
|
123
|
+
stack_options == o.stack_options &&
|
124
|
+
stack_expressions == o.stack_expressions &&
|
125
|
+
link == o.link
|
126
|
+
end
|
127
|
+
|
128
|
+
# @see the `==` method
|
129
|
+
# @param [Object] Object to be compared
|
130
|
+
def eql?(o)
|
131
|
+
self == o
|
132
|
+
end
|
133
|
+
|
134
|
+
# Calculates hash code according to all attributes.
|
135
|
+
# @return [Fixnum] Hash code
|
136
|
+
def hash
|
137
|
+
[name, organization, created, stack_operations, stack_options, stack_expressions, link].hash
|
138
|
+
end
|
139
|
+
|
140
|
+
# Builds the object from hash
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
# @return [Object] Returns the model itself
|
143
|
+
def build_from_hash(attributes)
|
144
|
+
return nil unless attributes.is_a?(Hash)
|
145
|
+
self.class.swagger_types.each_pair do |key, type|
|
146
|
+
if type =~ /\AArray<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
151
|
+
end
|
152
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
153
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
154
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
# Deserializes the data based on type
|
161
|
+
# @param string type Data type
|
162
|
+
# @param string value Value to be deserialized
|
163
|
+
# @return [Object] Deserialized data
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :DateTime
|
167
|
+
DateTime.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :BOOLEAN
|
177
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
temp_model = RokkaClientCodegen.const_get(type).new
|
198
|
+
temp_model.build_from_hash(value)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns the string representation of the object
|
203
|
+
# @return [String] String presentation of the object
|
204
|
+
def to_s
|
205
|
+
to_hash.to_s
|
206
|
+
end
|
207
|
+
|
208
|
+
# to_body is an alias to to_hash (backward compatibility)
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
210
|
+
def to_body
|
211
|
+
to_hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Returns the object in the form of hash
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
216
|
+
def to_hash
|
217
|
+
hash = {}
|
218
|
+
self.class.attribute_map.each_pair do |attr, param|
|
219
|
+
value = self.send(attr)
|
220
|
+
next if value.nil?
|
221
|
+
hash[param] = _to_hash(value)
|
222
|
+
end
|
223
|
+
hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Outputs non-array value in the form of hash
|
227
|
+
# For object, use to_hash. Otherwise, just return the value
|
228
|
+
# @param [Object] value Any valid value
|
229
|
+
# @return [Hash] Returns the value in the form of hash
|
230
|
+
def _to_hash(value)
|
231
|
+
if value.is_a?(Array)
|
232
|
+
value.compact.map{ |v| _to_hash(v) }
|
233
|
+
elsif value.is_a?(Hash)
|
234
|
+
{}.tap do |hash|
|
235
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
236
|
+
end
|
237
|
+
elsif value.respond_to? :to_hash
|
238
|
+
value.to_hash
|
239
|
+
else
|
240
|
+
value
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|