pulpcore_client 3.20.0 → 3.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -84
  3. data/docs/ContentApi.md +1 -115
  4. data/docs/ContentguardsApi.md +1 -280
  5. data/docs/DistributionsApi.md +3 -281
  6. data/docs/PublicationsApi.md +0 -113
  7. data/docs/PulpImport.md +3 -1
  8. data/docs/RemotesApi.md +0 -280
  9. data/docs/RepositoriesApi.md +3 -281
  10. data/docs/UploadsApi.md +228 -0
  11. data/lib/pulpcore_client/api/content_api.rb +2 -134
  12. data/lib/pulpcore_client/api/contentguards_api.rb +2 -334
  13. data/lib/pulpcore_client/api/distributions_api.rb +5 -336
  14. data/lib/pulpcore_client/api/publications_api.rb +0 -128
  15. data/lib/pulpcore_client/api/remotes_api.rb +0 -334
  16. data/lib/pulpcore_client/api/repositories_api.rb +5 -336
  17. data/lib/pulpcore_client/api/repository_versions_api.rb +1 -1
  18. data/lib/pulpcore_client/api/uploads_api.rb +268 -0
  19. data/lib/pulpcore_client/api_client.rb +1 -1
  20. data/lib/pulpcore_client/models/pulp_import.rb +16 -4
  21. data/lib/pulpcore_client/version.rb +1 -1
  22. data/lib/pulpcore_client.rb +0 -31
  23. data/pulpcore_client.gemspec +3 -3
  24. data/spec/api/content_api_spec.rb +1 -27
  25. data/spec/api/contentguards_api_spec.rb +1 -65
  26. data/spec/api/distributions_api_spec.rb +2 -65
  27. data/spec/api/publications_api_spec.rb +0 -26
  28. data/spec/api/remotes_api_spec.rb +0 -64
  29. data/spec/api/repositories_api_spec.rb +2 -65
  30. data/spec/api/uploads_api_spec.rb +50 -0
  31. data/spec/models/pulp_import_spec.rb +6 -0
  32. metadata +136 -261
  33. data/docs/AcsApi.md +0 -417
  34. data/docs/AlternateContentSource.md +0 -23
  35. data/docs/AlternateContentSourceResponse.md +0 -27
  36. data/docs/ContentGuard.md +0 -19
  37. data/docs/Distribution.md +0 -25
  38. data/docs/Export.md +0 -17
  39. data/docs/ExportResponse.md +0 -25
  40. data/docs/Exporter.md +0 -17
  41. data/docs/ExporterResponse.md +0 -21
  42. data/docs/ExportersApi.md +0 -362
  43. data/docs/ExportersExportsApi.md +0 -241
  44. data/docs/Import.md +0 -19
  45. data/docs/Importer.md +0 -17
  46. data/docs/ImporterResponse.md +0 -21
  47. data/docs/ImportersApi.md +0 -361
  48. data/docs/ImportersImportsApi.md +0 -241
  49. data/docs/MultipleArtifactContent.md +0 -17
  50. data/docs/PaginatedAlternateContentSourceResponseList.md +0 -23
  51. data/docs/PaginatedExportResponseList.md +0 -23
  52. data/docs/PaginatedExporterResponseList.md +0 -23
  53. data/docs/PaginatedImporterResponseList.md +0 -23
  54. data/docs/PatchedAlternateContentSource.md +0 -23
  55. data/docs/PatchedContentGuard.md +0 -19
  56. data/docs/PatchedDistribution.md +0 -25
  57. data/docs/PatchedExporter.md +0 -17
  58. data/docs/PatchedImporter.md +0 -17
  59. data/docs/PatchedRemote.md +0 -57
  60. data/docs/PatchedRepository.md +0 -25
  61. data/docs/Remote.md +0 -57
  62. data/docs/RepositoriesVersionsApi.md +0 -271
  63. data/docs/Repository.md +0 -25
  64. data/git_push.sh +0 -58
  65. data/lib/pulpcore_client/api/acs_api.rb +0 -514
  66. data/lib/pulpcore_client/api/exporters_api.rb +0 -446
  67. data/lib/pulpcore_client/api/exporters_exports_api.rb +0 -294
  68. data/lib/pulpcore_client/api/importers_api.rb +0 -444
  69. data/lib/pulpcore_client/api/importers_imports_api.rb +0 -294
  70. data/lib/pulpcore_client/api/repositories_versions_api.rb +0 -343
  71. data/lib/pulpcore_client/models/alternate_content_source.rb +0 -270
  72. data/lib/pulpcore_client/models/alternate_content_source_response.rb +0 -270
  73. data/lib/pulpcore_client/models/content_guard.rb +0 -258
  74. data/lib/pulpcore_client/models/distribution.rb +0 -297
  75. data/lib/pulpcore_client/models/export.rb +0 -209
  76. data/lib/pulpcore_client/models/export_response.rb +0 -250
  77. data/lib/pulpcore_client/models/exporter.rb +0 -232
  78. data/lib/pulpcore_client/models/exporter_response.rb +0 -232
  79. data/lib/pulpcore_client/models/import.rb +0 -228
  80. data/lib/pulpcore_client/models/importer.rb +0 -232
  81. data/lib/pulpcore_client/models/importer_response.rb +0 -232
  82. data/lib/pulpcore_client/models/multiple_artifact_content.rb +0 -213
  83. data/lib/pulpcore_client/models/paginated_alternate_content_source_response_list.rb +0 -237
  84. data/lib/pulpcore_client/models/paginated_export_response_list.rb +0 -237
  85. data/lib/pulpcore_client/models/paginated_exporter_response_list.rb +0 -237
  86. data/lib/pulpcore_client/models/paginated_importer_response_list.rb +0 -237
  87. data/lib/pulpcore_client/models/patched_alternate_content_source.rb +0 -256
  88. data/lib/pulpcore_client/models/patched_content_guard.rb +0 -249
  89. data/lib/pulpcore_client/models/patched_distribution.rb +0 -279
  90. data/lib/pulpcore_client/models/patched_exporter.rb +0 -223
  91. data/lib/pulpcore_client/models/patched_importer.rb +0 -223
  92. data/lib/pulpcore_client/models/patched_remote.rb +0 -649
  93. data/lib/pulpcore_client/models/patched_repository.rb +0 -295
  94. data/lib/pulpcore_client/models/remote.rb +0 -667
  95. data/lib/pulpcore_client/models/repository.rb +0 -304
  96. data/spec/api/acs_api_spec.rb +0 -132
  97. data/spec/api/exporters_api_spec.rb +0 -120
  98. data/spec/api/exporters_exports_api_spec.rb +0 -90
  99. data/spec/api/importers_api_spec.rb +0 -120
  100. data/spec/api/importers_imports_api_spec.rb +0 -90
  101. data/spec/api/repositories_versions_api_spec.rb +0 -104
  102. data/spec/models/alternate_content_source_response_spec.rb +0 -71
  103. data/spec/models/alternate_content_source_spec.rb +0 -59
  104. data/spec/models/content_guard_spec.rb +0 -47
  105. data/spec/models/distribution_spec.rb +0 -65
  106. data/spec/models/export_response_spec.rb +0 -65
  107. data/spec/models/export_spec.rb +0 -41
  108. data/spec/models/exporter_response_spec.rb +0 -53
  109. data/spec/models/exporter_spec.rb +0 -41
  110. data/spec/models/import_spec.rb +0 -47
  111. data/spec/models/importer_response_spec.rb +0 -53
  112. data/spec/models/importer_spec.rb +0 -41
  113. data/spec/models/multiple_artifact_content_spec.rb +0 -41
  114. data/spec/models/paginated_alternate_content_source_response_list_spec.rb +0 -59
  115. data/spec/models/paginated_export_response_list_spec.rb +0 -59
  116. data/spec/models/paginated_exporter_response_list_spec.rb +0 -59
  117. data/spec/models/paginated_importer_response_list_spec.rb +0 -59
  118. data/spec/models/patched_alternate_content_source_spec.rb +0 -59
  119. data/spec/models/patched_content_guard_spec.rb +0 -47
  120. data/spec/models/patched_distribution_spec.rb +0 -65
  121. data/spec/models/patched_exporter_spec.rb +0 -41
  122. data/spec/models/patched_importer_spec.rb +0 -41
  123. data/spec/models/patched_remote_spec.rb +0 -161
  124. data/spec/models/patched_repository_spec.rb +0 -65
  125. data/spec/models/remote_spec.rb +0 -161
  126. data/spec/models/repository_spec.rb +0 -65
@@ -1,232 +0,0 @@
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 PulpcoreClient
16
- # Base serializer for Exporters.
17
- class ExporterResponse
18
- attr_accessor :pulp_href
19
-
20
- # Timestamp of creation.
21
- attr_accessor :pulp_created
22
-
23
- # Unique name of the file system exporter.
24
- attr_accessor :name
25
-
26
- # Attribute mapping from ruby-style variable name to JSON key.
27
- def self.attribute_map
28
- {
29
- :'pulp_href' => :'pulp_href',
30
- :'pulp_created' => :'pulp_created',
31
- :'name' => :'name'
32
- }
33
- end
34
-
35
- # Attribute type mapping.
36
- def self.openapi_types
37
- {
38
- :'pulp_href' => :'String',
39
- :'pulp_created' => :'DateTime',
40
- :'name' => :'String'
41
- }
42
- end
43
-
44
- # List of attributes with nullable: true
45
- def self.openapi_nullable
46
- Set.new([
47
- ])
48
- end
49
-
50
- # Initializes the object
51
- # @param [Hash] attributes Model attributes in the form of hash
52
- def initialize(attributes = {})
53
- if (!attributes.is_a?(Hash))
54
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::ExporterResponse` initialize method"
55
- end
56
-
57
- # check to see if the attribute exists and convert string to symbol for hash key
58
- attributes = attributes.each_with_object({}) { |(k, v), h|
59
- if (!self.class.attribute_map.key?(k.to_sym))
60
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::ExporterResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
- end
62
- h[k.to_sym] = v
63
- }
64
-
65
- if attributes.key?(:'pulp_href')
66
- self.pulp_href = attributes[:'pulp_href']
67
- end
68
-
69
- if attributes.key?(:'pulp_created')
70
- self.pulp_created = attributes[:'pulp_created']
71
- end
72
-
73
- if attributes.key?(:'name')
74
- self.name = attributes[:'name']
75
- end
76
- end
77
-
78
- # Show invalid properties with the reasons. Usually used together with valid?
79
- # @return Array for valid properties with the reasons
80
- def list_invalid_properties
81
- invalid_properties = Array.new
82
- if @name.nil?
83
- invalid_properties.push('invalid value for "name", name cannot be nil.')
84
- end
85
-
86
- invalid_properties
87
- end
88
-
89
- # Check to see if the all the properties in the model are valid
90
- # @return true if the model is valid
91
- def valid?
92
- return false if @name.nil?
93
- true
94
- end
95
-
96
- # Checks equality by comparing each attribute.
97
- # @param [Object] Object to be compared
98
- def ==(o)
99
- return true if self.equal?(o)
100
- self.class == o.class &&
101
- pulp_href == o.pulp_href &&
102
- pulp_created == o.pulp_created &&
103
- name == o.name
104
- end
105
-
106
- # @see the `==` method
107
- # @param [Object] Object to be compared
108
- def eql?(o)
109
- self == o
110
- end
111
-
112
- # Calculates hash code according to all attributes.
113
- # @return [Integer] Hash code
114
- def hash
115
- [pulp_href, pulp_created, name].hash
116
- end
117
-
118
- # Builds the object from hash
119
- # @param [Hash] attributes Model attributes in the form of hash
120
- # @return [Object] Returns the model itself
121
- def self.build_from_hash(attributes)
122
- new.build_from_hash(attributes)
123
- end
124
-
125
- # Builds the object from hash
126
- # @param [Hash] attributes Model attributes in the form of hash
127
- # @return [Object] Returns the model itself
128
- def build_from_hash(attributes)
129
- return nil unless attributes.is_a?(Hash)
130
- self.class.openapi_types.each_pair do |key, type|
131
- if type =~ /\AArray<(.*)>/i
132
- # check to ensure the input is an array given that the attribute
133
- # is documented as an array but the input is not
134
- if attributes[self.class.attribute_map[key]].is_a?(Array)
135
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
- end
137
- elsif !attributes[self.class.attribute_map[key]].nil?
138
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
- end # or else data not found in attributes(hash), not an issue as the data can be optional
140
- end
141
-
142
- self
143
- end
144
-
145
- # Deserializes the data based on type
146
- # @param string type Data type
147
- # @param string value Value to be deserialized
148
- # @return [Object] Deserialized data
149
- def _deserialize(type, value)
150
- case type.to_sym
151
- when :DateTime
152
- DateTime.parse(value)
153
- when :Date
154
- Date.parse(value)
155
- when :String
156
- value.to_s
157
- when :Integer
158
- value.to_i
159
- when :Float
160
- value.to_f
161
- when :Boolean
162
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
- true
164
- else
165
- false
166
- end
167
- when :Object
168
- # generic object (usually a Hash), return directly
169
- value
170
- when /\AArray<(?<inner_type>.+)>\z/
171
- inner_type = Regexp.last_match[:inner_type]
172
- value.map { |v| _deserialize(inner_type, v) }
173
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
- k_type = Regexp.last_match[:k_type]
175
- v_type = Regexp.last_match[:v_type]
176
- {}.tap do |hash|
177
- value.each do |k, v|
178
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
- end
180
- end
181
- else # model
182
- PulpcoreClient.const_get(type).build_from_hash(value)
183
- end
184
- end
185
-
186
- # Returns the string representation of the object
187
- # @return [String] String presentation of the object
188
- def to_s
189
- to_hash.to_s
190
- end
191
-
192
- # to_body is an alias to to_hash (backward compatibility)
193
- # @return [Hash] Returns the object in the form of hash
194
- def to_body
195
- to_hash
196
- end
197
-
198
- # Returns the object in the form of hash
199
- # @return [Hash] Returns the object in the form of hash
200
- def to_hash
201
- hash = {}
202
- self.class.attribute_map.each_pair do |attr, param|
203
- value = self.send(attr)
204
- if value.nil?
205
- is_nullable = self.class.openapi_nullable.include?(attr)
206
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
- end
208
-
209
- hash[param] = _to_hash(value)
210
- end
211
- hash
212
- end
213
-
214
- # Outputs non-array value in the form of hash
215
- # For object, use to_hash. Otherwise, just return the value
216
- # @param [Object] value Any valid value
217
- # @return [Hash] Returns the value in the form of hash
218
- def _to_hash(value)
219
- if value.is_a?(Array)
220
- value.compact.map { |v| _to_hash(v) }
221
- elsif value.is_a?(Hash)
222
- {}.tap do |hash|
223
- value.each { |k, v| hash[k] = _to_hash(v) }
224
- end
225
- elsif value.respond_to? :to_hash
226
- value.to_hash
227
- else
228
- value
229
- end
230
- end
231
- end
232
- end
@@ -1,228 +0,0 @@
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 PulpcoreClient
16
- # Serializer for Imports.
17
- class Import
18
- # A URI of the Task that ran the Import.
19
- attr_accessor :task
20
-
21
- # Any parameters that were used to create the import.
22
- attr_accessor :params
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- :'task' => :'task',
28
- :'params' => :'params'
29
- }
30
- end
31
-
32
- # Attribute type mapping.
33
- def self.openapi_types
34
- {
35
- :'task' => :'String',
36
- :'params' => :'Object'
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 `PulpcoreClient::Import` 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 `PulpcoreClient::Import`. 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?(:'task')
62
- self.task = attributes[:'task']
63
- end
64
-
65
- if attributes.key?(:'params')
66
- self.params = attributes[:'params']
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 @task.nil?
75
- invalid_properties.push('invalid value for "task", task cannot be nil.')
76
- end
77
-
78
- if @params.nil?
79
- invalid_properties.push('invalid value for "params", params cannot be nil.')
80
- end
81
-
82
- invalid_properties
83
- end
84
-
85
- # Check to see if the all the properties in the model are valid
86
- # @return true if the model is valid
87
- def valid?
88
- return false if @task.nil?
89
- return false if @params.nil?
90
- true
91
- end
92
-
93
- # Checks equality by comparing each attribute.
94
- # @param [Object] Object to be compared
95
- def ==(o)
96
- return true if self.equal?(o)
97
- self.class == o.class &&
98
- task == o.task &&
99
- params == o.params
100
- end
101
-
102
- # @see the `==` method
103
- # @param [Object] Object to be compared
104
- def eql?(o)
105
- self == o
106
- end
107
-
108
- # Calculates hash code according to all attributes.
109
- # @return [Integer] Hash code
110
- def hash
111
- [task, params].hash
112
- end
113
-
114
- # Builds the object from hash
115
- # @param [Hash] attributes Model attributes in the form of hash
116
- # @return [Object] Returns the model itself
117
- def self.build_from_hash(attributes)
118
- new.build_from_hash(attributes)
119
- end
120
-
121
- # Builds the object from hash
122
- # @param [Hash] attributes Model attributes in the form of hash
123
- # @return [Object] Returns the model itself
124
- def build_from_hash(attributes)
125
- return nil unless attributes.is_a?(Hash)
126
- self.class.openapi_types.each_pair do |key, type|
127
- if type =~ /\AArray<(.*)>/i
128
- # check to ensure the input is an array given that the attribute
129
- # is documented as an array but the input is not
130
- if attributes[self.class.attribute_map[key]].is_a?(Array)
131
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
- end
133
- elsif !attributes[self.class.attribute_map[key]].nil?
134
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
- end # or else data not found in attributes(hash), not an issue as the data can be optional
136
- end
137
-
138
- self
139
- end
140
-
141
- # Deserializes the data based on type
142
- # @param string type Data type
143
- # @param string value Value to be deserialized
144
- # @return [Object] Deserialized data
145
- def _deserialize(type, value)
146
- case type.to_sym
147
- when :DateTime
148
- DateTime.parse(value)
149
- when :Date
150
- Date.parse(value)
151
- when :String
152
- value.to_s
153
- when :Integer
154
- value.to_i
155
- when :Float
156
- value.to_f
157
- when :Boolean
158
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
- true
160
- else
161
- false
162
- end
163
- when :Object
164
- # generic object (usually a Hash), return directly
165
- value
166
- when /\AArray<(?<inner_type>.+)>\z/
167
- inner_type = Regexp.last_match[:inner_type]
168
- value.map { |v| _deserialize(inner_type, v) }
169
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
- k_type = Regexp.last_match[:k_type]
171
- v_type = Regexp.last_match[:v_type]
172
- {}.tap do |hash|
173
- value.each do |k, v|
174
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
- end
176
- end
177
- else # model
178
- PulpcoreClient.const_get(type).build_from_hash(value)
179
- end
180
- end
181
-
182
- # Returns the string representation of the object
183
- # @return [String] String presentation of the object
184
- def to_s
185
- to_hash.to_s
186
- end
187
-
188
- # to_body is an alias to to_hash (backward compatibility)
189
- # @return [Hash] Returns the object in the form of hash
190
- def to_body
191
- to_hash
192
- end
193
-
194
- # Returns the object in the form of hash
195
- # @return [Hash] Returns the object in the form of hash
196
- def to_hash
197
- hash = {}
198
- self.class.attribute_map.each_pair do |attr, param|
199
- value = self.send(attr)
200
- if value.nil?
201
- is_nullable = self.class.openapi_nullable.include?(attr)
202
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
- end
204
-
205
- hash[param] = _to_hash(value)
206
- end
207
- hash
208
- end
209
-
210
- # Outputs non-array value in the form of hash
211
- # For object, use to_hash. Otherwise, just return the value
212
- # @param [Object] value Any valid value
213
- # @return [Hash] Returns the value in the form of hash
214
- def _to_hash(value)
215
- if value.is_a?(Array)
216
- value.compact.map { |v| _to_hash(v) }
217
- elsif value.is_a?(Hash)
218
- {}.tap do |hash|
219
- value.each { |k, v| hash[k] = _to_hash(v) }
220
- end
221
- elsif value.respond_to? :to_hash
222
- value.to_hash
223
- else
224
- value
225
- end
226
- end
227
- end
228
- end
@@ -1,232 +0,0 @@
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 PulpcoreClient
16
- # Base serializer for Importers.
17
- class Importer
18
- # Unique name of the Importer.
19
- attr_accessor :name
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'name' => :'name'
25
- }
26
- end
27
-
28
- # Attribute type mapping.
29
- def self.openapi_types
30
- {
31
- :'name' => :'String'
32
- }
33
- end
34
-
35
- # List of attributes with nullable: true
36
- def self.openapi_nullable
37
- Set.new([
38
- ])
39
- end
40
-
41
- # Initializes the object
42
- # @param [Hash] attributes Model attributes in the form of hash
43
- def initialize(attributes = {})
44
- if (!attributes.is_a?(Hash))
45
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpcoreClient::Importer` initialize method"
46
- end
47
-
48
- # check to see if the attribute exists and convert string to symbol for hash key
49
- attributes = attributes.each_with_object({}) { |(k, v), h|
50
- if (!self.class.attribute_map.key?(k.to_sym))
51
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpcoreClient::Importer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
- end
53
- h[k.to_sym] = v
54
- }
55
-
56
- if attributes.key?(:'name')
57
- self.name = attributes[:'name']
58
- end
59
- end
60
-
61
- # Show invalid properties with the reasons. Usually used together with valid?
62
- # @return Array for valid properties with the reasons
63
- def list_invalid_properties
64
- invalid_properties = Array.new
65
- if @name.nil?
66
- invalid_properties.push('invalid value for "name", name cannot be nil.')
67
- end
68
-
69
- if @name.to_s.length < 1
70
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
71
- end
72
-
73
- invalid_properties
74
- end
75
-
76
- # Check to see if the all the properties in the model are valid
77
- # @return true if the model is valid
78
- def valid?
79
- return false if @name.nil?
80
- return false if @name.to_s.length < 1
81
- true
82
- end
83
-
84
- # Custom attribute writer method with validation
85
- # @param [Object] name Value to be assigned
86
- def name=(name)
87
- if name.nil?
88
- fail ArgumentError, 'name cannot be nil'
89
- end
90
-
91
- if name.to_s.length < 1
92
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
93
- end
94
-
95
- @name = name
96
- end
97
-
98
- # Checks equality by comparing each attribute.
99
- # @param [Object] Object to be compared
100
- def ==(o)
101
- return true if self.equal?(o)
102
- self.class == o.class &&
103
- name == o.name
104
- end
105
-
106
- # @see the `==` method
107
- # @param [Object] Object to be compared
108
- def eql?(o)
109
- self == o
110
- end
111
-
112
- # Calculates hash code according to all attributes.
113
- # @return [Integer] Hash code
114
- def hash
115
- [name].hash
116
- end
117
-
118
- # Builds the object from hash
119
- # @param [Hash] attributes Model attributes in the form of hash
120
- # @return [Object] Returns the model itself
121
- def self.build_from_hash(attributes)
122
- new.build_from_hash(attributes)
123
- end
124
-
125
- # Builds the object from hash
126
- # @param [Hash] attributes Model attributes in the form of hash
127
- # @return [Object] Returns the model itself
128
- def build_from_hash(attributes)
129
- return nil unless attributes.is_a?(Hash)
130
- self.class.openapi_types.each_pair do |key, type|
131
- if type =~ /\AArray<(.*)>/i
132
- # check to ensure the input is an array given that the attribute
133
- # is documented as an array but the input is not
134
- if attributes[self.class.attribute_map[key]].is_a?(Array)
135
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
- end
137
- elsif !attributes[self.class.attribute_map[key]].nil?
138
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
- end # or else data not found in attributes(hash), not an issue as the data can be optional
140
- end
141
-
142
- self
143
- end
144
-
145
- # Deserializes the data based on type
146
- # @param string type Data type
147
- # @param string value Value to be deserialized
148
- # @return [Object] Deserialized data
149
- def _deserialize(type, value)
150
- case type.to_sym
151
- when :DateTime
152
- DateTime.parse(value)
153
- when :Date
154
- Date.parse(value)
155
- when :String
156
- value.to_s
157
- when :Integer
158
- value.to_i
159
- when :Float
160
- value.to_f
161
- when :Boolean
162
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
- true
164
- else
165
- false
166
- end
167
- when :Object
168
- # generic object (usually a Hash), return directly
169
- value
170
- when /\AArray<(?<inner_type>.+)>\z/
171
- inner_type = Regexp.last_match[:inner_type]
172
- value.map { |v| _deserialize(inner_type, v) }
173
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
- k_type = Regexp.last_match[:k_type]
175
- v_type = Regexp.last_match[:v_type]
176
- {}.tap do |hash|
177
- value.each do |k, v|
178
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
- end
180
- end
181
- else # model
182
- PulpcoreClient.const_get(type).build_from_hash(value)
183
- end
184
- end
185
-
186
- # Returns the string representation of the object
187
- # @return [String] String presentation of the object
188
- def to_s
189
- to_hash.to_s
190
- end
191
-
192
- # to_body is an alias to to_hash (backward compatibility)
193
- # @return [Hash] Returns the object in the form of hash
194
- def to_body
195
- to_hash
196
- end
197
-
198
- # Returns the object in the form of hash
199
- # @return [Hash] Returns the object in the form of hash
200
- def to_hash
201
- hash = {}
202
- self.class.attribute_map.each_pair do |attr, param|
203
- value = self.send(attr)
204
- if value.nil?
205
- is_nullable = self.class.openapi_nullable.include?(attr)
206
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
- end
208
-
209
- hash[param] = _to_hash(value)
210
- end
211
- hash
212
- end
213
-
214
- # Outputs non-array value in the form of hash
215
- # For object, use to_hash. Otherwise, just return the value
216
- # @param [Object] value Any valid value
217
- # @return [Hash] Returns the value in the form of hash
218
- def _to_hash(value)
219
- if value.is_a?(Array)
220
- value.compact.map { |v| _to_hash(v) }
221
- elsif value.is_a?(Hash)
222
- {}.tap do |hash|
223
- value.each { |k, v| hash[k] = _to_hash(v) }
224
- end
225
- elsif value.respond_to? :to_hash
226
- value.to_hash
227
- else
228
- value
229
- end
230
- end
231
- end
232
- end