triglav_client 0.1.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +79 -0
- data/LICENSE +201 -0
- data/README.md +136 -0
- data/Rakefile +1 -0
- data/docs/AggregatedResourceEachResponse.md +11 -0
- data/docs/AuthApi.md +150 -0
- data/docs/BulkinsertResponse.md +8 -0
- data/docs/Credential.md +10 -0
- data/docs/ErrorModel.md +9 -0
- data/docs/JobEachResponse.md +12 -0
- data/docs/JobMessageEachResponse.md +11 -0
- data/docs/JobMessagesApi.md +117 -0
- data/docs/JobRequest.md +12 -0
- data/docs/JobResponse.md +14 -0
- data/docs/JobsApi.md +217 -0
- data/docs/LastJobMessageIdResponse.md +8 -0
- data/docs/LastMessageIdResponse.md +8 -0
- data/docs/MessageEachResponse.md +16 -0
- data/docs/MessageFetchRequest.md +10 -0
- data/docs/MessageRequest.md +13 -0
- data/docs/MessageResponse.md +16 -0
- data/docs/MessagesApi.md +170 -0
- data/docs/ResourceEachResponse.md +13 -0
- data/docs/ResourceRequest.md +15 -0
- data/docs/ResourceResponse.md +17 -0
- data/docs/ResourcesApi.md +335 -0
- data/docs/TokenResponse.md +9 -0
- data/docs/UserEachResponse.md +11 -0
- data/docs/UserRequest.md +13 -0
- data/docs/UserResponse.md +15 -0
- data/docs/UsersApi.md +274 -0
- data/example/example.rb +40 -0
- data/git_push.sh +67 -0
- data/lib/triglav_client.rb +77 -0
- data/lib/triglav_client/api/auth_api.rb +196 -0
- data/lib/triglav_client/api/job_messages_api.rb +153 -0
- data/lib/triglav_client/api/jobs_api.rb +257 -0
- data/lib/triglav_client/api/messages_api.rb +208 -0
- data/lib/triglav_client/api/resources_api.rb +379 -0
- data/lib/triglav_client/api/users_api.rb +318 -0
- data/lib/triglav_client/api_client.rb +379 -0
- data/lib/triglav_client/api_error.rb +47 -0
- data/lib/triglav_client/configuration.rb +214 -0
- data/lib/triglav_client/models/aggregated_resource_each_response.rb +230 -0
- data/lib/triglav_client/models/bulkinsert_response.rb +200 -0
- data/lib/triglav_client/models/credential.rb +252 -0
- data/lib/triglav_client/models/error_model.rb +212 -0
- data/lib/triglav_client/models/job_each_response.rb +235 -0
- data/lib/triglav_client/models/job_message_each_response.rb +229 -0
- data/lib/triglav_client/models/job_request.rb +241 -0
- data/lib/triglav_client/models/job_response.rb +259 -0
- data/lib/triglav_client/models/last_job_message_id_response.rb +200 -0
- data/lib/triglav_client/models/last_message_id_response.rb +200 -0
- data/lib/triglav_client/models/message_each_response.rb +281 -0
- data/lib/triglav_client/models/message_fetch_request.rb +223 -0
- data/lib/triglav_client/models/message_request.rb +254 -0
- data/lib/triglav_client/models/message_response.rb +281 -0
- data/lib/triglav_client/models/resource_each_response.rb +250 -0
- data/lib/triglav_client/models/resource_request.rb +269 -0
- data/lib/triglav_client/models/resource_response.rb +287 -0
- data/lib/triglav_client/models/token_response.rb +208 -0
- data/lib/triglav_client/models/user_each_response.rb +262 -0
- data/lib/triglav_client/models/user_request.rb +280 -0
- data/lib/triglav_client/models/user_response.rb +300 -0
- data/lib/triglav_client/version.rb +26 -0
- data/spec/api/auth_api_spec.rb +80 -0
- data/spec/api/job_messages_api_spec.rb +71 -0
- data/spec/api/jobs_api_spec.rb +93 -0
- data/spec/api/messages_api_spec.rb +74 -0
- data/spec/api/resources_api_spec.rb +109 -0
- data/spec/api/users_api_spec.rb +106 -0
- data/spec/api_client_spec.rb +237 -0
- data/spec/configuration_spec.rb +53 -0
- data/spec/models/aggregated_resource_each_response_spec.rb +71 -0
- data/spec/models/bulkinsert_response_spec.rb +53 -0
- data/spec/models/credential_spec.rb +69 -0
- data/spec/models/error_model_spec.rb +59 -0
- data/spec/models/job_each_response_spec.rb +77 -0
- data/spec/models/job_message_each_response_spec.rb +65 -0
- data/spec/models/job_request_spec.rb +71 -0
- data/spec/models/job_response_spec.rb +89 -0
- data/spec/models/last_job_message_id_response_spec.rb +53 -0
- data/spec/models/last_message_id_response_spec.rb +53 -0
- data/spec/models/message_each_response_spec.rb +89 -0
- data/spec/models/message_fetch_request_spec.rb +65 -0
- data/spec/models/message_request_spec.rb +59 -0
- data/spec/models/message_response_spec.rb +89 -0
- data/spec/models/resource_each_response_spec.rb +71 -0
- data/spec/models/resource_request_spec.rb +83 -0
- data/spec/models/resource_response_spec.rb +101 -0
- data/spec/models/token_response_spec.rb +59 -0
- data/spec/models/user_each_response_spec.rb +75 -0
- data/spec/models/user_request_spec.rb +87 -0
- data/spec/models/user_response_spec.rb +99 -0
- data/spec/spec_helper.rb +122 -0
- data/triglav_client.gemspec +55 -0
- metadata +351 -0
@@ -0,0 +1,241 @@
|
|
1
|
+
=begin
|
2
|
+
#Triglav API
|
3
|
+
|
4
|
+
#Triglav API
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
Contact: triglav_admin_my@dena.jp
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'date'
|
25
|
+
|
26
|
+
module TriglavClient
|
27
|
+
|
28
|
+
class JobRequest
|
29
|
+
attr_accessor :id
|
30
|
+
|
31
|
+
attr_accessor :uri
|
32
|
+
|
33
|
+
attr_accessor :logical_op
|
34
|
+
|
35
|
+
# New resources are created if id is not given. Update if id is given
|
36
|
+
attr_accessor :input_resources
|
37
|
+
|
38
|
+
# New resources are created if id is not given. Update if id is given
|
39
|
+
attr_accessor :output_resources
|
40
|
+
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
:'id' => :'id',
|
46
|
+
:'uri' => :'uri',
|
47
|
+
:'logical_op' => :'logical_op',
|
48
|
+
:'input_resources' => :'input_resources',
|
49
|
+
:'output_resources' => :'output_resources'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.swagger_types
|
55
|
+
{
|
56
|
+
:'id' => :'Integer',
|
57
|
+
:'uri' => :'String',
|
58
|
+
:'logical_op' => :'String',
|
59
|
+
:'input_resources' => :'Array<ResourceRequest>',
|
60
|
+
:'output_resources' => :'Array<ResourceRequest>'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Initializes the object
|
65
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
66
|
+
def initialize(attributes = {})
|
67
|
+
return unless attributes.is_a?(Hash)
|
68
|
+
|
69
|
+
# convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
71
|
+
|
72
|
+
if attributes.has_key?(:'id')
|
73
|
+
self.id = attributes[:'id']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:'uri')
|
77
|
+
self.uri = attributes[:'uri']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:'logical_op')
|
81
|
+
self.logical_op = attributes[:'logical_op']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'input_resources')
|
85
|
+
if (value = attributes[:'input_resources']).is_a?(Array)
|
86
|
+
self.input_resources = value
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'output_resources')
|
91
|
+
if (value = attributes[:'output_resources']).is_a?(Array)
|
92
|
+
self.output_resources = value
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
99
|
+
# @return Array for valid properies with the reasons
|
100
|
+
def list_invalid_properties
|
101
|
+
invalid_properties = Array.new
|
102
|
+
return invalid_properties
|
103
|
+
end
|
104
|
+
|
105
|
+
# Check to see if the all the properties in the model are valid
|
106
|
+
# @return true if the model is valid
|
107
|
+
def valid?
|
108
|
+
return true
|
109
|
+
end
|
110
|
+
|
111
|
+
# Checks equality by comparing each attribute.
|
112
|
+
# @param [Object] Object to be compared
|
113
|
+
def ==(o)
|
114
|
+
return true if self.equal?(o)
|
115
|
+
self.class == o.class &&
|
116
|
+
id == o.id &&
|
117
|
+
uri == o.uri &&
|
118
|
+
logical_op == o.logical_op &&
|
119
|
+
input_resources == o.input_resources &&
|
120
|
+
output_resources == o.output_resources
|
121
|
+
end
|
122
|
+
|
123
|
+
# @see the `==` method
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def eql?(o)
|
126
|
+
self == o
|
127
|
+
end
|
128
|
+
|
129
|
+
# Calculates hash code according to all attributes.
|
130
|
+
# @return [Fixnum] Hash code
|
131
|
+
def hash
|
132
|
+
[id, uri, logical_op, input_resources, output_resources].hash
|
133
|
+
end
|
134
|
+
|
135
|
+
# Builds the object from hash
|
136
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
137
|
+
# @return [Object] Returns the model itself
|
138
|
+
def build_from_hash(attributes)
|
139
|
+
return nil unless attributes.is_a?(Hash)
|
140
|
+
self.class.swagger_types.each_pair do |key, type|
|
141
|
+
if type =~ /^Array<(.*)>/i
|
142
|
+
# check to ensure the input is an array given that the the attribute
|
143
|
+
# is documented as an array but the input is not
|
144
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
145
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
146
|
+
end
|
147
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
148
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
149
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
150
|
+
end
|
151
|
+
|
152
|
+
self
|
153
|
+
end
|
154
|
+
|
155
|
+
# Deserializes the data based on type
|
156
|
+
# @param string type Data type
|
157
|
+
# @param string value Value to be deserialized
|
158
|
+
# @return [Object] Deserialized data
|
159
|
+
def _deserialize(type, value)
|
160
|
+
case type.to_sym
|
161
|
+
when :DateTime
|
162
|
+
DateTime.parse(value)
|
163
|
+
when :Date
|
164
|
+
Date.parse(value)
|
165
|
+
when :String
|
166
|
+
value.to_s
|
167
|
+
when :Integer
|
168
|
+
value.to_i
|
169
|
+
when :Float
|
170
|
+
value.to_f
|
171
|
+
when :BOOLEAN
|
172
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
173
|
+
true
|
174
|
+
else
|
175
|
+
false
|
176
|
+
end
|
177
|
+
when :Object
|
178
|
+
# generic object (usually a Hash), return directly
|
179
|
+
value
|
180
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
181
|
+
inner_type = Regexp.last_match[:inner_type]
|
182
|
+
value.map { |v| _deserialize(inner_type, v) }
|
183
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
184
|
+
k_type = Regexp.last_match[:k_type]
|
185
|
+
v_type = Regexp.last_match[:v_type]
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each do |k, v|
|
188
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
else # model
|
192
|
+
temp_model = TriglavClient.const_get(type).new
|
193
|
+
temp_model.build_from_hash(value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# to_body is an alias to to_hash (backward compatibility)
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_body
|
206
|
+
to_hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the object in the form of hash
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_hash
|
212
|
+
hash = {}
|
213
|
+
self.class.attribute_map.each_pair do |attr, param|
|
214
|
+
value = self.send(attr)
|
215
|
+
next if value.nil?
|
216
|
+
hash[param] = _to_hash(value)
|
217
|
+
end
|
218
|
+
hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Outputs non-array value in the form of hash
|
222
|
+
# For object, use to_hash. Otherwise, just return the value
|
223
|
+
# @param [Object] value Any valid value
|
224
|
+
# @return [Hash] Returns the value in the form of hash
|
225
|
+
def _to_hash(value)
|
226
|
+
if value.is_a?(Array)
|
227
|
+
value.compact.map{ |v| _to_hash(v) }
|
228
|
+
elsif value.is_a?(Hash)
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
231
|
+
end
|
232
|
+
elsif value.respond_to? :to_hash
|
233
|
+
value.to_hash
|
234
|
+
else
|
235
|
+
value
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
@@ -0,0 +1,259 @@
|
|
1
|
+
=begin
|
2
|
+
#Triglav API
|
3
|
+
|
4
|
+
#Triglav API
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
Contact: triglav_admin_my@dena.jp
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'date'
|
25
|
+
|
26
|
+
module TriglavClient
|
27
|
+
|
28
|
+
class JobResponse
|
29
|
+
attr_accessor :id
|
30
|
+
|
31
|
+
attr_accessor :uri
|
32
|
+
|
33
|
+
attr_accessor :logical_op
|
34
|
+
|
35
|
+
# Input resources
|
36
|
+
attr_accessor :input_resources
|
37
|
+
|
38
|
+
# Output resources
|
39
|
+
attr_accessor :output_resources
|
40
|
+
|
41
|
+
attr_accessor :created_at
|
42
|
+
|
43
|
+
attr_accessor :updated_at
|
44
|
+
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'id' => :'id',
|
50
|
+
:'uri' => :'uri',
|
51
|
+
:'logical_op' => :'logical_op',
|
52
|
+
:'input_resources' => :'input_resources',
|
53
|
+
:'output_resources' => :'output_resources',
|
54
|
+
:'created_at' => :'created_at',
|
55
|
+
:'updated_at' => :'updated_at'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Attribute type mapping.
|
60
|
+
def self.swagger_types
|
61
|
+
{
|
62
|
+
:'id' => :'Integer',
|
63
|
+
:'uri' => :'String',
|
64
|
+
:'logical_op' => :'String',
|
65
|
+
:'input_resources' => :'Array<ResourceResponse>',
|
66
|
+
:'output_resources' => :'Array<ResourceResponse>',
|
67
|
+
:'created_at' => :'DateTime',
|
68
|
+
:'updated_at' => :'DateTime'
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initializes the object
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
def initialize(attributes = {})
|
75
|
+
return unless attributes.is_a?(Hash)
|
76
|
+
|
77
|
+
# convert string to symbol for hash key
|
78
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
79
|
+
|
80
|
+
if attributes.has_key?(:'id')
|
81
|
+
self.id = attributes[:'id']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'uri')
|
85
|
+
self.uri = attributes[:'uri']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:'logical_op')
|
89
|
+
self.logical_op = attributes[:'logical_op']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:'input_resources')
|
93
|
+
if (value = attributes[:'input_resources']).is_a?(Array)
|
94
|
+
self.input_resources = value
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'output_resources')
|
99
|
+
if (value = attributes[:'output_resources']).is_a?(Array)
|
100
|
+
self.output_resources = value
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:'created_at')
|
105
|
+
self.created_at = attributes[:'created_at']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.has_key?(:'updated_at')
|
109
|
+
self.updated_at = attributes[:'updated_at']
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
115
|
+
# @return Array for valid properies with the reasons
|
116
|
+
def list_invalid_properties
|
117
|
+
invalid_properties = Array.new
|
118
|
+
return invalid_properties
|
119
|
+
end
|
120
|
+
|
121
|
+
# Check to see if the all the properties in the model are valid
|
122
|
+
# @return true if the model is valid
|
123
|
+
def valid?
|
124
|
+
return true
|
125
|
+
end
|
126
|
+
|
127
|
+
# Checks equality by comparing each attribute.
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def ==(o)
|
130
|
+
return true if self.equal?(o)
|
131
|
+
self.class == o.class &&
|
132
|
+
id == o.id &&
|
133
|
+
uri == o.uri &&
|
134
|
+
logical_op == o.logical_op &&
|
135
|
+
input_resources == o.input_resources &&
|
136
|
+
output_resources == o.output_resources &&
|
137
|
+
created_at == o.created_at &&
|
138
|
+
updated_at == o.updated_at
|
139
|
+
end
|
140
|
+
|
141
|
+
# @see the `==` method
|
142
|
+
# @param [Object] Object to be compared
|
143
|
+
def eql?(o)
|
144
|
+
self == o
|
145
|
+
end
|
146
|
+
|
147
|
+
# Calculates hash code according to all attributes.
|
148
|
+
# @return [Fixnum] Hash code
|
149
|
+
def hash
|
150
|
+
[id, uri, logical_op, input_resources, output_resources, created_at, updated_at].hash
|
151
|
+
end
|
152
|
+
|
153
|
+
# Builds the object from hash
|
154
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
155
|
+
# @return [Object] Returns the model itself
|
156
|
+
def build_from_hash(attributes)
|
157
|
+
return nil unless attributes.is_a?(Hash)
|
158
|
+
self.class.swagger_types.each_pair do |key, type|
|
159
|
+
if type =~ /^Array<(.*)>/i
|
160
|
+
# check to ensure the input is an array given that the the attribute
|
161
|
+
# is documented as an array but the input is not
|
162
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
163
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
164
|
+
end
|
165
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
166
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
167
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
168
|
+
end
|
169
|
+
|
170
|
+
self
|
171
|
+
end
|
172
|
+
|
173
|
+
# Deserializes the data based on type
|
174
|
+
# @param string type Data type
|
175
|
+
# @param string value Value to be deserialized
|
176
|
+
# @return [Object] Deserialized data
|
177
|
+
def _deserialize(type, value)
|
178
|
+
case type.to_sym
|
179
|
+
when :DateTime
|
180
|
+
DateTime.parse(value)
|
181
|
+
when :Date
|
182
|
+
Date.parse(value)
|
183
|
+
when :String
|
184
|
+
value.to_s
|
185
|
+
when :Integer
|
186
|
+
value.to_i
|
187
|
+
when :Float
|
188
|
+
value.to_f
|
189
|
+
when :BOOLEAN
|
190
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
191
|
+
true
|
192
|
+
else
|
193
|
+
false
|
194
|
+
end
|
195
|
+
when :Object
|
196
|
+
# generic object (usually a Hash), return directly
|
197
|
+
value
|
198
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
199
|
+
inner_type = Regexp.last_match[:inner_type]
|
200
|
+
value.map { |v| _deserialize(inner_type, v) }
|
201
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
202
|
+
k_type = Regexp.last_match[:k_type]
|
203
|
+
v_type = Regexp.last_match[:v_type]
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each do |k, v|
|
206
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
else # model
|
210
|
+
temp_model = TriglavClient.const_get(type).new
|
211
|
+
temp_model.build_from_hash(value)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the string representation of the object
|
216
|
+
# @return [String] String presentation of the object
|
217
|
+
def to_s
|
218
|
+
to_hash.to_s
|
219
|
+
end
|
220
|
+
|
221
|
+
# to_body is an alias to to_hash (backward compatibility)
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_body
|
224
|
+
to_hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Returns the object in the form of hash
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_hash
|
230
|
+
hash = {}
|
231
|
+
self.class.attribute_map.each_pair do |attr, param|
|
232
|
+
value = self.send(attr)
|
233
|
+
next if value.nil?
|
234
|
+
hash[param] = _to_hash(value)
|
235
|
+
end
|
236
|
+
hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map{ |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|