pulpcore_client 3.0.0rc2 → 3.0.0rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +43 -37
- data/docs/ArtifactsApi.md +20 -20
- data/docs/ContentAppStatus.md +19 -0
- data/docs/DatabaseConnection.md +17 -0
- data/docs/OrphansApi.md +5 -5
- data/docs/ProgressReport.md +1 -3
- data/docs/RedisConnection.md +17 -0
- data/docs/RepositoriesApi.md +30 -278
- data/docs/RepositoriesVersionsApi.md +256 -0
- data/docs/RepositoryVersionCreate.md +2 -2
- data/docs/Status.md +27 -0
- data/docs/StatusApi.md +8 -7
- data/docs/TaskCancel.md +17 -0
- data/docs/TasksApi.md +71 -71
- data/docs/Upload.md +6 -8
- data/docs/UploadCommit.md +17 -0
- data/docs/UploadsApi.md +66 -106
- data/docs/Version.md +19 -0
- data/docs/WorkersApi.md +10 -10
- data/lib/pulpcore_client/api/artifacts_api.rb +47 -23
- data/lib/pulpcore_client/api/orphans_api.rb +6 -6
- data/lib/pulpcore_client/api/repositories_api.rb +38 -338
- data/lib/pulpcore_client/api/repositories_versions_api.rb +322 -0
- data/lib/pulpcore_client/api/status_api.rb +12 -10
- data/lib/pulpcore_client/api/tasks_api.rb +88 -88
- data/lib/pulpcore_client/api/uploads_api.rb +105 -154
- data/lib/pulpcore_client/api/workers_api.rb +12 -12
- data/lib/pulpcore_client/api_client.rb +1 -1
- data/lib/pulpcore_client/api_error.rb +1 -1
- data/lib/pulpcore_client/configuration.rb +1 -1
- data/lib/pulpcore_client/models/artifact.rb +91 -1
- data/lib/pulpcore_client/models/async_operation_response.rb +1 -1
- data/lib/pulpcore_client/models/content_app_status.rb +223 -0
- data/lib/pulpcore_client/models/database_connection.rb +203 -0
- data/lib/pulpcore_client/models/inline_response200.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2001.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2002.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2003.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2004.rb +1 -1
- data/lib/pulpcore_client/models/inline_response2005.rb +1 -1
- data/lib/pulpcore_client/models/progress_report.rb +20 -15
- data/lib/pulpcore_client/models/redis_connection.rb +203 -0
- data/lib/pulpcore_client/models/repository.rb +16 -1
- data/lib/pulpcore_client/models/repository_version.rb +1 -1
- data/lib/pulpcore_client/models/repository_version_create.rb +3 -13
- data/lib/pulpcore_client/models/status.rb +283 -0
- data/lib/pulpcore_client/models/task.rb +1 -1
- data/lib/pulpcore_client/models/task_cancel.rb +221 -0
- data/lib/pulpcore_client/models/upload.rb +26 -52
- data/lib/pulpcore_client/models/upload_commit.rb +221 -0
- data/lib/pulpcore_client/models/version.rb +256 -0
- data/lib/pulpcore_client/models/worker.rb +2 -1
- data/lib/pulpcore_client/version.rb +2 -2
- data/lib/pulpcore_client.rb +9 -1
- data/pulpcore_client.gemspec +1 -1
- data/spec/api/artifacts_api_spec.rb +9 -9
- data/spec/api/orphans_api_spec.rb +3 -3
- data/spec/api/repositories_api_spec.rb +13 -76
- data/spec/api/repositories_versions_api_spec.rb +98 -0
- data/spec/api/status_api_spec.rb +4 -4
- data/spec/api/tasks_api_spec.rb +20 -20
- data/spec/api/uploads_api_spec.rb +32 -37
- data/spec/api/workers_api_spec.rb +5 -5
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/artifact_spec.rb +1 -1
- data/spec/models/async_operation_response_spec.rb +1 -1
- data/spec/models/content_app_status_spec.rb +47 -0
- data/spec/models/database_connection_spec.rb +41 -0
- data/spec/models/inline_response2001_spec.rb +1 -1
- data/spec/models/inline_response2002_spec.rb +1 -1
- data/spec/models/inline_response2003_spec.rb +1 -1
- data/spec/models/inline_response2004_spec.rb +1 -1
- data/spec/models/inline_response2005_spec.rb +1 -1
- data/spec/models/inline_response200_spec.rb +1 -1
- data/spec/models/progress_report_spec.rb +1 -7
- data/spec/models/redis_connection_spec.rb +41 -0
- data/spec/models/repository_spec.rb +1 -1
- data/spec/models/repository_version_create_spec.rb +1 -1
- data/spec/models/repository_version_spec.rb +1 -1
- data/spec/models/status_spec.rb +71 -0
- data/spec/models/task_cancel_spec.rb +41 -0
- data/spec/models/task_spec.rb +1 -1
- data/spec/models/upload_commit_spec.rb +41 -0
- data/spec/models/upload_spec.rb +4 -10
- data/spec/models/version_spec.rb +47 -0
- data/spec/models/worker_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +34 -2
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: v3
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.0.
|
9
|
+
OpenAPI Generator version: 4.0.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -144,15 +144,105 @@ module PulpcoreClient
|
|
144
144
|
# @return Array for valid properties with the reasons
|
145
145
|
def list_invalid_properties
|
146
146
|
invalid_properties = Array.new
|
147
|
+
if !@md5.nil? && @md5.to_s.length < 1
|
148
|
+
invalid_properties.push('invalid value for "md5", the character length must be great than or equal to 1.')
|
149
|
+
end
|
150
|
+
|
151
|
+
if !@sha1.nil? && @sha1.to_s.length < 1
|
152
|
+
invalid_properties.push('invalid value for "sha1", the character length must be great than or equal to 1.')
|
153
|
+
end
|
154
|
+
|
155
|
+
if !@sha224.nil? && @sha224.to_s.length < 1
|
156
|
+
invalid_properties.push('invalid value for "sha224", the character length must be great than or equal to 1.')
|
157
|
+
end
|
158
|
+
|
159
|
+
if !@sha256.nil? && @sha256.to_s.length < 1
|
160
|
+
invalid_properties.push('invalid value for "sha256", the character length must be great than or equal to 1.')
|
161
|
+
end
|
162
|
+
|
163
|
+
if !@sha384.nil? && @sha384.to_s.length < 1
|
164
|
+
invalid_properties.push('invalid value for "sha384", the character length must be great than or equal to 1.')
|
165
|
+
end
|
166
|
+
|
167
|
+
if !@sha512.nil? && @sha512.to_s.length < 1
|
168
|
+
invalid_properties.push('invalid value for "sha512", the character length must be great than or equal to 1.')
|
169
|
+
end
|
170
|
+
|
147
171
|
invalid_properties
|
148
172
|
end
|
149
173
|
|
150
174
|
# Check to see if the all the properties in the model are valid
|
151
175
|
# @return true if the model is valid
|
152
176
|
def valid?
|
177
|
+
return false if !@md5.nil? && @md5.to_s.length < 1
|
178
|
+
return false if !@sha1.nil? && @sha1.to_s.length < 1
|
179
|
+
return false if !@sha224.nil? && @sha224.to_s.length < 1
|
180
|
+
return false if !@sha256.nil? && @sha256.to_s.length < 1
|
181
|
+
return false if !@sha384.nil? && @sha384.to_s.length < 1
|
182
|
+
return false if !@sha512.nil? && @sha512.to_s.length < 1
|
153
183
|
true
|
154
184
|
end
|
155
185
|
|
186
|
+
# Custom attribute writer method with validation
|
187
|
+
# @param [Object] md5 Value to be assigned
|
188
|
+
def md5=(md5)
|
189
|
+
if !md5.nil? && md5.to_s.length < 1
|
190
|
+
fail ArgumentError, 'invalid value for "md5", the character length must be great than or equal to 1.'
|
191
|
+
end
|
192
|
+
|
193
|
+
@md5 = md5
|
194
|
+
end
|
195
|
+
|
196
|
+
# Custom attribute writer method with validation
|
197
|
+
# @param [Object] sha1 Value to be assigned
|
198
|
+
def sha1=(sha1)
|
199
|
+
if !sha1.nil? && sha1.to_s.length < 1
|
200
|
+
fail ArgumentError, 'invalid value for "sha1", the character length must be great than or equal to 1.'
|
201
|
+
end
|
202
|
+
|
203
|
+
@sha1 = sha1
|
204
|
+
end
|
205
|
+
|
206
|
+
# Custom attribute writer method with validation
|
207
|
+
# @param [Object] sha224 Value to be assigned
|
208
|
+
def sha224=(sha224)
|
209
|
+
if !sha224.nil? && sha224.to_s.length < 1
|
210
|
+
fail ArgumentError, 'invalid value for "sha224", the character length must be great than or equal to 1.'
|
211
|
+
end
|
212
|
+
|
213
|
+
@sha224 = sha224
|
214
|
+
end
|
215
|
+
|
216
|
+
# Custom attribute writer method with validation
|
217
|
+
# @param [Object] sha256 Value to be assigned
|
218
|
+
def sha256=(sha256)
|
219
|
+
if !sha256.nil? && sha256.to_s.length < 1
|
220
|
+
fail ArgumentError, 'invalid value for "sha256", the character length must be great than or equal to 1.'
|
221
|
+
end
|
222
|
+
|
223
|
+
@sha256 = sha256
|
224
|
+
end
|
225
|
+
|
226
|
+
# Custom attribute writer method with validation
|
227
|
+
# @param [Object] sha384 Value to be assigned
|
228
|
+
def sha384=(sha384)
|
229
|
+
if !sha384.nil? && sha384.to_s.length < 1
|
230
|
+
fail ArgumentError, 'invalid value for "sha384", the character length must be great than or equal to 1.'
|
231
|
+
end
|
232
|
+
|
233
|
+
@sha384 = sha384
|
234
|
+
end
|
235
|
+
|
236
|
+
# Custom attribute writer method with validation
|
237
|
+
# @param [Object] sha512 Value to be assigned
|
238
|
+
def sha512=(sha512)
|
239
|
+
if !sha512.nil? && sha512.to_s.length < 1
|
240
|
+
fail ArgumentError, 'invalid value for "sha512", the character length must be great than or equal to 1.'
|
241
|
+
end
|
242
|
+
|
243
|
+
@sha512 = sha512
|
244
|
+
end
|
245
|
+
|
156
246
|
# Checks equality by comparing each attribute.
|
157
247
|
# @param [Object] Object to be compared
|
158
248
|
def ==(o)
|
@@ -0,0 +1,223 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
16
|
+
# List of online content apps known to the application. An online worker is actively heartbeating
|
17
|
+
class ContentAppStatus
|
18
|
+
# The name of the worker.
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# Timestamp of the last time the worker talked to the service.
|
22
|
+
attr_accessor :last_heartbeat
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'name' => :'name',
|
28
|
+
:'last_heartbeat' => :'last_heartbeat'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'name' => :'String',
|
36
|
+
:'last_heartbeat' => :'DateTime'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Initializes the object
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
|
+
def initialize(attributes = {})
|
43
|
+
if (!attributes.is_a?(Hash))
|
44
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::ContentAppStatus` initialize method"
|
45
|
+
end
|
46
|
+
|
47
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
48
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
49
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
50
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::ContentAppStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
51
|
+
end
|
52
|
+
h[k.to_sym] = v
|
53
|
+
}
|
54
|
+
|
55
|
+
if attributes.key?(:'name')
|
56
|
+
self.name = attributes[:'name']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.key?(:'last_heartbeat')
|
60
|
+
self.last_heartbeat = attributes[:'last_heartbeat']
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
65
|
+
# @return Array for valid properties with the reasons
|
66
|
+
def list_invalid_properties
|
67
|
+
invalid_properties = Array.new
|
68
|
+
if !@name.nil? && @name.to_s.length < 1
|
69
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
70
|
+
end
|
71
|
+
|
72
|
+
invalid_properties
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check to see if the all the properties in the model are valid
|
76
|
+
# @return true if the model is valid
|
77
|
+
def valid?
|
78
|
+
return false if !@name.nil? && @name.to_s.length < 1
|
79
|
+
true
|
80
|
+
end
|
81
|
+
|
82
|
+
# Custom attribute writer method with validation
|
83
|
+
# @param [Object] name Value to be assigned
|
84
|
+
def name=(name)
|
85
|
+
if !name.nil? && name.to_s.length < 1
|
86
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
87
|
+
end
|
88
|
+
|
89
|
+
@name = name
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
name == o.name &&
|
98
|
+
last_heartbeat == o.last_heartbeat
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(o)
|
104
|
+
self == o
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Integer] Hash code
|
109
|
+
def hash
|
110
|
+
[name, last_heartbeat].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def self.build_from_hash(attributes)
|
117
|
+
new.build_from_hash(attributes)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
self.class.openapi_types.each_pair do |key, type|
|
126
|
+
if type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
131
|
+
end
|
132
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
133
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
134
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
135
|
+
end
|
136
|
+
|
137
|
+
self
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deserializes the data based on type
|
141
|
+
# @param string type Data type
|
142
|
+
# @param string value Value to be deserialized
|
143
|
+
# @return [Object] Deserialized data
|
144
|
+
def _deserialize(type, value)
|
145
|
+
case type.to_sym
|
146
|
+
when :DateTime
|
147
|
+
DateTime.parse(value)
|
148
|
+
when :Date
|
149
|
+
Date.parse(value)
|
150
|
+
when :String
|
151
|
+
value.to_s
|
152
|
+
when :Integer
|
153
|
+
value.to_i
|
154
|
+
when :Float
|
155
|
+
value.to_f
|
156
|
+
when :Boolean
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else # model
|
177
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the string representation of the object
|
182
|
+
# @return [String] String presentation of the object
|
183
|
+
def to_s
|
184
|
+
to_hash.to_s
|
185
|
+
end
|
186
|
+
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_body
|
190
|
+
to_hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the object in the form of hash
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_hash
|
196
|
+
hash = {}
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
198
|
+
value = self.send(attr)
|
199
|
+
next if value.nil?
|
200
|
+
hash[param] = _to_hash(value)
|
201
|
+
end
|
202
|
+
hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Outputs non-array value in the form of hash
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
207
|
+
# @param [Object] value Any valid value
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
209
|
+
def _to_hash(value)
|
210
|
+
if value.is_a?(Array)
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
212
|
+
elsif value.is_a?(Hash)
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
215
|
+
end
|
216
|
+
elsif value.respond_to? :to_hash
|
217
|
+
value.to_hash
|
218
|
+
else
|
219
|
+
value
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
@@ -0,0 +1,203 @@
|
|
1
|
+
=begin
|
2
|
+
#Pulp 3 API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpcoreClient
|
16
|
+
# Database connection information
|
17
|
+
class DatabaseConnection
|
18
|
+
# Info about whether the app can connect to the database
|
19
|
+
attr_accessor :connected
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'connected' => :'connected'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.openapi_types
|
30
|
+
{
|
31
|
+
:'connected' => :'Boolean'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initializes the object
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
+
def initialize(attributes = {})
|
38
|
+
if (!attributes.is_a?(Hash))
|
39
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::DatabaseConnection` initialize method"
|
40
|
+
end
|
41
|
+
|
42
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
43
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
44
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
45
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::DatabaseConnection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
46
|
+
end
|
47
|
+
h[k.to_sym] = v
|
48
|
+
}
|
49
|
+
|
50
|
+
if attributes.key?(:'connected')
|
51
|
+
self.connected = attributes[:'connected']
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
56
|
+
# @return Array for valid properties with the reasons
|
57
|
+
def list_invalid_properties
|
58
|
+
invalid_properties = Array.new
|
59
|
+
if @connected.nil?
|
60
|
+
invalid_properties.push('invalid value for "connected", connected cannot be nil.')
|
61
|
+
end
|
62
|
+
|
63
|
+
invalid_properties
|
64
|
+
end
|
65
|
+
|
66
|
+
# Check to see if the all the properties in the model are valid
|
67
|
+
# @return true if the model is valid
|
68
|
+
def valid?
|
69
|
+
return false if @connected.nil?
|
70
|
+
true
|
71
|
+
end
|
72
|
+
|
73
|
+
# Checks equality by comparing each attribute.
|
74
|
+
# @param [Object] Object to be compared
|
75
|
+
def ==(o)
|
76
|
+
return true if self.equal?(o)
|
77
|
+
self.class == o.class &&
|
78
|
+
connected == o.connected
|
79
|
+
end
|
80
|
+
|
81
|
+
# @see the `==` method
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def eql?(o)
|
84
|
+
self == o
|
85
|
+
end
|
86
|
+
|
87
|
+
# Calculates hash code according to all attributes.
|
88
|
+
# @return [Integer] Hash code
|
89
|
+
def hash
|
90
|
+
[connected].hash
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def self.build_from_hash(attributes)
|
97
|
+
new.build_from_hash(attributes)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
self.class.openapi_types.each_pair do |key, type|
|
106
|
+
if type =~ /\AArray<(.*)>/i
|
107
|
+
# check to ensure the input is an array given that the attribute
|
108
|
+
# is documented as an array but the input is not
|
109
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
110
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
111
|
+
end
|
112
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
113
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
114
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
115
|
+
end
|
116
|
+
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deserializes the data based on type
|
121
|
+
# @param string type Data type
|
122
|
+
# @param string value Value to be deserialized
|
123
|
+
# @return [Object] Deserialized data
|
124
|
+
def _deserialize(type, value)
|
125
|
+
case type.to_sym
|
126
|
+
when :DateTime
|
127
|
+
DateTime.parse(value)
|
128
|
+
when :Date
|
129
|
+
Date.parse(value)
|
130
|
+
when :String
|
131
|
+
value.to_s
|
132
|
+
when :Integer
|
133
|
+
value.to_i
|
134
|
+
when :Float
|
135
|
+
value.to_f
|
136
|
+
when :Boolean
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
PulpcoreClient.const_get(type).build_from_hash(value)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the string representation of the object
|
162
|
+
# @return [String] String presentation of the object
|
163
|
+
def to_s
|
164
|
+
to_hash.to_s
|
165
|
+
end
|
166
|
+
|
167
|
+
# to_body is an alias to to_hash (backward compatibility)
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_body
|
170
|
+
to_hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the object in the form of hash
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_hash
|
176
|
+
hash = {}
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
178
|
+
value = self.send(attr)
|
179
|
+
next if value.nil?
|
180
|
+
hash[param] = _to_hash(value)
|
181
|
+
end
|
182
|
+
hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Outputs non-array value in the form of hash
|
186
|
+
# For object, use to_hash. Otherwise, just return the value
|
187
|
+
# @param [Object] value Any valid value
|
188
|
+
# @return [Hash] Returns the value in the form of hash
|
189
|
+
def _to_hash(value)
|
190
|
+
if value.is_a?(Array)
|
191
|
+
value.compact.map { |v| _to_hash(v) }
|
192
|
+
elsif value.is_a?(Hash)
|
193
|
+
{}.tap do |hash|
|
194
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
195
|
+
end
|
196
|
+
elsif value.respond_to? :to_hash
|
197
|
+
value.to_hash
|
198
|
+
else
|
199
|
+
value
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|