pulpcore_client 3.12.2 → 3.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -4
  3. data/docs/ContentSummaryResponse.md +21 -0
  4. data/docs/PaginatedPublicationResponseList.md +23 -0
  5. data/docs/PaginatedRepositoryVersionResponseList.md +23 -0
  6. data/docs/PublicationResponse.md +23 -0
  7. data/docs/PublicationsApi.md +90 -0
  8. data/docs/PulpExport.md +1 -1
  9. data/docs/RepositoryResponse.md +2 -0
  10. data/docs/RepositoryVersionResponse.md +27 -0
  11. data/docs/RepositoryVersionsApi.md +96 -0
  12. data/docs/WorkerResponse.md +3 -3
  13. data/lib/pulpcore_client/api/publications_api.rb +120 -0
  14. data/lib/pulpcore_client/api/repository_versions_api.rb +130 -0
  15. data/lib/pulpcore_client/models/content_summary_response.rb +246 -0
  16. data/lib/pulpcore_client/models/paginated_publication_response_list.rb +237 -0
  17. data/lib/pulpcore_client/models/paginated_repository_version_response_list.rb +237 -0
  18. data/lib/pulpcore_client/models/publication_response.rb +236 -0
  19. data/lib/pulpcore_client/models/pulp_export.rb +1 -1
  20. data/lib/pulpcore_client/models/repository_response.rb +27 -1
  21. data/lib/pulpcore_client/models/repository_version_response.rb +255 -0
  22. data/lib/pulpcore_client/models/worker_response.rb +10 -10
  23. data/lib/pulpcore_client/version.rb +1 -1
  24. data/lib/pulpcore_client.rb +7 -0
  25. data/spec/api/publications_api_spec.rb +60 -0
  26. data/spec/api/repository_versions_api_spec.rb +63 -0
  27. data/spec/models/content_summary_response_spec.rb +53 -0
  28. data/spec/models/paginated_publication_response_list_spec.rb +59 -0
  29. data/spec/models/paginated_repository_version_response_list_spec.rb +59 -0
  30. data/spec/models/publication_response_spec.rb +59 -0
  31. data/spec/models/repository_response_spec.rb +6 -0
  32. data/spec/models/repository_version_response_spec.rb +71 -0
  33. data/spec/models/worker_response_spec.rb +2 -2
  34. metadata +96 -68
@@ -0,0 +1,130 @@
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 'cgi'
14
+
15
+ module PulpcoreClient
16
+ class RepositoryVersionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List repository versions
23
+ # @param [Hash] opts the optional parameters
24
+ # @option opts [String] :content Content Unit referenced by HREF
25
+ # @option opts [String] :content__in Content Unit referenced by HREF
26
+ # @option opts [Integer] :limit Number of results to return per page.
27
+ # @option opts [Integer] :number
28
+ # @option opts [Integer] :number__gt Filter results where number is greater than value
29
+ # @option opts [Integer] :number__gte Filter results where number is greater than or equal to value
30
+ # @option opts [Integer] :number__lt Filter results where number is less than value
31
+ # @option opts [Integer] :number__lte Filter results where number is less than or equal to value
32
+ # @option opts [Array<Integer>] :number__range Filter results where number is between two comma separated values
33
+ # @option opts [Integer] :offset The initial index from which to return the results.
34
+ # @option opts [DateTime] :pulp_created ISO 8601 formatted dates are supported
35
+ # @option opts [DateTime] :pulp_created__gt Filter results where pulp_created is greater than value
36
+ # @option opts [DateTime] :pulp_created__gte Filter results where pulp_created is greater than or equal to value
37
+ # @option opts [DateTime] :pulp_created__lt Filter results where pulp_created is less than value
38
+ # @option opts [DateTime] :pulp_created__lte Filter results where pulp_created is less than or equal to value
39
+ # @option opts [Array<DateTime>] :pulp_created__range Filter results where pulp_created is between two comma separated values
40
+ # @option opts [String] :fields A list of fields to include in the response.
41
+ # @option opts [String] :exclude_fields A list of fields to exclude from the response.
42
+ # @return [PaginatedRepositoryVersionResponseList]
43
+ def list(opts = {})
44
+ data, _status_code, _headers = list_with_http_info(opts)
45
+ data
46
+ end
47
+
48
+ # List repository versions
49
+ # @param [Hash] opts the optional parameters
50
+ # @option opts [String] :content Content Unit referenced by HREF
51
+ # @option opts [String] :content__in Content Unit referenced by HREF
52
+ # @option opts [Integer] :limit Number of results to return per page.
53
+ # @option opts [Integer] :number
54
+ # @option opts [Integer] :number__gt Filter results where number is greater than value
55
+ # @option opts [Integer] :number__gte Filter results where number is greater than or equal to value
56
+ # @option opts [Integer] :number__lt Filter results where number is less than value
57
+ # @option opts [Integer] :number__lte Filter results where number is less than or equal to value
58
+ # @option opts [Array<Integer>] :number__range Filter results where number is between two comma separated values
59
+ # @option opts [Integer] :offset The initial index from which to return the results.
60
+ # @option opts [DateTime] :pulp_created ISO 8601 formatted dates are supported
61
+ # @option opts [DateTime] :pulp_created__gt Filter results where pulp_created is greater than value
62
+ # @option opts [DateTime] :pulp_created__gte Filter results where pulp_created is greater than or equal to value
63
+ # @option opts [DateTime] :pulp_created__lt Filter results where pulp_created is less than value
64
+ # @option opts [DateTime] :pulp_created__lte Filter results where pulp_created is less than or equal to value
65
+ # @option opts [Array<DateTime>] :pulp_created__range Filter results where pulp_created is between two comma separated values
66
+ # @option opts [String] :fields A list of fields to include in the response.
67
+ # @option opts [String] :exclude_fields A list of fields to exclude from the response.
68
+ # @return [Array<(PaginatedRepositoryVersionResponseList, Integer, Hash)>] PaginatedRepositoryVersionResponseList data, response status code and response headers
69
+ def list_with_http_info(opts = {})
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug 'Calling API: RepositoryVersionsApi.list ...'
72
+ end
73
+ # resource path
74
+ local_var_path = '/pulp/api/v3/repository_versions/'
75
+
76
+ # query parameters
77
+ query_params = opts[:query_params] || {}
78
+ query_params[:'content'] = opts[:'content'] if !opts[:'content'].nil?
79
+ query_params[:'content__in'] = opts[:'content__in'] if !opts[:'content__in'].nil?
80
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
81
+ query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
82
+ query_params[:'number__gt'] = opts[:'number__gt'] if !opts[:'number__gt'].nil?
83
+ query_params[:'number__gte'] = opts[:'number__gte'] if !opts[:'number__gte'].nil?
84
+ query_params[:'number__lt'] = opts[:'number__lt'] if !opts[:'number__lt'].nil?
85
+ query_params[:'number__lte'] = opts[:'number__lte'] if !opts[:'number__lte'].nil?
86
+ query_params[:'number__range'] = @api_client.build_collection_param(opts[:'number__range'], :csv) if !opts[:'number__range'].nil?
87
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
88
+ query_params[:'pulp_created'] = opts[:'pulp_created'] if !opts[:'pulp_created'].nil?
89
+ query_params[:'pulp_created__gt'] = opts[:'pulp_created__gt'] if !opts[:'pulp_created__gt'].nil?
90
+ query_params[:'pulp_created__gte'] = opts[:'pulp_created__gte'] if !opts[:'pulp_created__gte'].nil?
91
+ query_params[:'pulp_created__lt'] = opts[:'pulp_created__lt'] if !opts[:'pulp_created__lt'].nil?
92
+ query_params[:'pulp_created__lte'] = opts[:'pulp_created__lte'] if !opts[:'pulp_created__lte'].nil?
93
+ query_params[:'pulp_created__range'] = @api_client.build_collection_param(opts[:'pulp_created__range'], :csv) if !opts[:'pulp_created__range'].nil?
94
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
95
+ query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].nil?
96
+
97
+ # header parameters
98
+ header_params = opts[:header_params] || {}
99
+ # HTTP header 'Accept' (if needed)
100
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
101
+
102
+ # form parameters
103
+ form_params = opts[:form_params] || {}
104
+
105
+ # http body (model)
106
+ post_body = opts[:body]
107
+
108
+ # return_type
109
+ return_type = opts[:return_type] || 'PaginatedRepositoryVersionResponseList'
110
+
111
+ # auth_names
112
+ auth_names = opts[:auth_names] || ['basicAuth']
113
+
114
+ new_options = opts.merge(
115
+ :header_params => header_params,
116
+ :query_params => query_params,
117
+ :form_params => form_params,
118
+ :body => post_body,
119
+ :auth_names => auth_names,
120
+ :return_type => return_type
121
+ )
122
+
123
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
124
+ if @api_client.config.debugging
125
+ @api_client.config.logger.debug "API called: RepositoryVersionsApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
126
+ end
127
+ return data, status_code, headers
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,246 @@
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 PulpcoreClient
16
+ # Serializer for the RepositoryVersion content summary
17
+ class ContentSummaryResponse
18
+ attr_accessor :added
19
+
20
+ attr_accessor :removed
21
+
22
+ attr_accessor :present
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'added' => :'added',
28
+ :'removed' => :'removed',
29
+ :'present' => :'present'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'added' => :'Hash<String, Object>',
37
+ :'removed' => :'Hash<String, Object>',
38
+ :'present' => :'Hash<String, Object>'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::ContentSummaryResponse` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::ContentSummaryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'added')
64
+ if (value = attributes[:'added']).is_a?(Hash)
65
+ self.added = value
66
+ end
67
+ end
68
+
69
+ if attributes.key?(:'removed')
70
+ if (value = attributes[:'removed']).is_a?(Hash)
71
+ self.removed = value
72
+ end
73
+ end
74
+
75
+ if attributes.key?(:'present')
76
+ if (value = attributes[:'present']).is_a?(Hash)
77
+ self.present = value
78
+ end
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ if @added.nil?
87
+ invalid_properties.push('invalid value for "added", added cannot be nil.')
88
+ end
89
+
90
+ if @removed.nil?
91
+ invalid_properties.push('invalid value for "removed", removed cannot be nil.')
92
+ end
93
+
94
+ if @present.nil?
95
+ invalid_properties.push('invalid value for "present", present cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ return false if @added.nil?
105
+ return false if @removed.nil?
106
+ return false if @present.nil?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ added == o.added &&
116
+ removed == o.removed &&
117
+ present == o.present
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Integer] Hash code
128
+ def hash
129
+ [added, removed, present].hash
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 self.build_from_hash(attributes)
136
+ new.build_from_hash(attributes)
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def build_from_hash(attributes)
143
+ return nil unless attributes.is_a?(Hash)
144
+ self.class.openapi_types.each_pair do |key, type|
145
+ if type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
154
+ end
155
+
156
+ self
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :DateTime
166
+ DateTime.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ PulpcoreClient.const_get(type).build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ if value.nil?
219
+ is_nullable = self.class.openapi_nullable.include?(attr)
220
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
+ end
222
+
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+ end
246
+ end
@@ -0,0 +1,237 @@
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 PulpcoreClient
16
+ class PaginatedPublicationResponseList
17
+ attr_accessor :count
18
+
19
+ attr_accessor :_next
20
+
21
+ attr_accessor :previous
22
+
23
+ attr_accessor :results
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'count' => :'count',
29
+ :'_next' => :'next',
30
+ :'previous' => :'previous',
31
+ :'results' => :'results'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'count' => :'Integer',
39
+ :'_next' => :'String',
40
+ :'previous' => :'String',
41
+ :'results' => :'Array<PublicationResponse>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'_next',
49
+ :'previous',
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::PaginatedPublicationResponseList` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::PaginatedPublicationResponseList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'count')
69
+ self.count = attributes[:'count']
70
+ end
71
+
72
+ if attributes.key?(:'_next')
73
+ self._next = attributes[:'_next']
74
+ end
75
+
76
+ if attributes.key?(:'previous')
77
+ self.previous = attributes[:'previous']
78
+ end
79
+
80
+ if attributes.key?(:'results')
81
+ if (value = attributes[:'results']).is_a?(Array)
82
+ self.results = value
83
+ end
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
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
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ count == o.count &&
106
+ _next == o._next &&
107
+ previous == o.previous &&
108
+ results == o.results
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [count, _next, previous, results].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.openapi_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ PulpcoreClient.const_get(type).build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+ end
237
+ end