pulpcore_client 3.118.3 → 3.119.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 +18 -4
- data/docs/ArtifactDistributionResponse.md +15 -15
- data/docs/ContentguardsApi.md +4 -4
- data/docs/ContentguardsEnvvarHeaderApi.md +810 -0
- data/docs/EnvVarHeaderContentGuard.md +24 -0
- data/docs/EnvVarHeaderContentGuardResponse.md +32 -0
- data/docs/PaginatedEnvVarHeaderContentGuardResponseList.md +24 -0
- data/docs/PatchedEnvVarHeaderContentGuard.md +24 -0
- data/docs/Purge.md +1 -1
- data/lib/pulpcore_client/api/contentguards_api.rb +6 -6
- data/lib/pulpcore_client/api/contentguards_envvar_header_api.rb +799 -0
- data/lib/pulpcore_client/models/artifact_distribution_response.rb +65 -65
- data/lib/pulpcore_client/models/env_var_header_content_guard.rb +340 -0
- data/lib/pulpcore_client/models/env_var_header_content_guard_response.rb +307 -0
- data/lib/pulpcore_client/models/paginated_env_var_header_content_guard_response_list.rb +257 -0
- data/lib/pulpcore_client/models/patched_env_var_header_content_guard.rb +319 -0
- data/lib/pulpcore_client/models/purge.rb +1 -1
- data/lib/pulpcore_client/version.rb +1 -1
- data/lib/pulpcore_client.rb +5 -0
- data/spec/api/contentguards_api_spec.rb +2 -2
- data/spec/api/contentguards_envvar_header_api_spec.rb +192 -0
- data/spec/models/artifact_distribution_response_spec.rb +12 -12
- data/spec/models/env_var_header_content_guard_response_spec.rb +78 -0
- data/spec/models/env_var_header_content_guard_spec.rb +54 -0
- data/spec/models/paginated_env_var_header_content_guard_response_list_spec.rb +54 -0
- data/spec/models/patched_env_var_header_content_guard_spec.rb +54 -0
- metadata +217 -197
|
@@ -19,56 +19,56 @@ module PulpcoreClient
|
|
|
19
19
|
# The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
|
|
20
20
|
attr_accessor :base_path
|
|
21
21
|
|
|
22
|
+
# The Pulp Resource Name (PRN).
|
|
23
|
+
attr_accessor :prn
|
|
24
|
+
|
|
25
|
+
# Whether this distribution should be shown in the content app.
|
|
26
|
+
attr_accessor :hidden
|
|
27
|
+
|
|
28
|
+
attr_accessor :pulp_href
|
|
29
|
+
|
|
22
30
|
# The URL for accessing the publication as defined by this distribution.
|
|
23
31
|
attr_accessor :base_url
|
|
24
32
|
|
|
25
33
|
# An optional content-guard.
|
|
26
34
|
attr_accessor :content_guard
|
|
27
35
|
|
|
28
|
-
#
|
|
29
|
-
attr_accessor :
|
|
30
|
-
|
|
31
|
-
attr_accessor :pulp_href
|
|
36
|
+
# A unique name. Ex, `rawhide` and `stable`.
|
|
37
|
+
attr_accessor :name
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
attr_accessor :prn
|
|
39
|
+
attr_accessor :pulp_labels
|
|
35
40
|
|
|
36
41
|
# Timestamp of creation.
|
|
37
42
|
attr_accessor :pulp_created
|
|
38
43
|
|
|
39
|
-
#
|
|
40
|
-
attr_accessor :
|
|
44
|
+
# 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.
|
|
45
|
+
attr_accessor :pulp_last_updated
|
|
46
|
+
|
|
47
|
+
# RepositoryVersion to be served
|
|
48
|
+
attr_accessor :repository_version
|
|
41
49
|
|
|
42
50
|
# Timestamp since when the distributed content served by this distribution has not changed. If equals to `null`, no guarantee is provided about content changes.
|
|
43
51
|
attr_accessor :no_content_change_since
|
|
44
52
|
|
|
45
|
-
# Whether this distribution should be shown in the content app.
|
|
46
|
-
attr_accessor :hidden
|
|
47
|
-
|
|
48
|
-
attr_accessor :pulp_labels
|
|
49
|
-
|
|
50
53
|
# The Pulp Resource Name (PRN) of the associated optional content guard.
|
|
51
54
|
attr_accessor :content_guard_prn
|
|
52
55
|
|
|
53
|
-
# 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.
|
|
54
|
-
attr_accessor :pulp_last_updated
|
|
55
|
-
|
|
56
56
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
57
57
|
def self.attribute_map
|
|
58
58
|
{
|
|
59
59
|
:'base_path' => :'base_path',
|
|
60
|
+
:'prn' => :'prn',
|
|
61
|
+
:'hidden' => :'hidden',
|
|
62
|
+
:'pulp_href' => :'pulp_href',
|
|
60
63
|
:'base_url' => :'base_url',
|
|
61
64
|
:'content_guard' => :'content_guard',
|
|
62
|
-
:'repository_version' => :'repository_version',
|
|
63
|
-
:'pulp_href' => :'pulp_href',
|
|
64
|
-
:'prn' => :'prn',
|
|
65
|
-
:'pulp_created' => :'pulp_created',
|
|
66
65
|
:'name' => :'name',
|
|
67
|
-
:'no_content_change_since' => :'no_content_change_since',
|
|
68
|
-
:'hidden' => :'hidden',
|
|
69
66
|
:'pulp_labels' => :'pulp_labels',
|
|
70
|
-
:'
|
|
71
|
-
:'pulp_last_updated' => :'pulp_last_updated'
|
|
67
|
+
:'pulp_created' => :'pulp_created',
|
|
68
|
+
:'pulp_last_updated' => :'pulp_last_updated',
|
|
69
|
+
:'repository_version' => :'repository_version',
|
|
70
|
+
:'no_content_change_since' => :'no_content_change_since',
|
|
71
|
+
:'content_guard_prn' => :'content_guard_prn'
|
|
72
72
|
}
|
|
73
73
|
end
|
|
74
74
|
|
|
@@ -81,18 +81,18 @@ module PulpcoreClient
|
|
|
81
81
|
def self.openapi_types
|
|
82
82
|
{
|
|
83
83
|
:'base_path' => :'String',
|
|
84
|
+
:'prn' => :'String',
|
|
85
|
+
:'hidden' => :'Boolean',
|
|
86
|
+
:'pulp_href' => :'String',
|
|
84
87
|
:'base_url' => :'String',
|
|
85
88
|
:'content_guard' => :'String',
|
|
86
|
-
:'repository_version' => :'String',
|
|
87
|
-
:'pulp_href' => :'String',
|
|
88
|
-
:'prn' => :'String',
|
|
89
|
-
:'pulp_created' => :'Time',
|
|
90
89
|
:'name' => :'String',
|
|
91
|
-
:'no_content_change_since' => :'String',
|
|
92
|
-
:'hidden' => :'Boolean',
|
|
93
90
|
:'pulp_labels' => :'Hash<String, String>',
|
|
94
|
-
:'
|
|
95
|
-
:'pulp_last_updated' => :'Time'
|
|
91
|
+
:'pulp_created' => :'Time',
|
|
92
|
+
:'pulp_last_updated' => :'Time',
|
|
93
|
+
:'repository_version' => :'String',
|
|
94
|
+
:'no_content_change_since' => :'String',
|
|
95
|
+
:'content_guard_prn' => :'String'
|
|
96
96
|
}
|
|
97
97
|
end
|
|
98
98
|
|
|
@@ -125,28 +125,26 @@ module PulpcoreClient
|
|
|
125
125
|
self.base_path = nil
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
-
if attributes.key?(:'
|
|
129
|
-
self.
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
if attributes.key?(:'content_guard')
|
|
133
|
-
self.content_guard = attributes[:'content_guard']
|
|
128
|
+
if attributes.key?(:'prn')
|
|
129
|
+
self.prn = attributes[:'prn']
|
|
134
130
|
end
|
|
135
131
|
|
|
136
|
-
if attributes.key?(:'
|
|
137
|
-
self.
|
|
132
|
+
if attributes.key?(:'hidden')
|
|
133
|
+
self.hidden = attributes[:'hidden']
|
|
134
|
+
else
|
|
135
|
+
self.hidden = false
|
|
138
136
|
end
|
|
139
137
|
|
|
140
138
|
if attributes.key?(:'pulp_href')
|
|
141
139
|
self.pulp_href = attributes[:'pulp_href']
|
|
142
140
|
end
|
|
143
141
|
|
|
144
|
-
if attributes.key?(:'
|
|
145
|
-
self.
|
|
142
|
+
if attributes.key?(:'base_url')
|
|
143
|
+
self.base_url = attributes[:'base_url']
|
|
146
144
|
end
|
|
147
145
|
|
|
148
|
-
if attributes.key?(:'
|
|
149
|
-
self.
|
|
146
|
+
if attributes.key?(:'content_guard')
|
|
147
|
+
self.content_guard = attributes[:'content_guard']
|
|
150
148
|
end
|
|
151
149
|
|
|
152
150
|
if attributes.key?(:'name')
|
|
@@ -155,29 +153,31 @@ module PulpcoreClient
|
|
|
155
153
|
self.name = nil
|
|
156
154
|
end
|
|
157
155
|
|
|
158
|
-
if attributes.key?(:'no_content_change_since')
|
|
159
|
-
self.no_content_change_since = attributes[:'no_content_change_since']
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
if attributes.key?(:'hidden')
|
|
163
|
-
self.hidden = attributes[:'hidden']
|
|
164
|
-
else
|
|
165
|
-
self.hidden = false
|
|
166
|
-
end
|
|
167
|
-
|
|
168
156
|
if attributes.key?(:'pulp_labels')
|
|
169
157
|
if (value = attributes[:'pulp_labels']).is_a?(Hash)
|
|
170
158
|
self.pulp_labels = value
|
|
171
159
|
end
|
|
172
160
|
end
|
|
173
161
|
|
|
174
|
-
if attributes.key?(:'
|
|
175
|
-
self.
|
|
162
|
+
if attributes.key?(:'pulp_created')
|
|
163
|
+
self.pulp_created = attributes[:'pulp_created']
|
|
176
164
|
end
|
|
177
165
|
|
|
178
166
|
if attributes.key?(:'pulp_last_updated')
|
|
179
167
|
self.pulp_last_updated = attributes[:'pulp_last_updated']
|
|
180
168
|
end
|
|
169
|
+
|
|
170
|
+
if attributes.key?(:'repository_version')
|
|
171
|
+
self.repository_version = attributes[:'repository_version']
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if attributes.key?(:'no_content_change_since')
|
|
175
|
+
self.no_content_change_since = attributes[:'no_content_change_since']
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
if attributes.key?(:'content_guard_prn')
|
|
179
|
+
self.content_guard_prn = attributes[:'content_guard_prn']
|
|
180
|
+
end
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -211,18 +211,18 @@ module PulpcoreClient
|
|
|
211
211
|
return true if self.equal?(o)
|
|
212
212
|
self.class == o.class &&
|
|
213
213
|
base_path == o.base_path &&
|
|
214
|
+
prn == o.prn &&
|
|
215
|
+
hidden == o.hidden &&
|
|
216
|
+
pulp_href == o.pulp_href &&
|
|
214
217
|
base_url == o.base_url &&
|
|
215
218
|
content_guard == o.content_guard &&
|
|
216
|
-
repository_version == o.repository_version &&
|
|
217
|
-
pulp_href == o.pulp_href &&
|
|
218
|
-
prn == o.prn &&
|
|
219
|
-
pulp_created == o.pulp_created &&
|
|
220
219
|
name == o.name &&
|
|
221
|
-
no_content_change_since == o.no_content_change_since &&
|
|
222
|
-
hidden == o.hidden &&
|
|
223
220
|
pulp_labels == o.pulp_labels &&
|
|
224
|
-
|
|
225
|
-
pulp_last_updated == o.pulp_last_updated
|
|
221
|
+
pulp_created == o.pulp_created &&
|
|
222
|
+
pulp_last_updated == o.pulp_last_updated &&
|
|
223
|
+
repository_version == o.repository_version &&
|
|
224
|
+
no_content_change_since == o.no_content_change_since &&
|
|
225
|
+
content_guard_prn == o.content_guard_prn
|
|
226
226
|
end
|
|
227
227
|
|
|
228
228
|
# @see the `==` method
|
|
@@ -234,7 +234,7 @@ module PulpcoreClient
|
|
|
234
234
|
# Calculates hash code according to all attributes.
|
|
235
235
|
# @return [Integer] Hash code
|
|
236
236
|
def hash
|
|
237
|
-
[base_path,
|
|
237
|
+
[base_path, prn, hidden, pulp_href, base_url, content_guard, name, pulp_labels, pulp_created, pulp_last_updated, repository_version, no_content_change_since, content_guard_prn].hash
|
|
238
238
|
end
|
|
239
239
|
|
|
240
240
|
# Builds the object from hash
|
|
@@ -0,0 +1,340 @@
|
|
|
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 PulpcoreClient
|
|
17
|
+
# A serializer for EnvVarHeaderContentGuard. The guard expects the request header named ``header_name`` to carry a Base64-encoded UTF-8 representation of the secret. The plaintext secret is read from ``env_var`` on the server at request time and is never stored in or returned by the API.
|
|
18
|
+
class EnvVarHeaderContentGuard
|
|
19
|
+
# The unique name.
|
|
20
|
+
attr_accessor :name
|
|
21
|
+
|
|
22
|
+
# An optional description.
|
|
23
|
+
attr_accessor :description
|
|
24
|
+
|
|
25
|
+
# The header name the guard will check on.
|
|
26
|
+
attr_accessor :header_name
|
|
27
|
+
|
|
28
|
+
# Name of a content-app environment variable holding the expected secret (plaintext UTF-8). Must be listed in ENVVAR_HEADER_CONTENT_GUARD_ALLOWED_VARS. The request header must send that value Base64-encoded. The value is never stored in or returned by the API.
|
|
29
|
+
attr_accessor :env_var
|
|
30
|
+
|
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
32
|
+
def self.attribute_map
|
|
33
|
+
{
|
|
34
|
+
:'name' => :'name',
|
|
35
|
+
:'description' => :'description',
|
|
36
|
+
:'header_name' => :'header_name',
|
|
37
|
+
:'env_var' => :'env_var'
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns all the JSON keys this model knows about
|
|
42
|
+
def self.acceptable_attributes
|
|
43
|
+
attribute_map.values
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Attribute type mapping.
|
|
47
|
+
def self.openapi_types
|
|
48
|
+
{
|
|
49
|
+
:'name' => :'String',
|
|
50
|
+
:'description' => :'String',
|
|
51
|
+
:'header_name' => :'String',
|
|
52
|
+
:'env_var' => :'String'
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# List of attributes with nullable: true
|
|
57
|
+
def self.openapi_nullable
|
|
58
|
+
Set.new([
|
|
59
|
+
:'description',
|
|
60
|
+
])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Initializes the object
|
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
65
|
+
def initialize(attributes = {})
|
|
66
|
+
if (!attributes.is_a?(Hash))
|
|
67
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::EnvVarHeaderContentGuard` initialize method"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
71
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
72
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
73
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::EnvVarHeaderContentGuard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
74
|
+
end
|
|
75
|
+
h[k.to_sym] = v
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'name')
|
|
79
|
+
self.name = attributes[:'name']
|
|
80
|
+
else
|
|
81
|
+
self.name = nil
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if attributes.key?(:'description')
|
|
85
|
+
self.description = attributes[:'description']
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'header_name')
|
|
89
|
+
self.header_name = attributes[:'header_name']
|
|
90
|
+
else
|
|
91
|
+
self.header_name = nil
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'env_var')
|
|
95
|
+
self.env_var = attributes[:'env_var']
|
|
96
|
+
else
|
|
97
|
+
self.env_var = nil
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
102
|
+
# @return Array for valid properties with the reasons
|
|
103
|
+
def list_invalid_properties
|
|
104
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
105
|
+
invalid_properties = Array.new
|
|
106
|
+
if @name.nil?
|
|
107
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if @name.to_s.length < 1
|
|
111
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if !@description.nil? && @description.to_s.length < 1
|
|
115
|
+
invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if @header_name.nil?
|
|
119
|
+
invalid_properties.push('invalid value for "header_name", header_name cannot be nil.')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if @header_name.to_s.length < 1
|
|
123
|
+
invalid_properties.push('invalid value for "header_name", the character length must be great than or equal to 1.')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if @env_var.nil?
|
|
127
|
+
invalid_properties.push('invalid value for "env_var", env_var cannot be nil.')
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if @env_var.to_s.length < 1
|
|
131
|
+
invalid_properties.push('invalid value for "env_var", the character length must be great than or equal to 1.')
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
invalid_properties
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Check to see if the all the properties in the model are valid
|
|
138
|
+
# @return true if the model is valid
|
|
139
|
+
def valid?
|
|
140
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
141
|
+
return false if @name.nil?
|
|
142
|
+
return false if @name.to_s.length < 1
|
|
143
|
+
return false if !@description.nil? && @description.to_s.length < 1
|
|
144
|
+
return false if @header_name.nil?
|
|
145
|
+
return false if @header_name.to_s.length < 1
|
|
146
|
+
return false if @env_var.nil?
|
|
147
|
+
return false if @env_var.to_s.length < 1
|
|
148
|
+
true
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Custom attribute writer method with validation
|
|
152
|
+
# @param [Object] name Value to be assigned
|
|
153
|
+
def name=(name)
|
|
154
|
+
if name.nil?
|
|
155
|
+
fail ArgumentError, 'name cannot be nil'
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if name.to_s.length < 1
|
|
159
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
@name = name
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Custom attribute writer method with validation
|
|
166
|
+
# @param [Object] description Value to be assigned
|
|
167
|
+
def description=(description)
|
|
168
|
+
if !description.nil? && description.to_s.length < 1
|
|
169
|
+
fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
@description = description
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Custom attribute writer method with validation
|
|
176
|
+
# @param [Object] header_name Value to be assigned
|
|
177
|
+
def header_name=(header_name)
|
|
178
|
+
if header_name.nil?
|
|
179
|
+
fail ArgumentError, 'header_name cannot be nil'
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
if header_name.to_s.length < 1
|
|
183
|
+
fail ArgumentError, 'invalid value for "header_name", the character length must be great than or equal to 1.'
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
@header_name = header_name
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Custom attribute writer method with validation
|
|
190
|
+
# @param [Object] env_var Value to be assigned
|
|
191
|
+
def env_var=(env_var)
|
|
192
|
+
if env_var.nil?
|
|
193
|
+
fail ArgumentError, 'env_var cannot be nil'
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
if env_var.to_s.length < 1
|
|
197
|
+
fail ArgumentError, 'invalid value for "env_var", the character length must be great than or equal to 1.'
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
@env_var = env_var
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Checks equality by comparing each attribute.
|
|
204
|
+
# @param [Object] Object to be compared
|
|
205
|
+
def ==(o)
|
|
206
|
+
return true if self.equal?(o)
|
|
207
|
+
self.class == o.class &&
|
|
208
|
+
name == o.name &&
|
|
209
|
+
description == o.description &&
|
|
210
|
+
header_name == o.header_name &&
|
|
211
|
+
env_var == o.env_var
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# @see the `==` method
|
|
215
|
+
# @param [Object] Object to be compared
|
|
216
|
+
def eql?(o)
|
|
217
|
+
self == o
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Calculates hash code according to all attributes.
|
|
221
|
+
# @return [Integer] Hash code
|
|
222
|
+
def hash
|
|
223
|
+
[name, description, header_name, env_var].hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Builds the object from hash
|
|
227
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
228
|
+
# @return [Object] Returns the model itself
|
|
229
|
+
def self.build_from_hash(attributes)
|
|
230
|
+
return nil unless attributes.is_a?(Hash)
|
|
231
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
232
|
+
transformed_hash = {}
|
|
233
|
+
openapi_types.each_pair do |key, type|
|
|
234
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
235
|
+
transformed_hash["#{key}"] = nil
|
|
236
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
237
|
+
# check to ensure the input is an array given that the attribute
|
|
238
|
+
# is documented as an array but the input is not
|
|
239
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
240
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
241
|
+
end
|
|
242
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
243
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
new(transformed_hash)
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Deserializes the data based on type
|
|
250
|
+
# @param string type Data type
|
|
251
|
+
# @param string value Value to be deserialized
|
|
252
|
+
# @return [Object] Deserialized data
|
|
253
|
+
def self._deserialize(type, value)
|
|
254
|
+
case type.to_sym
|
|
255
|
+
when :Time
|
|
256
|
+
Time.parse(value)
|
|
257
|
+
when :Date
|
|
258
|
+
Date.parse(value)
|
|
259
|
+
when :String
|
|
260
|
+
value.to_s
|
|
261
|
+
when :Integer
|
|
262
|
+
value.to_i
|
|
263
|
+
when :Float
|
|
264
|
+
value.to_f
|
|
265
|
+
when :Boolean
|
|
266
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
267
|
+
true
|
|
268
|
+
else
|
|
269
|
+
false
|
|
270
|
+
end
|
|
271
|
+
when :Object
|
|
272
|
+
# generic object (usually a Hash), return directly
|
|
273
|
+
value
|
|
274
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
275
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
276
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
277
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
278
|
+
k_type = Regexp.last_match[:k_type]
|
|
279
|
+
v_type = Regexp.last_match[:v_type]
|
|
280
|
+
{}.tap do |hash|
|
|
281
|
+
value.each do |k, v|
|
|
282
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
else # model
|
|
286
|
+
# models (e.g. Pet) or oneOf
|
|
287
|
+
klass = PulpcoreClient.const_get(type)
|
|
288
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
# Returns the string representation of the object
|
|
293
|
+
# @return [String] String presentation of the object
|
|
294
|
+
def to_s
|
|
295
|
+
to_hash.to_s
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
299
|
+
# @return [Hash] Returns the object in the form of hash
|
|
300
|
+
def to_body
|
|
301
|
+
to_hash
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# Returns the object in the form of hash
|
|
305
|
+
# @return [Hash] Returns the object in the form of hash
|
|
306
|
+
def to_hash
|
|
307
|
+
hash = {}
|
|
308
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
309
|
+
value = self.send(attr)
|
|
310
|
+
if value.nil?
|
|
311
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
312
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
hash[param] = _to_hash(value)
|
|
316
|
+
end
|
|
317
|
+
hash
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# Outputs non-array value in the form of hash
|
|
321
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
322
|
+
# @param [Object] value Any valid value
|
|
323
|
+
# @return [Hash] Returns the value in the form of hash
|
|
324
|
+
def _to_hash(value)
|
|
325
|
+
if value.is_a?(Array)
|
|
326
|
+
value.compact.map { |v| _to_hash(v) }
|
|
327
|
+
elsif value.is_a?(Hash)
|
|
328
|
+
{}.tap do |hash|
|
|
329
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
330
|
+
end
|
|
331
|
+
elsif value.respond_to? :to_hash
|
|
332
|
+
value.to_hash
|
|
333
|
+
else
|
|
334
|
+
value
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
end
|