pulp_deb_client 3.7.0 → 3.8.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -16
  3. data/docs/AcsDebApi.md +886 -0
  4. data/docs/DebAptAlternateContentSource.md +24 -0
  5. data/docs/DebAptAlternateContentSourceResponse.md +32 -0
  6. data/docs/DebAptRepository.md +2 -0
  7. data/docs/DebAptRepositoryResponse.md +2 -0
  8. data/docs/DistributionsAptApi.md +10 -10
  9. data/docs/PaginateddebAptAlternateContentSourceResponseList.md +24 -0
  10. data/docs/PatcheddebAptAlternateContentSource.md +24 -0
  11. data/docs/PatcheddebAptRepository.md +2 -0
  12. data/docs/RemotesAptApi.md +10 -10
  13. data/docs/RepositoriesAptApi.md +10 -10
  14. data/docs/TaskGroupOperationResponse.md +18 -0
  15. data/lib/pulp_deb_client/api/acs_deb_api.rb +865 -0
  16. data/lib/pulp_deb_client/api/distributions_apt_api.rb +10 -10
  17. data/lib/pulp_deb_client/api/remotes_apt_api.rb +10 -10
  18. data/lib/pulp_deb_client/api/repositories_apt_api.rb +10 -10
  19. data/lib/pulp_deb_client/models/deb_apt_alternate_content_source.rb +282 -0
  20. data/lib/pulp_deb_client/models/deb_apt_alternate_content_source_response.rb +302 -0
  21. data/lib/pulp_deb_client/models/deb_apt_repository.rb +13 -1
  22. data/lib/pulp_deb_client/models/deb_apt_repository_response.rb +13 -1
  23. data/lib/pulp_deb_client/models/paginateddeb_apt_alternate_content_source_response_list.rb +257 -0
  24. data/lib/pulp_deb_client/models/patcheddeb_apt_alternate_content_source.rb +268 -0
  25. data/lib/pulp_deb_client/models/patcheddeb_apt_repository.rb +13 -1
  26. data/lib/pulp_deb_client/models/task_group_operation_response.rb +223 -0
  27. data/lib/pulp_deb_client/version.rb +1 -1
  28. data/lib/pulp_deb_client.rb +6 -0
  29. data/spec/api/acs_deb_api_spec.rb +204 -0
  30. data/spec/api/distributions_apt_api_spec.rb +4 -4
  31. data/spec/api/remotes_apt_api_spec.rb +4 -4
  32. data/spec/api/repositories_apt_api_spec.rb +4 -4
  33. data/spec/models/deb_apt_alternate_content_source_response_spec.rb +78 -0
  34. data/spec/models/deb_apt_alternate_content_source_spec.rb +54 -0
  35. data/spec/models/deb_apt_repository_response_spec.rb +6 -0
  36. data/spec/models/deb_apt_repository_spec.rb +6 -0
  37. data/spec/models/paginateddeb_apt_alternate_content_source_response_list_spec.rb +54 -0
  38. data/spec/models/patcheddeb_apt_alternate_content_source_spec.rb +54 -0
  39. data/spec/models/patcheddeb_apt_repository_spec.rb +6 -0
  40. data/spec/models/task_group_operation_response_spec.rb +36 -0
  41. metadata +97 -73
@@ -523,24 +523,24 @@ module PulpDebClient
523
523
  end
524
524
 
525
525
  # Update an apt distribution
526
- # Trigger an asynchronous partial update task
526
+ # Update the entity partially and trigger an asynchronous task if necessary
527
527
  # @param deb_apt_distribution_href [String]
528
528
  # @param patcheddeb_apt_distribution [PatcheddebAptDistribution]
529
529
  # @param [Hash] opts the optional parameters
530
530
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
531
- # @return [AsyncOperationResponse]
531
+ # @return [DebAptDistributionResponse]
532
532
  def partial_update(deb_apt_distribution_href, patcheddeb_apt_distribution, opts = {})
533
533
  data, _status_code, _headers = partial_update_with_http_info(deb_apt_distribution_href, patcheddeb_apt_distribution, opts)
534
534
  data
535
535
  end
536
536
 
537
537
  # Update an apt distribution
538
- # Trigger an asynchronous partial update task
538
+ # Update the entity partially and trigger an asynchronous task if necessary
539
539
  # @param deb_apt_distribution_href [String]
540
540
  # @param patcheddeb_apt_distribution [PatcheddebAptDistribution]
541
541
  # @param [Hash] opts the optional parameters
542
542
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
543
- # @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers
543
+ # @return [Array<(DebAptDistributionResponse, Integer, Hash)>] DebAptDistributionResponse data, response status code and response headers
544
544
  def partial_update_with_http_info(deb_apt_distribution_href, patcheddeb_apt_distribution, opts = {})
545
545
  if @api_client.config.debugging
546
546
  @api_client.config.logger.debug 'Calling API: DistributionsAptApi.partial_update ...'
@@ -577,7 +577,7 @@ module PulpDebClient
577
577
  post_body = opts[:debug_body] || @api_client.object_to_http_body(patcheddeb_apt_distribution)
578
578
 
579
579
  # return_type
580
- return_type = opts[:debug_return_type] || 'AsyncOperationResponse'
580
+ return_type = opts[:debug_return_type] || 'DebAptDistributionResponse'
581
581
 
582
582
  # auth_names
583
583
  auth_names = opts[:debug_auth_names] || ['basicAuth']
@@ -903,24 +903,24 @@ module PulpDebClient
903
903
  end
904
904
 
905
905
  # Update an apt distribution
906
- # Trigger an asynchronous update task
906
+ # Update the entity and trigger an asynchronous task if necessary
907
907
  # @param deb_apt_distribution_href [String]
908
908
  # @param deb_apt_distribution [DebAptDistribution]
909
909
  # @param [Hash] opts the optional parameters
910
910
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
911
- # @return [AsyncOperationResponse]
911
+ # @return [DebAptDistributionResponse]
912
912
  def update(deb_apt_distribution_href, deb_apt_distribution, opts = {})
913
913
  data, _status_code, _headers = update_with_http_info(deb_apt_distribution_href, deb_apt_distribution, opts)
914
914
  data
915
915
  end
916
916
 
917
917
  # Update an apt distribution
918
- # Trigger an asynchronous update task
918
+ # Update the entity and trigger an asynchronous task if necessary
919
919
  # @param deb_apt_distribution_href [String]
920
920
  # @param deb_apt_distribution [DebAptDistribution]
921
921
  # @param [Hash] opts the optional parameters
922
922
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
923
- # @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers
923
+ # @return [Array<(DebAptDistributionResponse, Integer, Hash)>] DebAptDistributionResponse data, response status code and response headers
924
924
  def update_with_http_info(deb_apt_distribution_href, deb_apt_distribution, opts = {})
925
925
  if @api_client.config.debugging
926
926
  @api_client.config.logger.debug 'Calling API: DistributionsAptApi.update ...'
@@ -957,7 +957,7 @@ module PulpDebClient
957
957
  post_body = opts[:debug_body] || @api_client.object_to_http_body(deb_apt_distribution)
958
958
 
959
959
  # return_type
960
- return_type = opts[:debug_return_type] || 'AsyncOperationResponse'
960
+ return_type = opts[:debug_return_type] || 'DebAptDistributionResponse'
961
961
 
962
962
  # auth_names
963
963
  auth_names = opts[:debug_auth_names] || ['basicAuth']
@@ -520,24 +520,24 @@ module PulpDebClient
520
520
  end
521
521
 
522
522
  # Update an apt remote
523
- # Trigger an asynchronous partial update task
523
+ # Update the entity partially and trigger an asynchronous task if necessary
524
524
  # @param deb_apt_remote_href [String]
525
525
  # @param patcheddeb_apt_remote [PatcheddebAptRemote]
526
526
  # @param [Hash] opts the optional parameters
527
527
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
528
- # @return [AsyncOperationResponse]
528
+ # @return [DebAptRemoteResponse]
529
529
  def partial_update(deb_apt_remote_href, patcheddeb_apt_remote, opts = {})
530
530
  data, _status_code, _headers = partial_update_with_http_info(deb_apt_remote_href, patcheddeb_apt_remote, opts)
531
531
  data
532
532
  end
533
533
 
534
534
  # Update an apt remote
535
- # Trigger an asynchronous partial update task
535
+ # Update the entity partially and trigger an asynchronous task if necessary
536
536
  # @param deb_apt_remote_href [String]
537
537
  # @param patcheddeb_apt_remote [PatcheddebAptRemote]
538
538
  # @param [Hash] opts the optional parameters
539
539
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
540
- # @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers
540
+ # @return [Array<(DebAptRemoteResponse, Integer, Hash)>] DebAptRemoteResponse data, response status code and response headers
541
541
  def partial_update_with_http_info(deb_apt_remote_href, patcheddeb_apt_remote, opts = {})
542
542
  if @api_client.config.debugging
543
543
  @api_client.config.logger.debug 'Calling API: RemotesAptApi.partial_update ...'
@@ -574,7 +574,7 @@ module PulpDebClient
574
574
  post_body = opts[:debug_body] || @api_client.object_to_http_body(patcheddeb_apt_remote)
575
575
 
576
576
  # return_type
577
- return_type = opts[:debug_return_type] || 'AsyncOperationResponse'
577
+ return_type = opts[:debug_return_type] || 'DebAptRemoteResponse'
578
578
 
579
579
  # auth_names
580
580
  auth_names = opts[:debug_auth_names] || ['basicAuth']
@@ -900,24 +900,24 @@ module PulpDebClient
900
900
  end
901
901
 
902
902
  # Update an apt remote
903
- # Trigger an asynchronous update task
903
+ # Update the entity and trigger an asynchronous task if necessary
904
904
  # @param deb_apt_remote_href [String]
905
905
  # @param deb_apt_remote [DebAptRemote]
906
906
  # @param [Hash] opts the optional parameters
907
907
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
908
- # @return [AsyncOperationResponse]
908
+ # @return [DebAptRemoteResponse]
909
909
  def update(deb_apt_remote_href, deb_apt_remote, opts = {})
910
910
  data, _status_code, _headers = update_with_http_info(deb_apt_remote_href, deb_apt_remote, opts)
911
911
  data
912
912
  end
913
913
 
914
914
  # Update an apt remote
915
- # Trigger an asynchronous update task
915
+ # Update the entity and trigger an asynchronous task if necessary
916
916
  # @param deb_apt_remote_href [String]
917
917
  # @param deb_apt_remote [DebAptRemote]
918
918
  # @param [Hash] opts the optional parameters
919
919
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
920
- # @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers
920
+ # @return [Array<(DebAptRemoteResponse, Integer, Hash)>] DebAptRemoteResponse data, response status code and response headers
921
921
  def update_with_http_info(deb_apt_remote_href, deb_apt_remote, opts = {})
922
922
  if @api_client.config.debugging
923
923
  @api_client.config.logger.debug 'Calling API: RemotesAptApi.update ...'
@@ -954,7 +954,7 @@ module PulpDebClient
954
954
  post_body = opts[:debug_body] || @api_client.object_to_http_body(deb_apt_remote)
955
955
 
956
956
  # return_type
957
- return_type = opts[:debug_return_type] || 'AsyncOperationResponse'
957
+ return_type = opts[:debug_return_type] || 'DebAptRemoteResponse'
958
958
 
959
959
  # auth_names
960
960
  auth_names = opts[:debug_auth_names] || ['basicAuth']
@@ -609,24 +609,24 @@ module PulpDebClient
609
609
  end
610
610
 
611
611
  # Update an apt repository
612
- # Trigger an asynchronous partial update task
612
+ # Update the entity partially and trigger an asynchronous task if necessary
613
613
  # @param deb_apt_repository_href [String]
614
614
  # @param patcheddeb_apt_repository [PatcheddebAptRepository]
615
615
  # @param [Hash] opts the optional parameters
616
616
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
617
- # @return [AsyncOperationResponse]
617
+ # @return [DebAptRepositoryResponse]
618
618
  def partial_update(deb_apt_repository_href, patcheddeb_apt_repository, opts = {})
619
619
  data, _status_code, _headers = partial_update_with_http_info(deb_apt_repository_href, patcheddeb_apt_repository, opts)
620
620
  data
621
621
  end
622
622
 
623
623
  # Update an apt repository
624
- # Trigger an asynchronous partial update task
624
+ # Update the entity partially and trigger an asynchronous task if necessary
625
625
  # @param deb_apt_repository_href [String]
626
626
  # @param patcheddeb_apt_repository [PatcheddebAptRepository]
627
627
  # @param [Hash] opts the optional parameters
628
628
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
629
- # @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers
629
+ # @return [Array<(DebAptRepositoryResponse, Integer, Hash)>] DebAptRepositoryResponse data, response status code and response headers
630
630
  def partial_update_with_http_info(deb_apt_repository_href, patcheddeb_apt_repository, opts = {})
631
631
  if @api_client.config.debugging
632
632
  @api_client.config.logger.debug 'Calling API: RepositoriesAptApi.partial_update ...'
@@ -663,7 +663,7 @@ module PulpDebClient
663
663
  post_body = opts[:debug_body] || @api_client.object_to_http_body(patcheddeb_apt_repository)
664
664
 
665
665
  # return_type
666
- return_type = opts[:debug_return_type] || 'AsyncOperationResponse'
666
+ return_type = opts[:debug_return_type] || 'DebAptRepositoryResponse'
667
667
 
668
668
  # auth_names
669
669
  auth_names = opts[:debug_auth_names] || ['basicAuth']
@@ -1066,24 +1066,24 @@ module PulpDebClient
1066
1066
  end
1067
1067
 
1068
1068
  # Update an apt repository
1069
- # Trigger an asynchronous update task
1069
+ # Update the entity and trigger an asynchronous task if necessary
1070
1070
  # @param deb_apt_repository_href [String]
1071
1071
  # @param deb_apt_repository [DebAptRepository]
1072
1072
  # @param [Hash] opts the optional parameters
1073
1073
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
1074
- # @return [AsyncOperationResponse]
1074
+ # @return [DebAptRepositoryResponse]
1075
1075
  def update(deb_apt_repository_href, deb_apt_repository, opts = {})
1076
1076
  data, _status_code, _headers = update_with_http_info(deb_apt_repository_href, deb_apt_repository, opts)
1077
1077
  data
1078
1078
  end
1079
1079
 
1080
1080
  # Update an apt repository
1081
- # Trigger an asynchronous update task
1081
+ # Update the entity and trigger an asynchronous task if necessary
1082
1082
  # @param deb_apt_repository_href [String]
1083
1083
  # @param deb_apt_repository [DebAptRepository]
1084
1084
  # @param [Hash] opts the optional parameters
1085
1085
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
1086
- # @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers
1086
+ # @return [Array<(DebAptRepositoryResponse, Integer, Hash)>] DebAptRepositoryResponse data, response status code and response headers
1087
1087
  def update_with_http_info(deb_apt_repository_href, deb_apt_repository, opts = {})
1088
1088
  if @api_client.config.debugging
1089
1089
  @api_client.config.logger.debug 'Calling API: RepositoriesAptApi.update ...'
@@ -1120,7 +1120,7 @@ module PulpDebClient
1120
1120
  post_body = opts[:debug_body] || @api_client.object_to_http_body(deb_apt_repository)
1121
1121
 
1122
1122
  # return_type
1123
- return_type = opts[:debug_return_type] || 'AsyncOperationResponse'
1123
+ return_type = opts[:debug_return_type] || 'DebAptRepositoryResponse'
1124
1124
 
1125
1125
  # auth_names
1126
1126
  auth_names = opts[:debug_auth_names] || ['basicAuth']
@@ -0,0 +1,282 @@
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 PulpDebClient
17
+ # Serializer for APT alternate content source.
18
+ class DebAptAlternateContentSource
19
+ # Name of Alternate Content Source.
20
+ attr_accessor :name
21
+
22
+ # Date of last refresh of AlternateContentSource.
23
+ attr_accessor :last_refreshed
24
+
25
+ # List of paths that will be appended to the Remote url when searching for content.
26
+ attr_accessor :paths
27
+
28
+ # The remote to provide alternate content source.
29
+ attr_accessor :remote
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'name' => :'name',
35
+ :'last_refreshed' => :'last_refreshed',
36
+ :'paths' => :'paths',
37
+ :'remote' => :'remote'
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
+ :'last_refreshed' => :'Time',
51
+ :'paths' => :'Array<String>',
52
+ :'remote' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ :'last_refreshed',
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 `PulpDebClient::DebAptAlternateContentSource` 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 `PulpDebClient::DebAptAlternateContentSource`. 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?(:'last_refreshed')
85
+ self.last_refreshed = attributes[:'last_refreshed']
86
+ end
87
+
88
+ if attributes.key?(:'paths')
89
+ if (value = attributes[:'paths']).is_a?(Array)
90
+ self.paths = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'remote')
95
+ self.remote = attributes[:'remote']
96
+ else
97
+ self.remote = 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 @remote.nil?
115
+ invalid_properties.push('invalid value for "remote", remote cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @name.nil?
126
+ return false if @name.to_s.length < 1
127
+ return false if @remote.nil?
128
+ true
129
+ end
130
+
131
+ # Custom attribute writer method with validation
132
+ # @param [Object] name Value to be assigned
133
+ def name=(name)
134
+ if name.nil?
135
+ fail ArgumentError, 'name cannot be nil'
136
+ end
137
+
138
+ if name.to_s.length < 1
139
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
140
+ end
141
+
142
+ @name = name
143
+ end
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] Object to be compared
147
+ def ==(o)
148
+ return true if self.equal?(o)
149
+ self.class == o.class &&
150
+ name == o.name &&
151
+ last_refreshed == o.last_refreshed &&
152
+ paths == o.paths &&
153
+ remote == o.remote
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Integer] Hash code
164
+ def hash
165
+ [name, last_refreshed, paths, remote].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def self.build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ attributes = attributes.transform_keys(&:to_sym)
174
+ transformed_hash = {}
175
+ openapi_types.each_pair do |key, type|
176
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
177
+ transformed_hash["#{key}"] = nil
178
+ elsif type =~ /\AArray<(.*)>/i
179
+ # check to ensure the input is an array given that the attribute
180
+ # is documented as an array but the input is not
181
+ if attributes[attribute_map[key]].is_a?(Array)
182
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
183
+ end
184
+ elsif !attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
186
+ end
187
+ end
188
+ new(transformed_hash)
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def self._deserialize(type, value)
196
+ case type.to_sym
197
+ when :Time
198
+ Time.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :Boolean
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ # models (e.g. Pet) or oneOf
229
+ klass = PulpDebClient.const_get(type)
230
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ if value.nil?
253
+ is_nullable = self.class.openapi_nullable.include?(attr)
254
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
+ end
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+
280
+ end
281
+
282
+ end