pulp_ansible_client 0.16.7 → 0.17.0.dev1676344220

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.

Potentially problematic release.


This version of pulp_ansible_client might be problematic. Click here for more details.

Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -5
  3. data/docs/AnsibleAnsibleRepositoryResponse.md +3 -1
  4. data/docs/AnsibleCollectionRemoteResponse.md +3 -1
  5. data/docs/AnsibleCollectionRemoteResponseHiddenFields.md +2 -2
  6. data/docs/AnsibleCollectionVersionResponse.md +3 -3
  7. data/docs/AnsibleCollectionsApi.md +1 -1
  8. data/docs/AnsibleCopyApi.md +1 -1
  9. data/docs/AnsibleGitRemote.md +28 -28
  10. data/docs/AnsibleGitRemoteResponse.md +28 -28
  11. data/docs/AnsibleRoleResponse.md +3 -3
  12. data/docs/ApiCollectionsApi.md +1 -1
  13. data/docs/ApiRolesApi.md +1 -1
  14. data/docs/CollectionImportApi.md +1 -1
  15. data/docs/ContentCollectionDeprecationsApi.md +1 -1
  16. data/docs/ContentCollectionSignaturesApi.md +1 -1
  17. data/docs/ContentCollectionVersionsApi.md +1 -1
  18. data/docs/ContentRolesApi.md +1 -1
  19. data/docs/DistributionsAnsibleApi.md +5 -1
  20. data/docs/GalaxyDetailApi.md +1 -1
  21. data/docs/PatchedansibleGitRemote.md +28 -28
  22. data/docs/ProgressReportResponse.md +27 -0
  23. data/docs/PulpAnsibleApiApi.md +1 -1
  24. data/docs/PulpAnsibleApiV2CollectionsVersionsApi.md +1 -1
  25. data/docs/PulpAnsibleApiV3Api.md +1 -1
  26. data/docs/PulpAnsibleApiV3ArtifactsCollectionsApi.md +1 -1
  27. data/docs/PulpAnsibleApiV3CollectionVersionsAllApi.md +1 -1
  28. data/docs/PulpAnsibleApiV3CollectionsAllApi.md +1 -1
  29. data/docs/PulpAnsibleApiV3CollectionsApi.md +1 -1
  30. data/docs/PulpAnsibleApiV3CollectionsVersionsApi.md +1 -1
  31. data/docs/PulpAnsibleApiV3CollectionsVersionsDocsBlobApi.md +1 -1
  32. data/docs/PulpAnsibleApiV3PluginAnsibleClientConfigurationApi.md +1 -1
  33. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsAllCollectionsApi.md +1 -1
  34. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsAllVersionsApi.md +1 -1
  35. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsApi.md +1 -1
  36. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsArtifactsApi.md +1 -1
  37. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsIndexApi.md +1 -1
  38. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsIndexVersionsApi.md +1 -1
  39. data/docs/PulpAnsibleApiV3PluginAnsibleContentCollectionsIndexVersionsDocsBlobApi.md +1 -1
  40. data/docs/PulpAnsibleArtifactsCollectionsV3Api.md +1 -1
  41. data/docs/PulpAnsibleDefaultApiApi.md +1 -1
  42. data/docs/PulpAnsibleDefaultApiV3Api.md +1 -1
  43. data/docs/PulpAnsibleDefaultApiV3ArtifactsCollectionsApi.md +1 -1
  44. data/docs/PulpAnsibleDefaultApiV3CollectionVersionsAllApi.md +1 -1
  45. data/docs/PulpAnsibleDefaultApiV3CollectionsAllApi.md +1 -1
  46. data/docs/PulpAnsibleDefaultApiV3CollectionsApi.md +1 -1
  47. data/docs/PulpAnsibleDefaultApiV3CollectionsVersionsApi.md +1 -1
  48. data/docs/PulpAnsibleDefaultApiV3CollectionsVersionsDocsBlobApi.md +1 -1
  49. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleClientConfigurationApi.md +1 -1
  50. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsAllCollectionsApi.md +1 -1
  51. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsAllVersionsApi.md +1 -1
  52. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsApi.md +1 -1
  53. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsArtifactsApi.md +1 -1
  54. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsIndexApi.md +1 -1
  55. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsIndexVersionsApi.md +1 -1
  56. data/docs/PulpAnsibleDefaultApiV3PluginAnsibleContentCollectionsIndexVersionsDocsBlobApi.md +1 -1
  57. data/docs/PulpAnsibleTagsApi.md +1 -1
  58. data/docs/RemotesCollectionApi.md +9 -1
  59. data/docs/RemotesGitApi.md +1 -1
  60. data/docs/RemotesRoleApi.md +1 -1
  61. data/docs/RepositoriesAnsibleApi.md +17 -1
  62. data/docs/RepositoriesAnsibleVersionsApi.md +1 -1
  63. data/docs/Task.md +19 -0
  64. data/docs/TaskResponse.md +45 -0
  65. data/docs/VersionsApi.md +1 -1
  66. data/lib/pulp_ansible_client/api/distributions_ansible_api.rb +6 -0
  67. data/lib/pulp_ansible_client/api/remotes_collection_api.rb +13 -1
  68. data/lib/pulp_ansible_client/api/repositories_ansible_api.rb +24 -0
  69. data/lib/pulp_ansible_client/configuration.rb +3 -3
  70. data/lib/pulp_ansible_client/models/ansible_ansible_repository_response.rb +14 -5
  71. data/lib/pulp_ansible_client/models/ansible_collection_remote_response.rb +13 -4
  72. data/lib/pulp_ansible_client/models/ansible_collection_remote_response_hidden_fields.rb +0 -10
  73. data/lib/pulp_ansible_client/models/ansible_collection_version_response.rb +11 -11
  74. data/lib/pulp_ansible_client/models/ansible_git_remote.rb +232 -232
  75. data/lib/pulp_ansible_client/models/ansible_git_remote_response.rb +155 -155
  76. data/lib/pulp_ansible_client/models/ansible_role_response.rb +10 -10
  77. data/lib/pulp_ansible_client/models/patchedansible_git_remote.rb +223 -223
  78. data/lib/pulp_ansible_client/models/progress_report_response.rb +259 -0
  79. data/lib/pulp_ansible_client/models/task.rb +266 -0
  80. data/lib/pulp_ansible_client/models/task_response.rb +366 -0
  81. data/lib/pulp_ansible_client/version.rb +1 -1
  82. data/lib/pulp_ansible_client.rb +3 -0
  83. data/spec/api/distributions_ansible_api_spec.rb +2 -0
  84. data/spec/api/remotes_collection_api_spec.rb +4 -0
  85. data/spec/api/repositories_ansible_api_spec.rb +8 -0
  86. data/spec/configuration_spec.rb +3 -3
  87. data/spec/models/ansible_ansible_repository_response_spec.rb +6 -0
  88. data/spec/models/ansible_collection_remote_response_spec.rb +6 -0
  89. data/spec/models/ansible_collection_version_response_spec.rb +3 -3
  90. data/spec/models/ansible_git_remote_response_spec.rb +19 -19
  91. data/spec/models/ansible_git_remote_spec.rb +19 -19
  92. data/spec/models/ansible_role_response_spec.rb +2 -2
  93. data/spec/models/patchedansible_git_remote_spec.rb +19 -19
  94. data/spec/models/progress_report_response_spec.rb +71 -0
  95. data/spec/models/task_response_spec.rb +125 -0
  96. data/spec/models/task_spec.rb +47 -0
  97. metadata +130 -118
@@ -0,0 +1,259 @@
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.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpAnsibleClient
16
+ # Base serializer for use with :class:`pulpcore.app.models.Model` This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
17
+ class ProgressReportResponse
18
+ # The message shown to the user for the progress report.
19
+ attr_accessor :message
20
+
21
+ # Identifies the type of progress report'.
22
+ attr_accessor :code
23
+
24
+ # The current state of the progress report. The possible values are: 'waiting', 'skipped', 'running', 'completed', 'failed', 'canceled' and 'canceling'. The default is 'waiting'.
25
+ attr_accessor :state
26
+
27
+ # The total count of items.
28
+ attr_accessor :total
29
+
30
+ # The count of items already processed. Defaults to 0.
31
+ attr_accessor :done
32
+
33
+ # The suffix to be shown with the progress report.
34
+ attr_accessor :suffix
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'message' => :'message',
40
+ :'code' => :'code',
41
+ :'state' => :'state',
42
+ :'total' => :'total',
43
+ :'done' => :'done',
44
+ :'suffix' => :'suffix'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'message' => :'String',
52
+ :'code' => :'String',
53
+ :'state' => :'String',
54
+ :'total' => :'Integer',
55
+ :'done' => :'Integer',
56
+ :'suffix' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :'suffix'
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::ProgressReportResponse` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::ProgressReportResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'message')
83
+ self.message = attributes[:'message']
84
+ end
85
+
86
+ if attributes.key?(:'code')
87
+ self.code = attributes[:'code']
88
+ end
89
+
90
+ if attributes.key?(:'state')
91
+ self.state = attributes[:'state']
92
+ end
93
+
94
+ if attributes.key?(:'total')
95
+ self.total = attributes[:'total']
96
+ end
97
+
98
+ if attributes.key?(:'done')
99
+ self.done = attributes[:'done']
100
+ end
101
+
102
+ if attributes.key?(:'suffix')
103
+ self.suffix = attributes[:'suffix']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
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
+ message == o.message &&
126
+ code == o.code &&
127
+ state == o.state &&
128
+ total == o.total &&
129
+ done == o.done &&
130
+ suffix == o.suffix
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [message, code, state, total, done, suffix].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+ end
259
+ end
@@ -0,0 +1,266 @@
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.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpAnsibleClient
16
+ # Base serializer for use with :class:`pulpcore.app.models.Model` This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
17
+ class Task
18
+ # The name of task.
19
+ attr_accessor :name
20
+
21
+ # The logging correlation id associated with this task
22
+ attr_accessor :logging_cid
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'name' => :'name',
28
+ :'logging_cid' => :'logging_cid'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'name' => :'String',
36
+ :'logging_cid' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::Task` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::Task`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'name')
62
+ self.name = attributes[:'name']
63
+ end
64
+
65
+ if attributes.key?(:'logging_cid')
66
+ self.logging_cid = attributes[:'logging_cid']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @name.nil?
75
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
76
+ end
77
+
78
+ if @name.to_s.length < 1
79
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
80
+ end
81
+
82
+ if @logging_cid.nil?
83
+ invalid_properties.push('invalid value for "logging_cid", logging_cid cannot be nil.')
84
+ end
85
+
86
+ if @logging_cid.to_s.length < 1
87
+ invalid_properties.push('invalid value for "logging_cid", the character length must be great than or equal to 1.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ return false if @name.nil?
97
+ return false if @name.to_s.length < 1
98
+ return false if @logging_cid.nil?
99
+ return false if @logging_cid.to_s.length < 1
100
+ true
101
+ end
102
+
103
+ # Custom attribute writer method with validation
104
+ # @param [Object] name Value to be assigned
105
+ def name=(name)
106
+ if name.nil?
107
+ fail ArgumentError, 'name cannot be nil'
108
+ end
109
+
110
+ if name.to_s.length < 1
111
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
112
+ end
113
+
114
+ @name = name
115
+ end
116
+
117
+ # Custom attribute writer method with validation
118
+ # @param [Object] logging_cid Value to be assigned
119
+ def logging_cid=(logging_cid)
120
+ if logging_cid.nil?
121
+ fail ArgumentError, 'logging_cid cannot be nil'
122
+ end
123
+
124
+ if logging_cid.to_s.length < 1
125
+ fail ArgumentError, 'invalid value for "logging_cid", the character length must be great than or equal to 1.'
126
+ end
127
+
128
+ @logging_cid = logging_cid
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ name == o.name &&
137
+ logging_cid == o.logging_cid
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [name, logging_cid].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ new.build_from_hash(attributes)
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.openapi_types.each_pair do |key, type|
165
+ if type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ PulpAnsibleClient.const_get(type).build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+ end
266
+ end