pulp_certguard_client 1.0.1 → 1.0.2

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -17
  3. data/docs/CertguardRHSMCertGuard.md +1 -5
  4. data/docs/CertguardRHSMCertGuardResponse.md +25 -0
  5. data/docs/CertguardX509CertGuard.md +1 -5
  6. data/docs/CertguardX509CertGuardResponse.md +25 -0
  7. data/docs/ContentguardsRhsmApi.md +55 -55
  8. data/docs/ContentguardsX509Api.md +55 -55
  9. data/docs/InlineResponse200.md +3 -3
  10. data/docs/InlineResponse2001.md +3 -3
  11. data/docs/PatchedcertguardRHSMCertGuard.md +21 -0
  12. data/docs/PatchedcertguardX509CertGuard.md +21 -0
  13. data/lib/pulp_certguard_client.rb +6 -2
  14. data/lib/pulp_certguard_client/api/contentguards_rhsm_api.rb +90 -90
  15. data/lib/pulp_certguard_client/api/contentguards_x509_api.rb +90 -90
  16. data/lib/pulp_certguard_client/api_client.rb +2 -2
  17. data/lib/pulp_certguard_client/api_error.rb +2 -2
  18. data/lib/pulp_certguard_client/configuration.rb +3 -3
  19. data/lib/pulp_certguard_client/models/certguard_rhsm_cert_guard.rb +4 -75
  20. data/lib/pulp_certguard_client/models/certguard_rhsm_cert_guard_response.rb +258 -0
  21. data/lib/pulp_certguard_client/models/certguard_x509_cert_guard.rb +4 -75
  22. data/lib/pulp_certguard_client/models/certguard_x509_cert_guard_response.rb +258 -0
  23. data/lib/pulp_certguard_client/models/inline_response200.rb +3 -13
  24. data/lib/pulp_certguard_client/models/inline_response2001.rb +3 -13
  25. data/lib/pulp_certguard_client/models/patchedcertguard_rhsm_cert_guard.rb +229 -0
  26. data/lib/pulp_certguard_client/models/patchedcertguard_x509_cert_guard.rb +229 -0
  27. data/lib/pulp_certguard_client/version.rb +3 -3
  28. data/pulp_certguard_client.gemspec +4 -4
  29. data/spec/api/contentguards_rhsm_api_spec.rb +17 -17
  30. data/spec/api/contentguards_x509_api_spec.rb +17 -17
  31. data/spec/api_client_spec.rb +2 -2
  32. data/spec/configuration_spec.rb +2 -2
  33. data/spec/models/certguard_rhsm_cert_guard_response_spec.rb +65 -0
  34. data/spec/models/certguard_rhsm_cert_guard_spec.rb +2 -14
  35. data/spec/models/certguard_x509_cert_guard_response_spec.rb +65 -0
  36. data/spec/models/certguard_x509_cert_guard_spec.rb +2 -14
  37. data/spec/models/inline_response2001_spec.rb +2 -2
  38. data/spec/models/inline_response200_spec.rb +2 -2
  39. data/spec/models/patchedcertguard_rhsm_cert_guard_spec.rb +53 -0
  40. data/spec/models/patchedcertguard_x509_cert_guard_spec.rb +53 -0
  41. data/spec/spec_helper.rb +2 -2
  42. metadata +23 -7
@@ -0,0 +1,258 @@
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
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpCertguardClient
16
+ # RHSM Content Guard Serializer.
17
+ class CertguardRHSMCertGuardResponse
18
+ attr_accessor :pulp_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :pulp_created
22
+
23
+ # The unique name.
24
+ attr_accessor :name
25
+
26
+ # An optional description.
27
+ attr_accessor :description
28
+
29
+ # The Certificate Authority (CA) certificate.
30
+ attr_accessor :ca_certificate
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'pulp_href' => :'pulp_href',
36
+ :'pulp_created' => :'pulp_created',
37
+ :'name' => :'name',
38
+ :'description' => :'description',
39
+ :'ca_certificate' => :'ca_certificate'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'pulp_href' => :'String',
47
+ :'pulp_created' => :'DateTime',
48
+ :'name' => :'String',
49
+ :'description' => :'String',
50
+ :'ca_certificate' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ :'description',
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpCertguardClient::CertguardRHSMCertGuardResponse` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpCertguardClient::CertguardRHSMCertGuardResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'pulp_href')
77
+ self.pulp_href = attributes[:'pulp_href']
78
+ end
79
+
80
+ if attributes.key?(:'pulp_created')
81
+ self.pulp_created = attributes[:'pulp_created']
82
+ end
83
+
84
+ if attributes.key?(:'name')
85
+ self.name = attributes[:'name']
86
+ end
87
+
88
+ if attributes.key?(:'description')
89
+ self.description = attributes[:'description']
90
+ end
91
+
92
+ if attributes.key?(:'ca_certificate')
93
+ self.ca_certificate = attributes[:'ca_certificate']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ if @name.nil?
102
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
103
+ end
104
+
105
+ if @ca_certificate.nil?
106
+ invalid_properties.push('invalid value for "ca_certificate", ca_certificate cannot be nil.')
107
+ end
108
+
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ return false if @name.nil?
116
+ return false if @ca_certificate.nil?
117
+ true
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
+ pulp_href == o.pulp_href &&
126
+ pulp_created == o.pulp_created &&
127
+ name == o.name &&
128
+ description == o.description &&
129
+ ca_certificate == o.ca_certificate
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [pulp_href, pulp_created, name, description, ca_certificate].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ new.build_from_hash(attributes)
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.openapi_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ PulpCertguardClient.const_get(type).build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+ end
258
+ end
@@ -1,10 +1,10 @@
1
1
  =begin
2
2
  #Pulp 3 API
3
3
 
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
5
 
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
  OpenAPI Generator version: 4.2.3
10
10
 
@@ -13,12 +13,8 @@ OpenAPI Generator version: 4.2.3
13
13
  require 'date'
14
14
 
15
15
  module PulpCertguardClient
16
+ # X.509 Content Guard Serializer.
16
17
  class CertguardX509CertGuard
17
- attr_accessor :pulp_href
18
-
19
- # Timestamp of creation.
20
- attr_accessor :pulp_created
21
-
22
18
  # The unique name.
23
19
  attr_accessor :name
24
20
 
@@ -31,8 +27,6 @@ module PulpCertguardClient
31
27
  # Attribute mapping from ruby-style variable name to JSON key.
32
28
  def self.attribute_map
33
29
  {
34
- :'pulp_href' => :'pulp_href',
35
- :'pulp_created' => :'pulp_created',
36
30
  :'name' => :'name',
37
31
  :'description' => :'description',
38
32
  :'ca_certificate' => :'ca_certificate'
@@ -42,8 +36,6 @@ module PulpCertguardClient
42
36
  # Attribute type mapping.
43
37
  def self.openapi_types
44
38
  {
45
- :'pulp_href' => :'String',
46
- :'pulp_created' => :'DateTime',
47
39
  :'name' => :'String',
48
40
  :'description' => :'String',
49
41
  :'ca_certificate' => :'String'
@@ -72,14 +64,6 @@ module PulpCertguardClient
72
64
  h[k.to_sym] = v
73
65
  }
74
66
 
75
- if attributes.key?(:'pulp_href')
76
- self.pulp_href = attributes[:'pulp_href']
77
- end
78
-
79
- if attributes.key?(:'pulp_created')
80
- self.pulp_created = attributes[:'pulp_created']
81
- end
82
-
83
67
  if attributes.key?(:'name')
84
68
  self.name = attributes[:'name']
85
69
  end
@@ -101,22 +85,10 @@ module PulpCertguardClient
101
85
  invalid_properties.push('invalid value for "name", name cannot be nil.')
102
86
  end
103
87
 
104
- if @name.to_s.length < 1
105
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
106
- end
107
-
108
- if !@description.nil? && @description.to_s.length < 1
109
- invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
110
- end
111
-
112
88
  if @ca_certificate.nil?
113
89
  invalid_properties.push('invalid value for "ca_certificate", ca_certificate cannot be nil.')
114
90
  end
115
91
 
116
- if @ca_certificate.to_s.length < 1
117
- invalid_properties.push('invalid value for "ca_certificate", the character length must be great than or equal to 1.')
118
- end
119
-
120
92
  invalid_properties
121
93
  end
122
94
 
@@ -124,58 +96,15 @@ module PulpCertguardClient
124
96
  # @return true if the model is valid
125
97
  def valid?
126
98
  return false if @name.nil?
127
- return false if @name.to_s.length < 1
128
- return false if !@description.nil? && @description.to_s.length < 1
129
99
  return false if @ca_certificate.nil?
130
- return false if @ca_certificate.to_s.length < 1
131
100
  true
132
101
  end
133
102
 
134
- # Custom attribute writer method with validation
135
- # @param [Object] name Value to be assigned
136
- def name=(name)
137
- if name.nil?
138
- fail ArgumentError, 'name cannot be nil'
139
- end
140
-
141
- if name.to_s.length < 1
142
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
143
- end
144
-
145
- @name = name
146
- end
147
-
148
- # Custom attribute writer method with validation
149
- # @param [Object] description Value to be assigned
150
- def description=(description)
151
- if !description.nil? && description.to_s.length < 1
152
- fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
153
- end
154
-
155
- @description = description
156
- end
157
-
158
- # Custom attribute writer method with validation
159
- # @param [Object] ca_certificate Value to be assigned
160
- def ca_certificate=(ca_certificate)
161
- if ca_certificate.nil?
162
- fail ArgumentError, 'ca_certificate cannot be nil'
163
- end
164
-
165
- if ca_certificate.to_s.length < 1
166
- fail ArgumentError, 'invalid value for "ca_certificate", the character length must be great than or equal to 1.'
167
- end
168
-
169
- @ca_certificate = ca_certificate
170
- end
171
-
172
103
  # Checks equality by comparing each attribute.
173
104
  # @param [Object] Object to be compared
174
105
  def ==(o)
175
106
  return true if self.equal?(o)
176
107
  self.class == o.class &&
177
- pulp_href == o.pulp_href &&
178
- pulp_created == o.pulp_created &&
179
108
  name == o.name &&
180
109
  description == o.description &&
181
110
  ca_certificate == o.ca_certificate
@@ -190,7 +119,7 @@ module PulpCertguardClient
190
119
  # Calculates hash code according to all attributes.
191
120
  # @return [Integer] Hash code
192
121
  def hash
193
- [pulp_href, pulp_created, name, description, ca_certificate].hash
122
+ [name, description, ca_certificate].hash
194
123
  end
195
124
 
196
125
  # Builds the object from hash
@@ -0,0 +1,258 @@
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
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpCertguardClient
16
+ # X.509 Content Guard Serializer.
17
+ class CertguardX509CertGuardResponse
18
+ attr_accessor :pulp_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :pulp_created
22
+
23
+ # The unique name.
24
+ attr_accessor :name
25
+
26
+ # An optional description.
27
+ attr_accessor :description
28
+
29
+ # The Certificate Authority (CA) certificate.
30
+ attr_accessor :ca_certificate
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'pulp_href' => :'pulp_href',
36
+ :'pulp_created' => :'pulp_created',
37
+ :'name' => :'name',
38
+ :'description' => :'description',
39
+ :'ca_certificate' => :'ca_certificate'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'pulp_href' => :'String',
47
+ :'pulp_created' => :'DateTime',
48
+ :'name' => :'String',
49
+ :'description' => :'String',
50
+ :'ca_certificate' => :'String'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ :'description',
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpCertguardClient::CertguardX509CertGuardResponse` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpCertguardClient::CertguardX509CertGuardResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'pulp_href')
77
+ self.pulp_href = attributes[:'pulp_href']
78
+ end
79
+
80
+ if attributes.key?(:'pulp_created')
81
+ self.pulp_created = attributes[:'pulp_created']
82
+ end
83
+
84
+ if attributes.key?(:'name')
85
+ self.name = attributes[:'name']
86
+ end
87
+
88
+ if attributes.key?(:'description')
89
+ self.description = attributes[:'description']
90
+ end
91
+
92
+ if attributes.key?(:'ca_certificate')
93
+ self.ca_certificate = attributes[:'ca_certificate']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ if @name.nil?
102
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
103
+ end
104
+
105
+ if @ca_certificate.nil?
106
+ invalid_properties.push('invalid value for "ca_certificate", ca_certificate cannot be nil.')
107
+ end
108
+
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ return false if @name.nil?
116
+ return false if @ca_certificate.nil?
117
+ true
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
+ pulp_href == o.pulp_href &&
126
+ pulp_created == o.pulp_created &&
127
+ name == o.name &&
128
+ description == o.description &&
129
+ ca_certificate == o.ca_certificate
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [pulp_href, pulp_created, name, description, ca_certificate].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ new.build_from_hash(attributes)
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.openapi_types.each_pair do |key, type|
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
161
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ PulpCertguardClient.const_get(type).build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+ end
258
+ end