pulp_maven_client 0.1.0b2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/README.md +119 -0
- data/Rakefile +10 -0
- data/docs/AsyncOperationResponse.md +17 -0
- data/docs/ContentApi.md +188 -0
- data/docs/DistributionsApi.md +352 -0
- data/docs/InlineResponse200.md +23 -0
- data/docs/InlineResponse2001.md +23 -0
- data/docs/InlineResponse2002.md +23 -0
- data/docs/MavenArtifact.md +33 -0
- data/docs/MavenDistribution.md +29 -0
- data/docs/MavenRemote.md +47 -0
- data/docs/RemotesApi.md +356 -0
- data/git_push.sh +55 -0
- data/lib/pulp_maven_client/api/content_api.rb +231 -0
- data/lib/pulp_maven_client/api/distributions_api.rb +430 -0
- data/lib/pulp_maven_client/api/remotes_api.rb +436 -0
- data/lib/pulp_maven_client/api_client.rb +387 -0
- data/lib/pulp_maven_client/api_error.rb +57 -0
- data/lib/pulp_maven_client/configuration.rb +251 -0
- data/lib/pulp_maven_client/models/async_operation_response.rb +202 -0
- data/lib/pulp_maven_client/models/inline_response200.rb +235 -0
- data/lib/pulp_maven_client/models/inline_response2001.rb +235 -0
- data/lib/pulp_maven_client/models/inline_response2002.rb +235 -0
- data/lib/pulp_maven_client/models/maven_artifact.rb +379 -0
- data/lib/pulp_maven_client/models/maven_distribution.rb +337 -0
- data/lib/pulp_maven_client/models/maven_remote.rb +549 -0
- data/lib/pulp_maven_client/version.rb +15 -0
- data/lib/pulp_maven_client.rb +49 -0
- data/pulp_maven_client.gemspec +45 -0
- data/spec/api/content_api_spec.rb +79 -0
- data/spec/api/distributions_api_spec.rb +116 -0
- data/spec/api/remotes_api_spec.rb +118 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/async_operation_response_spec.rb +41 -0
- data/spec/models/inline_response2001_spec.rb +59 -0
- data/spec/models/inline_response2002_spec.rb +59 -0
- data/spec/models/inline_response200_spec.rb +59 -0
- data/spec/models/maven_artifact_spec.rb +89 -0
- data/spec/models/maven_distribution_spec.rb +77 -0
- data/spec/models/maven_remote_spec.rb +135 -0
- data/spec/spec_helper.rb +111 -0
- metadata +281 -0
@@ -0,0 +1,235 @@
|
|
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.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpMavenClient
|
16
|
+
class InlineResponse2002
|
17
|
+
attr_accessor :_next
|
18
|
+
|
19
|
+
attr_accessor :previous
|
20
|
+
|
21
|
+
attr_accessor :count
|
22
|
+
|
23
|
+
attr_accessor :results
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'_next' => :'next',
|
29
|
+
:'previous' => :'previous',
|
30
|
+
:'count' => :'count',
|
31
|
+
:'results' => :'results'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'_next' => :'String',
|
39
|
+
:'previous' => :'String',
|
40
|
+
:'count' => :'Integer',
|
41
|
+
:'results' => :'Array<MavenRemote>'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpMavenClient::InlineResponse2002` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpMavenClient::InlineResponse2002`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'_next')
|
61
|
+
self._next = attributes[:'_next']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'previous')
|
65
|
+
self.previous = attributes[:'previous']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'count')
|
69
|
+
self.count = attributes[:'count']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'results')
|
73
|
+
if (value = attributes[:'results']).is_a?(Array)
|
74
|
+
self.results = value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
if @count.nil?
|
84
|
+
invalid_properties.push('invalid value for "count", count cannot be nil.')
|
85
|
+
end
|
86
|
+
|
87
|
+
if @results.nil?
|
88
|
+
invalid_properties.push('invalid value for "results", results cannot be nil.')
|
89
|
+
end
|
90
|
+
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
return false if @count.nil?
|
98
|
+
return false if @results.nil?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
# Checks equality by comparing each attribute.
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def ==(o)
|
105
|
+
return true if self.equal?(o)
|
106
|
+
self.class == o.class &&
|
107
|
+
_next == o._next &&
|
108
|
+
previous == o.previous &&
|
109
|
+
count == o.count &&
|
110
|
+
results == o.results
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see the `==` method
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def eql?(o)
|
116
|
+
self == o
|
117
|
+
end
|
118
|
+
|
119
|
+
# Calculates hash code according to all attributes.
|
120
|
+
# @return [Integer] Hash code
|
121
|
+
def hash
|
122
|
+
[_next, previous, count, results].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def self.build_from_hash(attributes)
|
129
|
+
new.build_from_hash(attributes)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Builds the object from hash
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
134
|
+
# @return [Object] Returns the model itself
|
135
|
+
def build_from_hash(attributes)
|
136
|
+
return nil unless attributes.is_a?(Hash)
|
137
|
+
self.class.openapi_types.each_pair do |key, type|
|
138
|
+
if type =~ /\AArray<(.*)>/i
|
139
|
+
# check to ensure the input is an array given that the attribute
|
140
|
+
# is documented as an array but the input is not
|
141
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
142
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
143
|
+
end
|
144
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
145
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
146
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
147
|
+
end
|
148
|
+
|
149
|
+
self
|
150
|
+
end
|
151
|
+
|
152
|
+
# Deserializes the data based on type
|
153
|
+
# @param string type Data type
|
154
|
+
# @param string value Value to be deserialized
|
155
|
+
# @return [Object] Deserialized data
|
156
|
+
def _deserialize(type, value)
|
157
|
+
case type.to_sym
|
158
|
+
when :DateTime
|
159
|
+
DateTime.parse(value)
|
160
|
+
when :Date
|
161
|
+
Date.parse(value)
|
162
|
+
when :String
|
163
|
+
value.to_s
|
164
|
+
when :Integer
|
165
|
+
value.to_i
|
166
|
+
when :Float
|
167
|
+
value.to_f
|
168
|
+
when :Boolean
|
169
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
170
|
+
true
|
171
|
+
else
|
172
|
+
false
|
173
|
+
end
|
174
|
+
when :Object
|
175
|
+
# generic object (usually a Hash), return directly
|
176
|
+
value
|
177
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
178
|
+
inner_type = Regexp.last_match[:inner_type]
|
179
|
+
value.map { |v| _deserialize(inner_type, v) }
|
180
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
181
|
+
k_type = Regexp.last_match[:k_type]
|
182
|
+
v_type = Regexp.last_match[:v_type]
|
183
|
+
{}.tap do |hash|
|
184
|
+
value.each do |k, v|
|
185
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
else # model
|
189
|
+
PulpMavenClient.const_get(type).build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the string representation of the object
|
194
|
+
# @return [String] String presentation of the object
|
195
|
+
def to_s
|
196
|
+
to_hash.to_s
|
197
|
+
end
|
198
|
+
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_body
|
202
|
+
to_hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the object in the form of hash
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_hash
|
208
|
+
hash = {}
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
210
|
+
value = self.send(attr)
|
211
|
+
next if value.nil?
|
212
|
+
hash[param] = _to_hash(value)
|
213
|
+
end
|
214
|
+
hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Outputs non-array value in the form of hash
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
219
|
+
# @param [Object] value Any valid value
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
@@ -0,0 +1,379 @@
|
|
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.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module PulpMavenClient
|
16
|
+
class MavenArtifact
|
17
|
+
attr_accessor :_href
|
18
|
+
|
19
|
+
# Timestamp of creation.
|
20
|
+
attr_accessor :_created
|
21
|
+
|
22
|
+
attr_accessor :_type
|
23
|
+
|
24
|
+
# Artifact file representing the physical content
|
25
|
+
attr_accessor :_artifact
|
26
|
+
|
27
|
+
# Path where the artifact is located relative to distributions base_path
|
28
|
+
attr_accessor :_relative_path
|
29
|
+
|
30
|
+
# Group Id of the artifact's package.
|
31
|
+
attr_accessor :group_id
|
32
|
+
|
33
|
+
# Artifact Id of the artifact's package.
|
34
|
+
attr_accessor :artifact_id
|
35
|
+
|
36
|
+
# Version of the artifact's package.
|
37
|
+
attr_accessor :version
|
38
|
+
|
39
|
+
# Filename of the artifact.
|
40
|
+
attr_accessor :filename
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
:'_href' => :'_href',
|
46
|
+
:'_created' => :'_created',
|
47
|
+
:'_type' => :'_type',
|
48
|
+
:'_artifact' => :'_artifact',
|
49
|
+
:'_relative_path' => :'_relative_path',
|
50
|
+
:'group_id' => :'group_id',
|
51
|
+
:'artifact_id' => :'artifact_id',
|
52
|
+
:'version' => :'version',
|
53
|
+
:'filename' => :'filename'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.openapi_types
|
59
|
+
{
|
60
|
+
:'_href' => :'String',
|
61
|
+
:'_created' => :'DateTime',
|
62
|
+
:'_type' => :'String',
|
63
|
+
:'_artifact' => :'String',
|
64
|
+
:'_relative_path' => :'String',
|
65
|
+
:'group_id' => :'String',
|
66
|
+
:'artifact_id' => :'String',
|
67
|
+
:'version' => :'String',
|
68
|
+
:'filename' => :'String'
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initializes the object
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
def initialize(attributes = {})
|
75
|
+
if (!attributes.is_a?(Hash))
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpMavenClient::MavenArtifact` initialize method"
|
77
|
+
end
|
78
|
+
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
81
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
82
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpMavenClient::MavenArtifact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
83
|
+
end
|
84
|
+
h[k.to_sym] = v
|
85
|
+
}
|
86
|
+
|
87
|
+
if attributes.key?(:'_href')
|
88
|
+
self._href = attributes[:'_href']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'_created')
|
92
|
+
self._created = attributes[:'_created']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'_type')
|
96
|
+
self._type = attributes[:'_type']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'_artifact')
|
100
|
+
self._artifact = attributes[:'_artifact']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'_relative_path')
|
104
|
+
self._relative_path = attributes[:'_relative_path']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'group_id')
|
108
|
+
self.group_id = attributes[:'group_id']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'artifact_id')
|
112
|
+
self.artifact_id = attributes[:'artifact_id']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'version')
|
116
|
+
self.version = attributes[:'version']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'filename')
|
120
|
+
self.filename = attributes[:'filename']
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properties with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
invalid_properties = Array.new
|
128
|
+
if !@_type.nil? && @_type.to_s.length < 1
|
129
|
+
invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
|
130
|
+
end
|
131
|
+
|
132
|
+
if @_artifact.nil?
|
133
|
+
invalid_properties.push('invalid value for "_artifact", _artifact cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
if @_relative_path.nil?
|
137
|
+
invalid_properties.push('invalid value for "_relative_path", _relative_path cannot be nil.')
|
138
|
+
end
|
139
|
+
|
140
|
+
if @_relative_path.to_s.length < 1
|
141
|
+
invalid_properties.push('invalid value for "_relative_path", the character length must be great than or equal to 1.')
|
142
|
+
end
|
143
|
+
|
144
|
+
if !@group_id.nil? && @group_id.to_s.length < 1
|
145
|
+
invalid_properties.push('invalid value for "group_id", the character length must be great than or equal to 1.')
|
146
|
+
end
|
147
|
+
|
148
|
+
if !@artifact_id.nil? && @artifact_id.to_s.length < 1
|
149
|
+
invalid_properties.push('invalid value for "artifact_id", the character length must be great than or equal to 1.')
|
150
|
+
end
|
151
|
+
|
152
|
+
if !@version.nil? && @version.to_s.length < 1
|
153
|
+
invalid_properties.push('invalid value for "version", the character length must be great than or equal to 1.')
|
154
|
+
end
|
155
|
+
|
156
|
+
if !@filename.nil? && @filename.to_s.length < 1
|
157
|
+
invalid_properties.push('invalid value for "filename", the character length must be great than or equal to 1.')
|
158
|
+
end
|
159
|
+
|
160
|
+
invalid_properties
|
161
|
+
end
|
162
|
+
|
163
|
+
# Check to see if the all the properties in the model are valid
|
164
|
+
# @return true if the model is valid
|
165
|
+
def valid?
|
166
|
+
return false if !@_type.nil? && @_type.to_s.length < 1
|
167
|
+
return false if @_artifact.nil?
|
168
|
+
return false if @_relative_path.nil?
|
169
|
+
return false if @_relative_path.to_s.length < 1
|
170
|
+
return false if !@group_id.nil? && @group_id.to_s.length < 1
|
171
|
+
return false if !@artifact_id.nil? && @artifact_id.to_s.length < 1
|
172
|
+
return false if !@version.nil? && @version.to_s.length < 1
|
173
|
+
return false if !@filename.nil? && @filename.to_s.length < 1
|
174
|
+
true
|
175
|
+
end
|
176
|
+
|
177
|
+
# Custom attribute writer method with validation
|
178
|
+
# @param [Object] _type Value to be assigned
|
179
|
+
def _type=(_type)
|
180
|
+
if !_type.nil? && _type.to_s.length < 1
|
181
|
+
fail ArgumentError, 'invalid value for "_type", the character length must be great than or equal to 1.'
|
182
|
+
end
|
183
|
+
|
184
|
+
@_type = _type
|
185
|
+
end
|
186
|
+
|
187
|
+
# Custom attribute writer method with validation
|
188
|
+
# @param [Object] _relative_path Value to be assigned
|
189
|
+
def _relative_path=(_relative_path)
|
190
|
+
if _relative_path.nil?
|
191
|
+
fail ArgumentError, '_relative_path cannot be nil'
|
192
|
+
end
|
193
|
+
|
194
|
+
if _relative_path.to_s.length < 1
|
195
|
+
fail ArgumentError, 'invalid value for "_relative_path", the character length must be great than or equal to 1.'
|
196
|
+
end
|
197
|
+
|
198
|
+
@_relative_path = _relative_path
|
199
|
+
end
|
200
|
+
|
201
|
+
# Custom attribute writer method with validation
|
202
|
+
# @param [Object] group_id Value to be assigned
|
203
|
+
def group_id=(group_id)
|
204
|
+
if !group_id.nil? && group_id.to_s.length < 1
|
205
|
+
fail ArgumentError, 'invalid value for "group_id", the character length must be great than or equal to 1.'
|
206
|
+
end
|
207
|
+
|
208
|
+
@group_id = group_id
|
209
|
+
end
|
210
|
+
|
211
|
+
# Custom attribute writer method with validation
|
212
|
+
# @param [Object] artifact_id Value to be assigned
|
213
|
+
def artifact_id=(artifact_id)
|
214
|
+
if !artifact_id.nil? && artifact_id.to_s.length < 1
|
215
|
+
fail ArgumentError, 'invalid value for "artifact_id", the character length must be great than or equal to 1.'
|
216
|
+
end
|
217
|
+
|
218
|
+
@artifact_id = artifact_id
|
219
|
+
end
|
220
|
+
|
221
|
+
# Custom attribute writer method with validation
|
222
|
+
# @param [Object] version Value to be assigned
|
223
|
+
def version=(version)
|
224
|
+
if !version.nil? && version.to_s.length < 1
|
225
|
+
fail ArgumentError, 'invalid value for "version", the character length must be great than or equal to 1.'
|
226
|
+
end
|
227
|
+
|
228
|
+
@version = version
|
229
|
+
end
|
230
|
+
|
231
|
+
# Custom attribute writer method with validation
|
232
|
+
# @param [Object] filename Value to be assigned
|
233
|
+
def filename=(filename)
|
234
|
+
if !filename.nil? && filename.to_s.length < 1
|
235
|
+
fail ArgumentError, 'invalid value for "filename", the character length must be great than or equal to 1.'
|
236
|
+
end
|
237
|
+
|
238
|
+
@filename = filename
|
239
|
+
end
|
240
|
+
|
241
|
+
# Checks equality by comparing each attribute.
|
242
|
+
# @param [Object] Object to be compared
|
243
|
+
def ==(o)
|
244
|
+
return true if self.equal?(o)
|
245
|
+
self.class == o.class &&
|
246
|
+
_href == o._href &&
|
247
|
+
_created == o._created &&
|
248
|
+
_type == o._type &&
|
249
|
+
_artifact == o._artifact &&
|
250
|
+
_relative_path == o._relative_path &&
|
251
|
+
group_id == o.group_id &&
|
252
|
+
artifact_id == o.artifact_id &&
|
253
|
+
version == o.version &&
|
254
|
+
filename == o.filename
|
255
|
+
end
|
256
|
+
|
257
|
+
# @see the `==` method
|
258
|
+
# @param [Object] Object to be compared
|
259
|
+
def eql?(o)
|
260
|
+
self == o
|
261
|
+
end
|
262
|
+
|
263
|
+
# Calculates hash code according to all attributes.
|
264
|
+
# @return [Integer] Hash code
|
265
|
+
def hash
|
266
|
+
[_href, _created, _type, _artifact, _relative_path, group_id, artifact_id, version, filename].hash
|
267
|
+
end
|
268
|
+
|
269
|
+
# Builds the object from hash
|
270
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
271
|
+
# @return [Object] Returns the model itself
|
272
|
+
def self.build_from_hash(attributes)
|
273
|
+
new.build_from_hash(attributes)
|
274
|
+
end
|
275
|
+
|
276
|
+
# Builds the object from hash
|
277
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
278
|
+
# @return [Object] Returns the model itself
|
279
|
+
def build_from_hash(attributes)
|
280
|
+
return nil unless attributes.is_a?(Hash)
|
281
|
+
self.class.openapi_types.each_pair do |key, type|
|
282
|
+
if type =~ /\AArray<(.*)>/i
|
283
|
+
# check to ensure the input is an array given that the attribute
|
284
|
+
# is documented as an array but the input is not
|
285
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
286
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
287
|
+
end
|
288
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
289
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
290
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
291
|
+
end
|
292
|
+
|
293
|
+
self
|
294
|
+
end
|
295
|
+
|
296
|
+
# Deserializes the data based on type
|
297
|
+
# @param string type Data type
|
298
|
+
# @param string value Value to be deserialized
|
299
|
+
# @return [Object] Deserialized data
|
300
|
+
def _deserialize(type, value)
|
301
|
+
case type.to_sym
|
302
|
+
when :DateTime
|
303
|
+
DateTime.parse(value)
|
304
|
+
when :Date
|
305
|
+
Date.parse(value)
|
306
|
+
when :String
|
307
|
+
value.to_s
|
308
|
+
when :Integer
|
309
|
+
value.to_i
|
310
|
+
when :Float
|
311
|
+
value.to_f
|
312
|
+
when :Boolean
|
313
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
314
|
+
true
|
315
|
+
else
|
316
|
+
false
|
317
|
+
end
|
318
|
+
when :Object
|
319
|
+
# generic object (usually a Hash), return directly
|
320
|
+
value
|
321
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
322
|
+
inner_type = Regexp.last_match[:inner_type]
|
323
|
+
value.map { |v| _deserialize(inner_type, v) }
|
324
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
325
|
+
k_type = Regexp.last_match[:k_type]
|
326
|
+
v_type = Regexp.last_match[:v_type]
|
327
|
+
{}.tap do |hash|
|
328
|
+
value.each do |k, v|
|
329
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
330
|
+
end
|
331
|
+
end
|
332
|
+
else # model
|
333
|
+
PulpMavenClient.const_get(type).build_from_hash(value)
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
# Returns the string representation of the object
|
338
|
+
# @return [String] String presentation of the object
|
339
|
+
def to_s
|
340
|
+
to_hash.to_s
|
341
|
+
end
|
342
|
+
|
343
|
+
# to_body is an alias to to_hash (backward compatibility)
|
344
|
+
# @return [Hash] Returns the object in the form of hash
|
345
|
+
def to_body
|
346
|
+
to_hash
|
347
|
+
end
|
348
|
+
|
349
|
+
# Returns the object in the form of hash
|
350
|
+
# @return [Hash] Returns the object in the form of hash
|
351
|
+
def to_hash
|
352
|
+
hash = {}
|
353
|
+
self.class.attribute_map.each_pair do |attr, param|
|
354
|
+
value = self.send(attr)
|
355
|
+
next if value.nil?
|
356
|
+
hash[param] = _to_hash(value)
|
357
|
+
end
|
358
|
+
hash
|
359
|
+
end
|
360
|
+
|
361
|
+
# Outputs non-array value in the form of hash
|
362
|
+
# For object, use to_hash. Otherwise, just return the value
|
363
|
+
# @param [Object] value Any valid value
|
364
|
+
# @return [Hash] Returns the value in the form of hash
|
365
|
+
def _to_hash(value)
|
366
|
+
if value.is_a?(Array)
|
367
|
+
value.compact.map { |v| _to_hash(v) }
|
368
|
+
elsif value.is_a?(Hash)
|
369
|
+
{}.tap do |hash|
|
370
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
371
|
+
end
|
372
|
+
elsif value.respond_to? :to_hash
|
373
|
+
value.to_hash
|
374
|
+
else
|
375
|
+
value
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|