spinnaker-gate-ruby-client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +85 -0
- data/LICENSE +201 -0
- data/README.md +240 -0
- data/Rakefile +8 -0
- data/docs/Account.md +14 -0
- data/docs/AccountDetails.md +19 -0
- data/docs/AmazonInfrastructureControllerApi.md +128 -0
- data/docs/ApplicationControllerApi.md +754 -0
- data/docs/ArtifactControllerApi.md +111 -0
- data/docs/AuthControllerApi.md +212 -0
- data/docs/BakeControllerApi.md +143 -0
- data/docs/BuildControllerApi.md +493 -0
- data/docs/ClusterControllerApi.md +475 -0
- data/docs/ConcourseControllerApi.md +161 -0
- data/docs/CredentialsControllerApi.md +129 -0
- data/docs/EcsServerGroupEventsControllerApi.md +66 -0
- data/docs/ExecutionsControllerApi.md +133 -0
- data/docs/FirewallControllerApi.md +171 -0
- data/docs/GrantedAuthority.md +8 -0
- data/docs/HashMapstringobject.md +7 -0
- data/docs/HttpEntity.md +8 -0
- data/docs/ImageControllerApi.md +178 -0
- data/docs/InstanceControllerApi.md +122 -0
- data/docs/JobControllerApi.md +69 -0
- data/docs/LoadBalancerControllerApi.md +217 -0
- data/docs/Mapstringstring.md +7 -0
- data/docs/NetworkControllerApi.md +105 -0
- data/docs/PipelineConfigControllerApi.md +144 -0
- data/docs/PipelineControllerApi.md +1074 -0
- data/docs/PipelineTemplateDependent.md +10 -0
- data/docs/PipelineTemplatesControllerApi.md +350 -0
- data/docs/ProjectControllerApi.md +196 -0
- data/docs/PubsubSubscriptionControllerApi.md +48 -0
- data/docs/ReorderPipelinesCommand.md +9 -0
- data/docs/ReorderPipelinesControllerApi.md +54 -0
- data/docs/ResponseEntity.md +10 -0
- data/docs/SearchControllerApi.md +68 -0
- data/docs/SecurityGroupControllerApi.md +171 -0
- data/docs/ServerGroupControllerApi.md +125 -0
- data/docs/ServerGroupManagerControllerApi.md +54 -0
- data/docs/SnapshotControllerApi.md +110 -0
- data/docs/SubnetControllerApi.md +58 -0
- data/docs/TaskControllerApi.md +291 -0
- data/docs/User.md +18 -0
- data/docs/V2CanaryConfigControllerApi.md +259 -0
- data/docs/V2CanaryControllerApi.md +356 -0
- data/docs/V2PipelineTemplatesControllerApi.md +356 -0
- data/docs/Version.md +8 -0
- data/docs/VersionControllerApi.md +48 -0
- data/docs/WebhookControllerApi.md +105 -0
- data/git_push.sh +55 -0
- data/lib/swagger_client.rb +85 -0
- data/lib/swagger_client/api/amazon_infrastructure_controller_api.rb +161 -0
- data/lib/swagger_client/api/application_controller_api.rb +868 -0
- data/lib/swagger_client/api/artifact_controller_api.rb +141 -0
- data/lib/swagger_client/api/auth_controller_api.rb +258 -0
- data/lib/swagger_client/api/bake_controller_api.rb +179 -0
- data/lib/swagger_client/api/build_controller_api.rb +588 -0
- data/lib/swagger_client/api/cluster_controller_api.rb +591 -0
- data/lib/swagger_client/api/concourse_controller_api.rb +209 -0
- data/lib/swagger_client/api/credentials_controller_api.rb +163 -0
- data/lib/swagger_client/api/ecs_server_group_events_controller_api.rb +101 -0
- data/lib/swagger_client/api/executions_controller_api.rb +169 -0
- data/lib/swagger_client/api/firewall_controller_api.rb +209 -0
- data/lib/swagger_client/api/image_controller_api.rb +222 -0
- data/lib/swagger_client/api/instance_controller_api.rb +160 -0
- data/lib/swagger_client/api/job_controller_api.rb +99 -0
- data/lib/swagger_client/api/load_balancer_controller_api.rb +258 -0
- data/lib/swagger_client/api/network_controller_api.rb +127 -0
- data/lib/swagger_client/api/pipeline_config_controller_api.rb +176 -0
- data/lib/swagger_client/api/pipeline_controller_api.rb +1268 -0
- data/lib/swagger_client/api/pipeline_templates_controller_api.rb +404 -0
- data/lib/swagger_client/api/project_controller_api.rb +234 -0
- data/lib/swagger_client/api/pubsub_subscription_controller_api.rb +69 -0
- data/lib/swagger_client/api/reorder_pipelines_controller_api.rb +75 -0
- data/lib/swagger_client/api/search_controller_api.rb +94 -0
- data/lib/swagger_client/api/security_group_controller_api.rb +209 -0
- data/lib/swagger_client/api/server_group_controller_api.rb +163 -0
- data/lib/swagger_client/api/server_group_manager_controller_api.rb +75 -0
- data/lib/swagger_client/api/snapshot_controller_api.rb +142 -0
- data/lib/swagger_client/api/subnet_controller_api.rb +78 -0
- data/lib/swagger_client/api/task_controller_api.rb +345 -0
- data/lib/swagger_client/api/v2_canary_config_controller_api.rb +300 -0
- data/lib/swagger_client/api/v2_canary_controller_api.rb +421 -0
- data/lib/swagger_client/api/v2_pipeline_templates_controller_api.rb +412 -0
- data/lib/swagger_client/api/version_controller_api.rb +69 -0
- data/lib/swagger_client/api/webhook_controller_api.rb +135 -0
- data/lib/swagger_client/api_client.rb +388 -0
- data/lib/swagger_client/api_error.rb +38 -0
- data/lib/swagger_client/configuration.rb +202 -0
- data/lib/swagger_client/models/account.rb +241 -0
- data/lib/swagger_client/models/account_details.rb +286 -0
- data/lib/swagger_client/models/granted_authority.rb +183 -0
- data/lib/swagger_client/models/hash_mapstringobject.rb +174 -0
- data/lib/swagger_client/models/http_entity.rb +183 -0
- data/lib/swagger_client/models/mapstringstring.rb +174 -0
- data/lib/swagger_client/models/pipeline_template_dependent.rb +201 -0
- data/lib/swagger_client/models/reorder_pipelines_command.rb +194 -0
- data/lib/swagger_client/models/response_entity.rb +235 -0
- data/lib/swagger_client/models/user.rb +279 -0
- data/lib/swagger_client/models/version.rb +183 -0
- data/lib/swagger_client/version.rb +15 -0
- data/spec/api/amazon_infrastructure_controller_api_spec.rb +65 -0
- data/spec/api/application_controller_api_spec.rb +218 -0
- data/spec/api/artifact_controller_api_spec.rb +60 -0
- data/spec/api/auth_controller_api_spec.rb +86 -0
- data/spec/api/bake_controller_api_spec.rb +68 -0
- data/spec/api/build_controller_api_spec.rb +155 -0
- data/spec/api/cluster_controller_api_spec.rb +155 -0
- data/spec/api/concourse_controller_api_spec.rb +73 -0
- data/spec/api/credentials_controller_api_spec.rb +70 -0
- data/spec/api/ecs_server_group_events_controller_api_spec.rb +50 -0
- data/spec/api/executions_controller_api_spec.rb +72 -0
- data/spec/api/firewall_controller_api_spec.rb +77 -0
- data/spec/api/image_controller_api_spec.rb +80 -0
- data/spec/api/instance_controller_api_spec.rb +64 -0
- data/spec/api/job_controller_api_spec.rb +51 -0
- data/spec/api/load_balancer_controller_api_spec.rb +87 -0
- data/spec/api/network_controller_api_spec.rb +58 -0
- data/spec/api/pipeline_config_controller_api_spec.rb +68 -0
- data/spec/api/pipeline_controller_api_spec.rb +296 -0
- data/spec/api/pipeline_templates_controller_api_spec.rb +118 -0
- data/spec/api/project_controller_api_spec.rb +81 -0
- data/spec/api/pubsub_subscription_controller_api_spec.rb +45 -0
- data/spec/api/reorder_pipelines_controller_api_spec.rb +46 -0
- data/spec/api/search_controller_api_spec.rb +52 -0
- data/spec/api/security_group_controller_api_spec.rb +77 -0
- data/spec/api/server_group_controller_api_spec.rb +66 -0
- data/spec/api/server_group_manager_controller_api_spec.rb +46 -0
- data/spec/api/snapshot_controller_api_spec.rb +60 -0
- data/spec/api/subnet_controller_api_spec.rb +47 -0
- data/spec/api/task_controller_api_spec.rb +103 -0
- data/spec/api/v2_canary_config_controller_api_spec.rb +96 -0
- data/spec/api/v2_canary_controller_api_spec.rb +123 -0
- data/spec/api/v2_pipeline_templates_controller_api_spec.rb +121 -0
- data/spec/api/version_controller_api_spec.rb +45 -0
- data/spec/api/webhook_controller_api_spec.rb +60 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/account_details_spec.rb +107 -0
- data/spec/models/account_spec.rb +77 -0
- data/spec/models/granted_authority_spec.rb +41 -0
- data/spec/models/hash_mapstringobject_spec.rb +35 -0
- data/spec/models/http_entity_spec.rb +41 -0
- data/spec/models/mapstringstring_spec.rb +35 -0
- data/spec/models/pipeline_template_dependent_spec.rb +53 -0
- data/spec/models/reorder_pipelines_command_spec.rb +47 -0
- data/spec/models/response_entity_spec.rb +57 -0
- data/spec/models/user_spec.rb +101 -0
- data/spec/models/version_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- data/spinnaker_gate_ruby_client-1.0.0.gem +0 -0
- data/spinnaker_gate_ruby_client.gemspec +45 -0
- metadata +427 -0
@@ -0,0 +1,279 @@
|
|
1
|
+
=begin
|
2
|
+
#Spinnaker API
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
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.4.7
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SwaggerClient
|
16
|
+
class User
|
17
|
+
attr_accessor :account_non_expired
|
18
|
+
|
19
|
+
attr_accessor :account_non_locked
|
20
|
+
|
21
|
+
attr_accessor :allowed_accounts
|
22
|
+
|
23
|
+
attr_accessor :authorities
|
24
|
+
|
25
|
+
attr_accessor :credentials_non_expired
|
26
|
+
|
27
|
+
attr_accessor :email
|
28
|
+
|
29
|
+
attr_accessor :enabled
|
30
|
+
|
31
|
+
attr_accessor :first_name
|
32
|
+
|
33
|
+
attr_accessor :last_name
|
34
|
+
|
35
|
+
attr_accessor :roles
|
36
|
+
|
37
|
+
attr_accessor :username
|
38
|
+
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
40
|
+
def self.attribute_map
|
41
|
+
{
|
42
|
+
:'account_non_expired' => :'accountNonExpired',
|
43
|
+
:'account_non_locked' => :'accountNonLocked',
|
44
|
+
:'allowed_accounts' => :'allowedAccounts',
|
45
|
+
:'authorities' => :'authorities',
|
46
|
+
:'credentials_non_expired' => :'credentialsNonExpired',
|
47
|
+
:'email' => :'email',
|
48
|
+
:'enabled' => :'enabled',
|
49
|
+
:'first_name' => :'firstName',
|
50
|
+
:'last_name' => :'lastName',
|
51
|
+
:'roles' => :'roles',
|
52
|
+
:'username' => :'username'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'account_non_expired' => :'BOOLEAN',
|
60
|
+
:'account_non_locked' => :'BOOLEAN',
|
61
|
+
:'allowed_accounts' => :'Array<String>',
|
62
|
+
:'authorities' => :'Array<GrantedAuthority>',
|
63
|
+
:'credentials_non_expired' => :'BOOLEAN',
|
64
|
+
:'email' => :'String',
|
65
|
+
:'enabled' => :'BOOLEAN',
|
66
|
+
:'first_name' => :'String',
|
67
|
+
:'last_name' => :'String',
|
68
|
+
:'roles' => :'Array<String>',
|
69
|
+
:'username' => :'String'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
# Initializes the object
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
75
|
+
def initialize(attributes = {})
|
76
|
+
return unless attributes.is_a?(Hash)
|
77
|
+
|
78
|
+
# convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
80
|
+
|
81
|
+
if attributes.has_key?(:'accountNonExpired')
|
82
|
+
self.account_non_expired = attributes[:'accountNonExpired']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'accountNonLocked')
|
86
|
+
self.account_non_locked = attributes[:'accountNonLocked']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'allowedAccounts')
|
90
|
+
if (value = attributes[:'allowedAccounts']).is_a?(Array)
|
91
|
+
self.allowed_accounts = value
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'authorities')
|
96
|
+
if (value = attributes[:'authorities']).is_a?(Array)
|
97
|
+
self.authorities = value
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'credentialsNonExpired')
|
102
|
+
self.credentials_non_expired = attributes[:'credentialsNonExpired']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'email')
|
106
|
+
self.email = attributes[:'email']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'enabled')
|
110
|
+
self.enabled = attributes[:'enabled']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'firstName')
|
114
|
+
self.first_name = attributes[:'firstName']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'lastName')
|
118
|
+
self.last_name = attributes[:'lastName']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'roles')
|
122
|
+
if (value = attributes[:'roles']).is_a?(Array)
|
123
|
+
self.roles = value
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'username')
|
128
|
+
self.username = attributes[:'username']
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
133
|
+
# @return Array for valid properties with the reasons
|
134
|
+
def list_invalid_properties
|
135
|
+
invalid_properties = Array.new
|
136
|
+
invalid_properties
|
137
|
+
end
|
138
|
+
|
139
|
+
# Check to see if the all the properties in the model are valid
|
140
|
+
# @return true if the model is valid
|
141
|
+
def valid?
|
142
|
+
true
|
143
|
+
end
|
144
|
+
|
145
|
+
# Checks equality by comparing each attribute.
|
146
|
+
# @param [Object] Object to be compared
|
147
|
+
def ==(o)
|
148
|
+
return true if self.equal?(o)
|
149
|
+
self.class == o.class &&
|
150
|
+
account_non_expired == o.account_non_expired &&
|
151
|
+
account_non_locked == o.account_non_locked &&
|
152
|
+
allowed_accounts == o.allowed_accounts &&
|
153
|
+
authorities == o.authorities &&
|
154
|
+
credentials_non_expired == o.credentials_non_expired &&
|
155
|
+
email == o.email &&
|
156
|
+
enabled == o.enabled &&
|
157
|
+
first_name == o.first_name &&
|
158
|
+
last_name == o.last_name &&
|
159
|
+
roles == o.roles &&
|
160
|
+
username == o.username
|
161
|
+
end
|
162
|
+
|
163
|
+
# @see the `==` method
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def eql?(o)
|
166
|
+
self == o
|
167
|
+
end
|
168
|
+
|
169
|
+
# Calculates hash code according to all attributes.
|
170
|
+
# @return [Fixnum] Hash code
|
171
|
+
def hash
|
172
|
+
[account_non_expired, account_non_locked, allowed_accounts, authorities, credentials_non_expired, email, enabled, first_name, last_name, roles, username].hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Builds the object from hash
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
+
# @return [Object] Returns the model itself
|
178
|
+
def build_from_hash(attributes)
|
179
|
+
return nil unless attributes.is_a?(Hash)
|
180
|
+
self.class.swagger_types.each_pair do |key, type|
|
181
|
+
if type =~ /\AArray<(.*)>/i
|
182
|
+
# check to ensure the input is an array given that the the attribute
|
183
|
+
# is documented as an array but the input is not
|
184
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
185
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
186
|
+
end
|
187
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
188
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
189
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
190
|
+
end
|
191
|
+
|
192
|
+
self
|
193
|
+
end
|
194
|
+
|
195
|
+
# Deserializes the data based on type
|
196
|
+
# @param string type Data type
|
197
|
+
# @param string value Value to be deserialized
|
198
|
+
# @return [Object] Deserialized data
|
199
|
+
def _deserialize(type, value)
|
200
|
+
case type.to_sym
|
201
|
+
when :DateTime
|
202
|
+
DateTime.parse(value)
|
203
|
+
when :Date
|
204
|
+
Date.parse(value)
|
205
|
+
when :String
|
206
|
+
value.to_s
|
207
|
+
when :Integer
|
208
|
+
value.to_i
|
209
|
+
when :Float
|
210
|
+
value.to_f
|
211
|
+
when :BOOLEAN
|
212
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
213
|
+
true
|
214
|
+
else
|
215
|
+
false
|
216
|
+
end
|
217
|
+
when :Object
|
218
|
+
# generic object (usually a Hash), return directly
|
219
|
+
value
|
220
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
221
|
+
inner_type = Regexp.last_match[:inner_type]
|
222
|
+
value.map { |v| _deserialize(inner_type, v) }
|
223
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
224
|
+
k_type = Regexp.last_match[:k_type]
|
225
|
+
v_type = Regexp.last_match[:v_type]
|
226
|
+
{}.tap do |hash|
|
227
|
+
value.each do |k, v|
|
228
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
else # model
|
232
|
+
temp_model = SwaggerClient.const_get(type).new
|
233
|
+
temp_model.build_from_hash(value)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
# Returns the string representation of the object
|
238
|
+
# @return [String] String presentation of the object
|
239
|
+
def to_s
|
240
|
+
to_hash.to_s
|
241
|
+
end
|
242
|
+
|
243
|
+
# to_body is an alias to to_hash (backward compatibility)
|
244
|
+
# @return [Hash] Returns the object in the form of hash
|
245
|
+
def to_body
|
246
|
+
to_hash
|
247
|
+
end
|
248
|
+
|
249
|
+
# Returns the object in the form of hash
|
250
|
+
# @return [Hash] Returns the object in the form of hash
|
251
|
+
def to_hash
|
252
|
+
hash = {}
|
253
|
+
self.class.attribute_map.each_pair do |attr, param|
|
254
|
+
value = self.send(attr)
|
255
|
+
next if value.nil?
|
256
|
+
hash[param] = _to_hash(value)
|
257
|
+
end
|
258
|
+
hash
|
259
|
+
end
|
260
|
+
|
261
|
+
# Outputs non-array value in the form of hash
|
262
|
+
# For object, use to_hash. Otherwise, just return the value
|
263
|
+
# @param [Object] value Any valid value
|
264
|
+
# @return [Hash] Returns the value in the form of hash
|
265
|
+
def _to_hash(value)
|
266
|
+
if value.is_a?(Array)
|
267
|
+
value.compact.map { |v| _to_hash(v) }
|
268
|
+
elsif value.is_a?(Hash)
|
269
|
+
{}.tap do |hash|
|
270
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
271
|
+
end
|
272
|
+
elsif value.respond_to? :to_hash
|
273
|
+
value.to_hash
|
274
|
+
else
|
275
|
+
value
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
=begin
|
2
|
+
#Spinnaker API
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
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.4.7
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SwaggerClient
|
16
|
+
class Version
|
17
|
+
attr_accessor :version
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'version' => :'version'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.swagger_types
|
28
|
+
{
|
29
|
+
:'version' => :'String'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return unless attributes.is_a?(Hash)
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
40
|
+
|
41
|
+
if attributes.has_key?(:'version')
|
42
|
+
self.version = attributes[:'version']
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
47
|
+
# @return Array for valid properties with the reasons
|
48
|
+
def list_invalid_properties
|
49
|
+
invalid_properties = Array.new
|
50
|
+
invalid_properties
|
51
|
+
end
|
52
|
+
|
53
|
+
# Check to see if the all the properties in the model are valid
|
54
|
+
# @return true if the model is valid
|
55
|
+
def valid?
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
# Checks equality by comparing each attribute.
|
60
|
+
# @param [Object] Object to be compared
|
61
|
+
def ==(o)
|
62
|
+
return true if self.equal?(o)
|
63
|
+
self.class == o.class &&
|
64
|
+
version == o.version
|
65
|
+
end
|
66
|
+
|
67
|
+
# @see the `==` method
|
68
|
+
# @param [Object] Object to be compared
|
69
|
+
def eql?(o)
|
70
|
+
self == o
|
71
|
+
end
|
72
|
+
|
73
|
+
# Calculates hash code according to all attributes.
|
74
|
+
# @return [Fixnum] Hash code
|
75
|
+
def hash
|
76
|
+
[version].hash
|
77
|
+
end
|
78
|
+
|
79
|
+
# Builds the object from hash
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
81
|
+
# @return [Object] Returns the model itself
|
82
|
+
def build_from_hash(attributes)
|
83
|
+
return nil unless attributes.is_a?(Hash)
|
84
|
+
self.class.swagger_types.each_pair do |key, type|
|
85
|
+
if type =~ /\AArray<(.*)>/i
|
86
|
+
# check to ensure the input is an array given that the the attribute
|
87
|
+
# is documented as an array but the input is not
|
88
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
89
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
90
|
+
end
|
91
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
92
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
93
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
94
|
+
end
|
95
|
+
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
# Deserializes the data based on type
|
100
|
+
# @param string type Data type
|
101
|
+
# @param string value Value to be deserialized
|
102
|
+
# @return [Object] Deserialized data
|
103
|
+
def _deserialize(type, value)
|
104
|
+
case type.to_sym
|
105
|
+
when :DateTime
|
106
|
+
DateTime.parse(value)
|
107
|
+
when :Date
|
108
|
+
Date.parse(value)
|
109
|
+
when :String
|
110
|
+
value.to_s
|
111
|
+
when :Integer
|
112
|
+
value.to_i
|
113
|
+
when :Float
|
114
|
+
value.to_f
|
115
|
+
when :BOOLEAN
|
116
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
117
|
+
true
|
118
|
+
else
|
119
|
+
false
|
120
|
+
end
|
121
|
+
when :Object
|
122
|
+
# generic object (usually a Hash), return directly
|
123
|
+
value
|
124
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
125
|
+
inner_type = Regexp.last_match[:inner_type]
|
126
|
+
value.map { |v| _deserialize(inner_type, v) }
|
127
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
128
|
+
k_type = Regexp.last_match[:k_type]
|
129
|
+
v_type = Regexp.last_match[:v_type]
|
130
|
+
{}.tap do |hash|
|
131
|
+
value.each do |k, v|
|
132
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
else # model
|
136
|
+
temp_model = SwaggerClient.const_get(type).new
|
137
|
+
temp_model.build_from_hash(value)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# Returns the string representation of the object
|
142
|
+
# @return [String] String presentation of the object
|
143
|
+
def to_s
|
144
|
+
to_hash.to_s
|
145
|
+
end
|
146
|
+
|
147
|
+
# to_body is an alias to to_hash (backward compatibility)
|
148
|
+
# @return [Hash] Returns the object in the form of hash
|
149
|
+
def to_body
|
150
|
+
to_hash
|
151
|
+
end
|
152
|
+
|
153
|
+
# Returns the object in the form of hash
|
154
|
+
# @return [Hash] Returns the object in the form of hash
|
155
|
+
def to_hash
|
156
|
+
hash = {}
|
157
|
+
self.class.attribute_map.each_pair do |attr, param|
|
158
|
+
value = self.send(attr)
|
159
|
+
next if value.nil?
|
160
|
+
hash[param] = _to_hash(value)
|
161
|
+
end
|
162
|
+
hash
|
163
|
+
end
|
164
|
+
|
165
|
+
# Outputs non-array value in the form of hash
|
166
|
+
# For object, use to_hash. Otherwise, just return the value
|
167
|
+
# @param [Object] value Any valid value
|
168
|
+
# @return [Hash] Returns the value in the form of hash
|
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
|
+
end
|
183
|
+
end
|