pulp_npm_client 0.1.0a4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -10
- data/docs/AsyncOperationResponse.md +8 -7
- data/docs/ContentPackagesApi.md +126 -64
- data/docs/ContentSummaryResponse.md +12 -11
- data/docs/DistributionsNpmApi.md +362 -93
- data/docs/NpmNpmDistribution.md +18 -15
- data/docs/NpmNpmDistributionResponse.md +30 -21
- data/docs/NpmNpmRemote.md +48 -47
- data/docs/NpmNpmRemoteResponse.md +48 -43
- data/docs/NpmNpmRemoteResponseHiddenFieldsInner.md +20 -0
- data/docs/NpmNpmRepository.md +16 -15
- data/docs/NpmNpmRepositoryResponse.md +28 -23
- data/docs/NpmPackageResponse.md +22 -17
- data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
- data/docs/PaginatednpmNpmDistributionResponseList.md +14 -13
- data/docs/PaginatednpmNpmRemoteResponseList.md +14 -13
- data/docs/PaginatednpmNpmRepositoryResponseList.md +14 -13
- data/docs/PaginatednpmPackageResponseList.md +14 -13
- data/docs/PatchednpmNpmDistribution.md +18 -15
- data/docs/PatchednpmNpmRemote.md +48 -47
- data/docs/PatchednpmNpmRepository.md +16 -15
- data/docs/PolicyEnum.md +4 -5
- data/docs/RemotesNpmApi.md +364 -99
- data/docs/Repair.md +8 -7
- data/docs/RepositoriesNpmApi.md +429 -110
- data/docs/RepositoriesNpmVersionsApi.md +156 -80
- data/docs/RepositoryAddRemoveContent.md +12 -11
- data/docs/RepositorySyncURL.md +10 -9
- data/docs/RepositoryVersionResponse.md +22 -17
- data/docs/SetLabel.md +20 -0
- data/docs/SetLabelResponse.md +20 -0
- data/docs/UnsetLabel.md +18 -0
- data/docs/UnsetLabelResponse.md +20 -0
- data/lib/pulp_npm_client/api/content_packages_api.rb +72 -44
- data/lib/pulp_npm_client/api/distributions_npm_api.rb +243 -47
- data/lib/pulp_npm_client/api/remotes_npm_api.rb +247 -57
- data/lib/pulp_npm_client/api/repositories_npm_api.rb +283 -55
- data/lib/pulp_npm_client/api/repositories_npm_versions_api.rb +71 -52
- data/lib/pulp_npm_client/api_client.rb +137 -102
- data/lib/pulp_npm_client/api_error.rb +2 -1
- data/lib/pulp_npm_client/configuration.rb +163 -22
- data/lib/pulp_npm_client/models/async_operation_response.rb +32 -22
- data/lib/pulp_npm_client/models/content_summary_response.rb +36 -22
- data/lib/pulp_npm_client/models/npm_npm_distribution.rb +51 -25
- data/lib/pulp_npm_client/models/npm_npm_distribution_response.rb +83 -27
- data/lib/pulp_npm_client/models/npm_npm_remote.rb +61 -25
- data/lib/pulp_npm_client/models/npm_npm_remote_response.rb +99 -41
- data/lib/pulp_npm_client/models/npm_npm_remote_response_hidden_fields_inner.rb +237 -0
- data/lib/pulp_npm_client/models/npm_npm_repository.rb +37 -25
- data/lib/pulp_npm_client/models/npm_npm_repository_response.rb +59 -27
- data/lib/pulp_npm_client/models/npm_package_response.rb +58 -24
- data/lib/pulp_npm_client/models/paginated_repository_version_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/paginatednpm_npm_distribution_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/paginatednpm_npm_remote_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/paginatednpm_npm_repository_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/paginatednpm_package_response_list.rb +44 -22
- data/lib/pulp_npm_client/models/patchednpm_npm_distribution.rb +57 -27
- data/lib/pulp_npm_client/models/patchednpm_npm_remote.rb +67 -27
- data/lib/pulp_npm_client/models/patchednpm_npm_repository.rb +40 -26
- data/lib/pulp_npm_client/models/policy_enum.rb +8 -4
- data/lib/pulp_npm_client/models/repair.rb +30 -22
- data/lib/pulp_npm_client/models/repository_add_remove_content.rb +33 -25
- data/lib/pulp_npm_client/models/repository_sync_url.rb +30 -22
- data/lib/pulp_npm_client/models/repository_version_response.rb +53 -25
- data/lib/pulp_npm_client/models/set_label.rb +264 -0
- data/lib/pulp_npm_client/models/set_label_response.rb +255 -0
- data/lib/pulp_npm_client/models/unset_label.rb +252 -0
- data/lib/pulp_npm_client/models/unset_label_response.rb +252 -0
- data/lib/pulp_npm_client/version.rb +2 -2
- data/lib/pulp_npm_client.rb +6 -3
- data/pulp_npm_client.gemspec +10 -7
- data/spec/api/content_packages_api_spec.rb +22 -16
- data/spec/api/distributions_npm_api_spec.rb +51 -14
- data/spec/api/remotes_npm_api_spec.rb +54 -19
- data/spec/api/repositories_npm_api_spec.rb +60 -15
- data/spec/api/repositories_npm_versions_api_spec.rb +23 -19
- data/spec/models/async_operation_response_spec.rb +7 -12
- data/spec/models/content_summary_response_spec.rb +9 -14
- data/spec/models/npm_npm_distribution_response_spec.rb +38 -19
- data/spec/models/npm_npm_distribution_spec.rb +17 -16
- data/spec/models/npm_npm_remote_response_hidden_fields_inner_spec.rb +42 -0
- data/spec/models/npm_npm_remote_response_spec.rb +42 -35
- data/spec/models/npm_npm_remote_spec.rb +27 -32
- data/spec/models/npm_npm_repository_response_spec.rb +27 -20
- data/spec/models/npm_npm_repository_spec.rb +11 -16
- data/spec/models/npm_package_response_spec.rb +24 -17
- data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
- data/spec/models/paginatednpm_npm_distribution_response_list_spec.rb +10 -15
- data/spec/models/paginatednpm_npm_remote_response_list_spec.rb +10 -15
- data/spec/models/paginatednpm_npm_repository_response_list_spec.rb +10 -15
- data/spec/models/paginatednpm_package_response_list_spec.rb +10 -15
- data/spec/models/patchednpm_npm_distribution_spec.rb +17 -16
- data/spec/models/patchednpm_npm_remote_spec.rb +27 -32
- data/spec/models/patchednpm_npm_repository_spec.rb +11 -16
- data/spec/models/policy_enum_spec.rb +6 -11
- data/spec/models/repair_spec.rb +7 -12
- data/spec/models/repository_add_remove_content_spec.rb +9 -14
- data/spec/models/repository_sync_url_spec.rb +8 -13
- data/spec/models/repository_version_response_spec.rb +24 -17
- data/spec/models/set_label_response_spec.rb +42 -0
- data/spec/models/set_label_spec.rb +42 -0
- data/spec/models/unset_label_response_spec.rb +42 -0
- data/spec/models/unset_label_spec.rb +36 -0
- data/spec/spec_helper.rb +1 -1
- metadata +94 -59
- data/docs/NpmPackage.md +0 -29
- data/docs/PulpNpmPackagesApi.md +0 -60
- data/git_push.sh +0 -58
- data/lib/pulp_npm_client/api/pulp_npm_packages_api.rb +0 -86
- data/lib/pulp_npm_client/models/npm_package.rb +0 -337
- data/spec/api/pulp_npm_packages_api_spec.rb +0 -48
- data/spec/api_client_spec.rb +0 -188
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/npm_package_spec.rb +0 -77
|
@@ -6,20 +6,27 @@
|
|
|
6
6
|
The version of the OpenAPI document: v3
|
|
7
7
|
Contact: pulp-list@redhat.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
|
|
9
|
+
Generator version: 7.10.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
require 'date'
|
|
14
|
+
require 'time'
|
|
14
15
|
|
|
15
16
|
module PulpNpmClient
|
|
16
|
-
# Base serializer for use with
|
|
17
|
+
# Base serializer for use with [pulpcore.app.models.Model][] This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
|
|
17
18
|
class RepositoryVersionResponse
|
|
18
19
|
attr_accessor :pulp_href
|
|
19
20
|
|
|
21
|
+
# The Pulp Resource Name (PRN).
|
|
22
|
+
attr_accessor :prn
|
|
23
|
+
|
|
20
24
|
# Timestamp of creation.
|
|
21
25
|
attr_accessor :pulp_created
|
|
22
26
|
|
|
27
|
+
# Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.
|
|
28
|
+
attr_accessor :pulp_last_updated
|
|
29
|
+
|
|
23
30
|
attr_accessor :number
|
|
24
31
|
|
|
25
32
|
attr_accessor :repository
|
|
@@ -34,7 +41,9 @@ module PulpNpmClient
|
|
|
34
41
|
def self.attribute_map
|
|
35
42
|
{
|
|
36
43
|
:'pulp_href' => :'pulp_href',
|
|
44
|
+
:'prn' => :'prn',
|
|
37
45
|
:'pulp_created' => :'pulp_created',
|
|
46
|
+
:'pulp_last_updated' => :'pulp_last_updated',
|
|
38
47
|
:'number' => :'number',
|
|
39
48
|
:'repository' => :'repository',
|
|
40
49
|
:'base_version' => :'base_version',
|
|
@@ -42,11 +51,18 @@ module PulpNpmClient
|
|
|
42
51
|
}
|
|
43
52
|
end
|
|
44
53
|
|
|
54
|
+
# Returns all the JSON keys this model knows about
|
|
55
|
+
def self.acceptable_attributes
|
|
56
|
+
attribute_map.values
|
|
57
|
+
end
|
|
58
|
+
|
|
45
59
|
# Attribute type mapping.
|
|
46
60
|
def self.openapi_types
|
|
47
61
|
{
|
|
48
62
|
:'pulp_href' => :'String',
|
|
49
|
-
:'
|
|
63
|
+
:'prn' => :'String',
|
|
64
|
+
:'pulp_created' => :'Time',
|
|
65
|
+
:'pulp_last_updated' => :'Time',
|
|
50
66
|
:'number' => :'Integer',
|
|
51
67
|
:'repository' => :'String',
|
|
52
68
|
:'base_version' => :'String',
|
|
@@ -79,10 +95,18 @@ module PulpNpmClient
|
|
|
79
95
|
self.pulp_href = attributes[:'pulp_href']
|
|
80
96
|
end
|
|
81
97
|
|
|
98
|
+
if attributes.key?(:'prn')
|
|
99
|
+
self.prn = attributes[:'prn']
|
|
100
|
+
end
|
|
101
|
+
|
|
82
102
|
if attributes.key?(:'pulp_created')
|
|
83
103
|
self.pulp_created = attributes[:'pulp_created']
|
|
84
104
|
end
|
|
85
105
|
|
|
106
|
+
if attributes.key?(:'pulp_last_updated')
|
|
107
|
+
self.pulp_last_updated = attributes[:'pulp_last_updated']
|
|
108
|
+
end
|
|
109
|
+
|
|
86
110
|
if attributes.key?(:'number')
|
|
87
111
|
self.number = attributes[:'number']
|
|
88
112
|
end
|
|
@@ -103,6 +127,7 @@ module PulpNpmClient
|
|
|
103
127
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
104
128
|
# @return Array for valid properties with the reasons
|
|
105
129
|
def list_invalid_properties
|
|
130
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
106
131
|
invalid_properties = Array.new
|
|
107
132
|
invalid_properties
|
|
108
133
|
end
|
|
@@ -110,6 +135,7 @@ module PulpNpmClient
|
|
|
110
135
|
# Check to see if the all the properties in the model are valid
|
|
111
136
|
# @return true if the model is valid
|
|
112
137
|
def valid?
|
|
138
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
113
139
|
true
|
|
114
140
|
end
|
|
115
141
|
|
|
@@ -119,7 +145,9 @@ module PulpNpmClient
|
|
|
119
145
|
return true if self.equal?(o)
|
|
120
146
|
self.class == o.class &&
|
|
121
147
|
pulp_href == o.pulp_href &&
|
|
148
|
+
prn == o.prn &&
|
|
122
149
|
pulp_created == o.pulp_created &&
|
|
150
|
+
pulp_last_updated == o.pulp_last_updated &&
|
|
123
151
|
number == o.number &&
|
|
124
152
|
repository == o.repository &&
|
|
125
153
|
base_version == o.base_version &&
|
|
@@ -135,44 +163,40 @@ module PulpNpmClient
|
|
|
135
163
|
# Calculates hash code according to all attributes.
|
|
136
164
|
# @return [Integer] Hash code
|
|
137
165
|
def hash
|
|
138
|
-
[pulp_href, pulp_created, number, repository, base_version, content_summary].hash
|
|
166
|
+
[pulp_href, prn, pulp_created, pulp_last_updated, number, repository, base_version, content_summary].hash
|
|
139
167
|
end
|
|
140
168
|
|
|
141
169
|
# Builds the object from hash
|
|
142
170
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
143
171
|
# @return [Object] Returns the model itself
|
|
144
172
|
def self.build_from_hash(attributes)
|
|
145
|
-
new.build_from_hash(attributes)
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
# Builds the object from hash
|
|
149
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
|
150
|
-
# @return [Object] Returns the model itself
|
|
151
|
-
def build_from_hash(attributes)
|
|
152
173
|
return nil unless attributes.is_a?(Hash)
|
|
153
|
-
|
|
154
|
-
|
|
174
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
175
|
+
transformed_hash = {}
|
|
176
|
+
openapi_types.each_pair do |key, type|
|
|
177
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
178
|
+
transformed_hash["#{key}"] = nil
|
|
179
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
155
180
|
# check to ensure the input is an array given that the attribute
|
|
156
181
|
# is documented as an array but the input is not
|
|
157
|
-
if attributes[
|
|
158
|
-
|
|
182
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
183
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
159
184
|
end
|
|
160
|
-
elsif !attributes[
|
|
161
|
-
|
|
162
|
-
end
|
|
185
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
186
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
187
|
+
end
|
|
163
188
|
end
|
|
164
|
-
|
|
165
|
-
self
|
|
189
|
+
new(transformed_hash)
|
|
166
190
|
end
|
|
167
191
|
|
|
168
192
|
# Deserializes the data based on type
|
|
169
193
|
# @param string type Data type
|
|
170
194
|
# @param string value Value to be deserialized
|
|
171
195
|
# @return [Object] Deserialized data
|
|
172
|
-
def _deserialize(type, value)
|
|
196
|
+
def self._deserialize(type, value)
|
|
173
197
|
case type.to_sym
|
|
174
|
-
when :
|
|
175
|
-
|
|
198
|
+
when :Time
|
|
199
|
+
Time.parse(value)
|
|
176
200
|
when :Date
|
|
177
201
|
Date.parse(value)
|
|
178
202
|
when :String
|
|
@@ -202,7 +226,9 @@ module PulpNpmClient
|
|
|
202
226
|
end
|
|
203
227
|
end
|
|
204
228
|
else # model
|
|
205
|
-
|
|
229
|
+
# models (e.g. Pet) or oneOf
|
|
230
|
+
klass = PulpNpmClient.const_get(type)
|
|
231
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
206
232
|
end
|
|
207
233
|
end
|
|
208
234
|
|
|
@@ -228,7 +254,7 @@ module PulpNpmClient
|
|
|
228
254
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
229
255
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
230
256
|
end
|
|
231
|
-
|
|
257
|
+
|
|
232
258
|
hash[param] = _to_hash(value)
|
|
233
259
|
end
|
|
234
260
|
hash
|
|
@@ -251,5 +277,7 @@ module PulpNpmClient
|
|
|
251
277
|
value
|
|
252
278
|
end
|
|
253
279
|
end
|
|
280
|
+
|
|
254
281
|
end
|
|
282
|
+
|
|
255
283
|
end
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Pulp 3 API
|
|
3
|
+
|
|
4
|
+
#Fetch, Upload, Organize, and Distribute Software Packages
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v3
|
|
7
|
+
Contact: pulp-list@redhat.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.10.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module PulpNpmClient
|
|
17
|
+
# Serializer for synchronously setting a label.
|
|
18
|
+
class SetLabel
|
|
19
|
+
attr_accessor :key
|
|
20
|
+
|
|
21
|
+
attr_accessor :value
|
|
22
|
+
|
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
24
|
+
def self.attribute_map
|
|
25
|
+
{
|
|
26
|
+
:'key' => :'key',
|
|
27
|
+
:'value' => :'value'
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Returns all the JSON keys this model knows about
|
|
32
|
+
def self.acceptable_attributes
|
|
33
|
+
attribute_map.values
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Attribute type mapping.
|
|
37
|
+
def self.openapi_types
|
|
38
|
+
{
|
|
39
|
+
:'key' => :'String',
|
|
40
|
+
:'value' => :'String'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# List of attributes with nullable: true
|
|
45
|
+
def self.openapi_nullable
|
|
46
|
+
Set.new([
|
|
47
|
+
:'value'
|
|
48
|
+
])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Initializes the object
|
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
53
|
+
def initialize(attributes = {})
|
|
54
|
+
if (!attributes.is_a?(Hash))
|
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpNpmClient::SetLabel` initialize method"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpNpmClient::SetLabel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
62
|
+
end
|
|
63
|
+
h[k.to_sym] = v
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:'key')
|
|
67
|
+
self.key = attributes[:'key']
|
|
68
|
+
else
|
|
69
|
+
self.key = nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if attributes.key?(:'value')
|
|
73
|
+
self.value = attributes[:'value']
|
|
74
|
+
else
|
|
75
|
+
self.value = nil
|
|
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
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
83
|
+
invalid_properties = Array.new
|
|
84
|
+
if @key.nil?
|
|
85
|
+
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if @key.to_s.length < 1
|
|
89
|
+
invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
|
93
|
+
if @key !~ pattern
|
|
94
|
+
invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
invalid_properties
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Check to see if the all the properties in the model are valid
|
|
101
|
+
# @return true if the model is valid
|
|
102
|
+
def valid?
|
|
103
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
104
|
+
return false if @key.nil?
|
|
105
|
+
return false if @key.to_s.length < 1
|
|
106
|
+
return false if @key !~ Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
|
107
|
+
true
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Custom attribute writer method with validation
|
|
111
|
+
# @param [Object] key Value to be assigned
|
|
112
|
+
def key=(key)
|
|
113
|
+
if key.nil?
|
|
114
|
+
fail ArgumentError, 'key cannot be nil'
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if key.to_s.length < 1
|
|
118
|
+
fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.'
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
|
122
|
+
if key !~ pattern
|
|
123
|
+
fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
@key = key
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Checks equality by comparing each attribute.
|
|
130
|
+
# @param [Object] Object to be compared
|
|
131
|
+
def ==(o)
|
|
132
|
+
return true if self.equal?(o)
|
|
133
|
+
self.class == o.class &&
|
|
134
|
+
key == o.key &&
|
|
135
|
+
value == o.value
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# @see the `==` method
|
|
139
|
+
# @param [Object] Object to be compared
|
|
140
|
+
def eql?(o)
|
|
141
|
+
self == o
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Calculates hash code according to all attributes.
|
|
145
|
+
# @return [Integer] Hash code
|
|
146
|
+
def hash
|
|
147
|
+
[key, value].hash
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Builds the object from hash
|
|
151
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
152
|
+
# @return [Object] Returns the model itself
|
|
153
|
+
def self.build_from_hash(attributes)
|
|
154
|
+
return nil unless attributes.is_a?(Hash)
|
|
155
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
156
|
+
transformed_hash = {}
|
|
157
|
+
openapi_types.each_pair do |key, type|
|
|
158
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
159
|
+
transformed_hash["#{key}"] = nil
|
|
160
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
161
|
+
# check to ensure the input is an array given that the attribute
|
|
162
|
+
# is documented as an array but the input is not
|
|
163
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
164
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
165
|
+
end
|
|
166
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
167
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
new(transformed_hash)
|
|
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 self._deserialize(type, value)
|
|
178
|
+
case type.to_sym
|
|
179
|
+
when :Time
|
|
180
|
+
Time.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 =~ /\A(true|t|yes|y|1)\z/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
|
+
# models (e.g. Pet) or oneOf
|
|
211
|
+
klass = PulpNpmClient.const_get(type)
|
|
212
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Returns the string representation of the object
|
|
217
|
+
# @return [String] String presentation of the object
|
|
218
|
+
def to_s
|
|
219
|
+
to_hash.to_s
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
|
224
|
+
def to_body
|
|
225
|
+
to_hash
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Returns the object in the form of hash
|
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
|
230
|
+
def to_hash
|
|
231
|
+
hash = {}
|
|
232
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
233
|
+
value = self.send(attr)
|
|
234
|
+
if value.nil?
|
|
235
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
236
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
hash[param] = _to_hash(value)
|
|
240
|
+
end
|
|
241
|
+
hash
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Outputs non-array value in the form of hash
|
|
245
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
246
|
+
# @param [Object] value Any valid value
|
|
247
|
+
# @return [Hash] Returns the value in the form of hash
|
|
248
|
+
def _to_hash(value)
|
|
249
|
+
if value.is_a?(Array)
|
|
250
|
+
value.compact.map { |v| _to_hash(v) }
|
|
251
|
+
elsif value.is_a?(Hash)
|
|
252
|
+
{}.tap do |hash|
|
|
253
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
254
|
+
end
|
|
255
|
+
elsif value.respond_to? :to_hash
|
|
256
|
+
value.to_hash
|
|
257
|
+
else
|
|
258
|
+
value
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
end
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Pulp 3 API
|
|
3
|
+
|
|
4
|
+
#Fetch, Upload, Organize, and Distribute Software Packages
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v3
|
|
7
|
+
Contact: pulp-list@redhat.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.10.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module PulpNpmClient
|
|
17
|
+
# Serializer for synchronously setting a label.
|
|
18
|
+
class SetLabelResponse
|
|
19
|
+
attr_accessor :key
|
|
20
|
+
|
|
21
|
+
attr_accessor :value
|
|
22
|
+
|
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
24
|
+
def self.attribute_map
|
|
25
|
+
{
|
|
26
|
+
:'key' => :'key',
|
|
27
|
+
:'value' => :'value'
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Returns all the JSON keys this model knows about
|
|
32
|
+
def self.acceptable_attributes
|
|
33
|
+
attribute_map.values
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Attribute type mapping.
|
|
37
|
+
def self.openapi_types
|
|
38
|
+
{
|
|
39
|
+
:'key' => :'String',
|
|
40
|
+
:'value' => :'String'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# List of attributes with nullable: true
|
|
45
|
+
def self.openapi_nullable
|
|
46
|
+
Set.new([
|
|
47
|
+
:'value'
|
|
48
|
+
])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Initializes the object
|
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
53
|
+
def initialize(attributes = {})
|
|
54
|
+
if (!attributes.is_a?(Hash))
|
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpNpmClient::SetLabelResponse` initialize method"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpNpmClient::SetLabelResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
62
|
+
end
|
|
63
|
+
h[k.to_sym] = v
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:'key')
|
|
67
|
+
self.key = attributes[:'key']
|
|
68
|
+
else
|
|
69
|
+
self.key = nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if attributes.key?(:'value')
|
|
73
|
+
self.value = attributes[:'value']
|
|
74
|
+
else
|
|
75
|
+
self.value = nil
|
|
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
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
83
|
+
invalid_properties = Array.new
|
|
84
|
+
if @key.nil?
|
|
85
|
+
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
|
89
|
+
if @key !~ pattern
|
|
90
|
+
invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
invalid_properties
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Check to see if the all the properties in the model are valid
|
|
97
|
+
# @return true if the model is valid
|
|
98
|
+
def valid?
|
|
99
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
100
|
+
return false if @key.nil?
|
|
101
|
+
return false if @key !~ Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
|
102
|
+
true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Custom attribute writer method with validation
|
|
106
|
+
# @param [Object] key Value to be assigned
|
|
107
|
+
def key=(key)
|
|
108
|
+
if key.nil?
|
|
109
|
+
fail ArgumentError, 'key cannot be nil'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
|
|
113
|
+
if key !~ pattern
|
|
114
|
+
fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
@key = key
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Checks equality by comparing each attribute.
|
|
121
|
+
# @param [Object] Object to be compared
|
|
122
|
+
def ==(o)
|
|
123
|
+
return true if self.equal?(o)
|
|
124
|
+
self.class == o.class &&
|
|
125
|
+
key == o.key &&
|
|
126
|
+
value == o.value
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# @see the `==` method
|
|
130
|
+
# @param [Object] Object to be compared
|
|
131
|
+
def eql?(o)
|
|
132
|
+
self == o
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Calculates hash code according to all attributes.
|
|
136
|
+
# @return [Integer] Hash code
|
|
137
|
+
def hash
|
|
138
|
+
[key, value].hash
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Builds the object from hash
|
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
143
|
+
# @return [Object] Returns the model itself
|
|
144
|
+
def self.build_from_hash(attributes)
|
|
145
|
+
return nil unless attributes.is_a?(Hash)
|
|
146
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
147
|
+
transformed_hash = {}
|
|
148
|
+
openapi_types.each_pair do |key, type|
|
|
149
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
150
|
+
transformed_hash["#{key}"] = nil
|
|
151
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
152
|
+
# check to ensure the input is an array given that the attribute
|
|
153
|
+
# is documented as an array but the input is not
|
|
154
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
155
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
156
|
+
end
|
|
157
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
158
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
new(transformed_hash)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Deserializes the data based on type
|
|
165
|
+
# @param string type Data type
|
|
166
|
+
# @param string value Value to be deserialized
|
|
167
|
+
# @return [Object] Deserialized data
|
|
168
|
+
def self._deserialize(type, value)
|
|
169
|
+
case type.to_sym
|
|
170
|
+
when :Time
|
|
171
|
+
Time.parse(value)
|
|
172
|
+
when :Date
|
|
173
|
+
Date.parse(value)
|
|
174
|
+
when :String
|
|
175
|
+
value.to_s
|
|
176
|
+
when :Integer
|
|
177
|
+
value.to_i
|
|
178
|
+
when :Float
|
|
179
|
+
value.to_f
|
|
180
|
+
when :Boolean
|
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
182
|
+
true
|
|
183
|
+
else
|
|
184
|
+
false
|
|
185
|
+
end
|
|
186
|
+
when :Object
|
|
187
|
+
# generic object (usually a Hash), return directly
|
|
188
|
+
value
|
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
|
195
|
+
{}.tap do |hash|
|
|
196
|
+
value.each do |k, v|
|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
else # model
|
|
201
|
+
# models (e.g. Pet) or oneOf
|
|
202
|
+
klass = PulpNpmClient.const_get(type)
|
|
203
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Returns the string representation of the object
|
|
208
|
+
# @return [String] String presentation of the object
|
|
209
|
+
def to_s
|
|
210
|
+
to_hash.to_s
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
|
215
|
+
def to_body
|
|
216
|
+
to_hash
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Returns the object in the form of hash
|
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
|
221
|
+
def to_hash
|
|
222
|
+
hash = {}
|
|
223
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
224
|
+
value = self.send(attr)
|
|
225
|
+
if value.nil?
|
|
226
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
227
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
hash[param] = _to_hash(value)
|
|
231
|
+
end
|
|
232
|
+
hash
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Outputs non-array value in the form of hash
|
|
236
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
237
|
+
# @param [Object] value Any valid value
|
|
238
|
+
# @return [Hash] Returns the value in the form of hash
|
|
239
|
+
def _to_hash(value)
|
|
240
|
+
if value.is_a?(Array)
|
|
241
|
+
value.compact.map { |v| _to_hash(v) }
|
|
242
|
+
elsif value.is_a?(Hash)
|
|
243
|
+
{}.tap do |hash|
|
|
244
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
245
|
+
end
|
|
246
|
+
elsif value.respond_to? :to_hash
|
|
247
|
+
value.to_hash
|
|
248
|
+
else
|
|
249
|
+
value
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
end
|