pulpcore_client 3.105.27 → 3.106.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -4
  3. data/docs/ArtifactDistributionResponse.md +19 -15
  4. data/docs/DataRepair7272.md +18 -0
  5. data/docs/DataRepair7465.md +18 -0
  6. data/docs/Datarepair7272Api.md +82 -0
  7. data/docs/Datarepair7465Api.md +82 -0
  8. data/docs/DistributionResponse.md +5 -1
  9. data/docs/DistributionsOpenpgpApi.md +2 -2
  10. data/docs/OpenPGPDistributionResponse.md +2 -0
  11. data/docs/OpenPGPKeyring.md +2 -0
  12. data/docs/OpenPGPKeyringResponse.md +2 -0
  13. data/docs/PatchedOpenPGPKeyring.md +2 -0
  14. data/docs/Purge.md +1 -1
  15. data/docs/RepositoriesApi.md +18 -2
  16. data/docs/RepositoriesOpenpgpKeyringApi.md +18 -2
  17. data/docs/RepositoryResponse.md +2 -0
  18. data/lib/pulpcore_client/api/datarepair7272_api.rb +93 -0
  19. data/lib/pulpcore_client/api/datarepair7465_api.rb +93 -0
  20. data/lib/pulpcore_client/api/distributions_openpgp_api.rb +4 -4
  21. data/lib/pulpcore_client/api/repositories_api.rb +27 -3
  22. data/lib/pulpcore_client/api/repositories_openpgp_keyring_api.rb +27 -3
  23. data/lib/pulpcore_client/models/artifact_distribution_response.rb +87 -66
  24. data/lib/pulpcore_client/models/data_repair7272.rb +217 -0
  25. data/lib/pulpcore_client/models/data_repair7465.rb +217 -0
  26. data/lib/pulpcore_client/models/distribution_response.rb +27 -6
  27. data/lib/pulpcore_client/models/open_pgp_distribution.rb +1 -1
  28. data/lib/pulpcore_client/models/open_pgp_distribution_response.rb +12 -2
  29. data/lib/pulpcore_client/models/open_pgp_keyring.rb +27 -1
  30. data/lib/pulpcore_client/models/open_pgp_keyring_response.rb +27 -1
  31. data/lib/pulpcore_client/models/patched_open_pgp_distribution.rb +1 -1
  32. data/lib/pulpcore_client/models/patched_open_pgp_keyring.rb +27 -1
  33. data/lib/pulpcore_client/models/purge.rb +1 -1
  34. data/lib/pulpcore_client/models/repository_response.rb +27 -1
  35. data/lib/pulpcore_client/version.rb +1 -1
  36. data/lib/pulpcore_client.rb +4 -0
  37. data/spec/api/datarepair7272_api_spec.rb +48 -0
  38. data/spec/api/datarepair7465_api_spec.rb +48 -0
  39. data/spec/api/distributions_openpgp_api_spec.rb +2 -2
  40. data/spec/api/repositories_api_spec.rb +9 -1
  41. data/spec/api/repositories_openpgp_keyring_api_spec.rb +9 -1
  42. data/spec/models/artifact_distribution_response_spec.rb +21 -9
  43. data/spec/models/data_repair7272_spec.rb +36 -0
  44. data/spec/models/data_repair7465_spec.rb +36 -0
  45. data/spec/models/distribution_response_spec.rb +12 -0
  46. data/spec/models/open_pgp_distribution_response_spec.rb +6 -0
  47. data/spec/models/open_pgp_keyring_response_spec.rb +6 -0
  48. data/spec/models/open_pgp_keyring_spec.rb +6 -0
  49. data/spec/models/patched_open_pgp_keyring_spec.rb +6 -0
  50. data/spec/models/repository_response_spec.rb +6 -0
  51. metadata +215 -196
@@ -16,51 +16,59 @@ require 'time'
16
16
  module PulpcoreClient
17
17
  # A serializer for ArtifactDistribution.
18
18
  class ArtifactDistributionResponse
19
- # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
20
- attr_accessor :base_path
19
+ # Whether this distribution should be shown in the content app.
20
+ attr_accessor :hidden
21
+
22
+ # The URL for accessing the publication as defined by this distribution.
23
+ attr_accessor :base_url
24
+
25
+ attr_accessor :pulp_labels
21
26
 
22
27
  # Timestamp since when the distributed content served by this distribution has not changed. If equals to `null`, no guarantee is provided about content changes.
23
28
  attr_accessor :no_content_change_since
24
29
 
25
- attr_accessor :pulp_href
30
+ # RepositoryVersion to be served
31
+ attr_accessor :repository_version
26
32
 
27
33
  # A unique name. Ex, `rawhide` and `stable`.
28
34
  attr_accessor :name
29
35
 
30
- attr_accessor :pulp_labels
36
+ attr_accessor :pulp_href
31
37
 
32
- # Timestamp of creation.
33
- attr_accessor :pulp_created
38
+ # The Pulp Resource Name (PRN).
39
+ attr_accessor :prn
40
+
41
+ # The Pulp Resource Name (PRN) of the associated optional content guard.
42
+ attr_accessor :content_guard_prn
34
43
 
35
44
  # An optional content-guard.
36
45
  attr_accessor :content_guard
37
46
 
38
- # Whether this distribution should be shown in the content app.
39
- attr_accessor :hidden
47
+ # Timestamp of creation.
48
+ attr_accessor :pulp_created
49
+
50
+ # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
51
+ attr_accessor :base_path
40
52
 
41
53
  # Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.
42
54
  attr_accessor :pulp_last_updated
43
55
 
44
- # The Pulp Resource Name (PRN).
45
- attr_accessor :prn
46
-
47
- # The URL for accessing the publication as defined by this distribution.
48
- attr_accessor :base_url
49
-
50
56
  # Attribute mapping from ruby-style variable name to JSON key.
51
57
  def self.attribute_map
52
58
  {
53
- :'base_path' => :'base_path',
59
+ :'hidden' => :'hidden',
60
+ :'base_url' => :'base_url',
61
+ :'pulp_labels' => :'pulp_labels',
54
62
  :'no_content_change_since' => :'no_content_change_since',
55
- :'pulp_href' => :'pulp_href',
63
+ :'repository_version' => :'repository_version',
56
64
  :'name' => :'name',
57
- :'pulp_labels' => :'pulp_labels',
58
- :'pulp_created' => :'pulp_created',
59
- :'content_guard' => :'content_guard',
60
- :'hidden' => :'hidden',
61
- :'pulp_last_updated' => :'pulp_last_updated',
65
+ :'pulp_href' => :'pulp_href',
62
66
  :'prn' => :'prn',
63
- :'base_url' => :'base_url'
67
+ :'content_guard_prn' => :'content_guard_prn',
68
+ :'content_guard' => :'content_guard',
69
+ :'pulp_created' => :'pulp_created',
70
+ :'base_path' => :'base_path',
71
+ :'pulp_last_updated' => :'pulp_last_updated'
64
72
  }
65
73
  end
66
74
 
@@ -72,23 +80,26 @@ module PulpcoreClient
72
80
  # Attribute type mapping.
73
81
  def self.openapi_types
74
82
  {
75
- :'base_path' => :'String',
83
+ :'hidden' => :'Boolean',
84
+ :'base_url' => :'String',
85
+ :'pulp_labels' => :'Hash<String, String>',
76
86
  :'no_content_change_since' => :'String',
77
- :'pulp_href' => :'String',
87
+ :'repository_version' => :'String',
78
88
  :'name' => :'String',
79
- :'pulp_labels' => :'Hash<String, String>',
80
- :'pulp_created' => :'Time',
81
- :'content_guard' => :'String',
82
- :'hidden' => :'Boolean',
83
- :'pulp_last_updated' => :'Time',
89
+ :'pulp_href' => :'String',
84
90
  :'prn' => :'String',
85
- :'base_url' => :'String'
91
+ :'content_guard_prn' => :'String',
92
+ :'content_guard' => :'String',
93
+ :'pulp_created' => :'Time',
94
+ :'base_path' => :'String',
95
+ :'pulp_last_updated' => :'Time'
86
96
  }
87
97
  end
88
98
 
89
99
  # List of attributes with nullable: true
90
100
  def self.openapi_nullable
91
101
  Set.new([
102
+ :'repository_version',
92
103
  :'content_guard',
93
104
  ])
94
105
  end
@@ -108,18 +119,28 @@ module PulpcoreClient
108
119
  h[k.to_sym] = v
109
120
  }
110
121
 
111
- if attributes.key?(:'base_path')
112
- self.base_path = attributes[:'base_path']
122
+ if attributes.key?(:'hidden')
123
+ self.hidden = attributes[:'hidden']
113
124
  else
114
- self.base_path = nil
125
+ self.hidden = false
126
+ end
127
+
128
+ if attributes.key?(:'base_url')
129
+ self.base_url = attributes[:'base_url']
130
+ end
131
+
132
+ if attributes.key?(:'pulp_labels')
133
+ if (value = attributes[:'pulp_labels']).is_a?(Hash)
134
+ self.pulp_labels = value
135
+ end
115
136
  end
116
137
 
117
138
  if attributes.key?(:'no_content_change_since')
118
139
  self.no_content_change_since = attributes[:'no_content_change_since']
119
140
  end
120
141
 
121
- if attributes.key?(:'pulp_href')
122
- self.pulp_href = attributes[:'pulp_href']
142
+ if attributes.key?(:'repository_version')
143
+ self.repository_version = attributes[:'repository_version']
123
144
  end
124
145
 
125
146
  if attributes.key?(:'name')
@@ -128,37 +149,35 @@ module PulpcoreClient
128
149
  self.name = nil
129
150
  end
130
151
 
131
- if attributes.key?(:'pulp_labels')
132
- if (value = attributes[:'pulp_labels']).is_a?(Hash)
133
- self.pulp_labels = value
134
- end
152
+ if attributes.key?(:'pulp_href')
153
+ self.pulp_href = attributes[:'pulp_href']
135
154
  end
136
155
 
137
- if attributes.key?(:'pulp_created')
138
- self.pulp_created = attributes[:'pulp_created']
156
+ if attributes.key?(:'prn')
157
+ self.prn = attributes[:'prn']
158
+ end
159
+
160
+ if attributes.key?(:'content_guard_prn')
161
+ self.content_guard_prn = attributes[:'content_guard_prn']
139
162
  end
140
163
 
141
164
  if attributes.key?(:'content_guard')
142
165
  self.content_guard = attributes[:'content_guard']
143
166
  end
144
167
 
145
- if attributes.key?(:'hidden')
146
- self.hidden = attributes[:'hidden']
168
+ if attributes.key?(:'pulp_created')
169
+ self.pulp_created = attributes[:'pulp_created']
170
+ end
171
+
172
+ if attributes.key?(:'base_path')
173
+ self.base_path = attributes[:'base_path']
147
174
  else
148
- self.hidden = false
175
+ self.base_path = nil
149
176
  end
150
177
 
151
178
  if attributes.key?(:'pulp_last_updated')
152
179
  self.pulp_last_updated = attributes[:'pulp_last_updated']
153
180
  end
154
-
155
- if attributes.key?(:'prn')
156
- self.prn = attributes[:'prn']
157
- end
158
-
159
- if attributes.key?(:'base_url')
160
- self.base_url = attributes[:'base_url']
161
- end
162
181
  end
163
182
 
164
183
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -166,14 +185,14 @@ module PulpcoreClient
166
185
  def list_invalid_properties
167
186
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
168
187
  invalid_properties = Array.new
169
- if @base_path.nil?
170
- invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
171
- end
172
-
173
188
  if @name.nil?
174
189
  invalid_properties.push('invalid value for "name", name cannot be nil.')
175
190
  end
176
191
 
192
+ if @base_path.nil?
193
+ invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
194
+ end
195
+
177
196
  invalid_properties
178
197
  end
179
198
 
@@ -181,8 +200,8 @@ module PulpcoreClient
181
200
  # @return true if the model is valid
182
201
  def valid?
183
202
  warn '[DEPRECATED] the `valid?` method is obsolete'
184
- return false if @base_path.nil?
185
203
  return false if @name.nil?
204
+ return false if @base_path.nil?
186
205
  true
187
206
  end
188
207
 
@@ -191,17 +210,19 @@ module PulpcoreClient
191
210
  def ==(o)
192
211
  return true if self.equal?(o)
193
212
  self.class == o.class &&
194
- base_path == o.base_path &&
213
+ hidden == o.hidden &&
214
+ base_url == o.base_url &&
215
+ pulp_labels == o.pulp_labels &&
195
216
  no_content_change_since == o.no_content_change_since &&
196
- pulp_href == o.pulp_href &&
217
+ repository_version == o.repository_version &&
197
218
  name == o.name &&
198
- pulp_labels == o.pulp_labels &&
199
- pulp_created == o.pulp_created &&
200
- content_guard == o.content_guard &&
201
- hidden == o.hidden &&
202
- pulp_last_updated == o.pulp_last_updated &&
219
+ pulp_href == o.pulp_href &&
203
220
  prn == o.prn &&
204
- base_url == o.base_url
221
+ content_guard_prn == o.content_guard_prn &&
222
+ content_guard == o.content_guard &&
223
+ pulp_created == o.pulp_created &&
224
+ base_path == o.base_path &&
225
+ pulp_last_updated == o.pulp_last_updated
205
226
  end
206
227
 
207
228
  # @see the `==` method
@@ -213,7 +234,7 @@ module PulpcoreClient
213
234
  # Calculates hash code according to all attributes.
214
235
  # @return [Integer] Hash code
215
236
  def hash
216
- [base_path, no_content_change_since, pulp_href, name, pulp_labels, pulp_created, content_guard, hidden, pulp_last_updated, prn, base_url].hash
237
+ [hidden, base_url, pulp_labels, no_content_change_since, repository_version, name, pulp_href, prn, content_guard_prn, content_guard, pulp_created, base_path, pulp_last_updated].hash
217
238
  end
218
239
 
219
240
  # Builds the object from hash
@@ -0,0 +1,217 @@
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 PulpcoreClient
17
+ class DataRepair7272
18
+ # If true, only report issues without fixing them. If false (default), repair the detected issues.
19
+ attr_accessor :dry_run
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'dry_run' => :'dry_run'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'dry_run' => :'Boolean'
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::DataRepair7272` 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::DataRepair7272`. 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?(:'dry_run')
62
+ self.dry_run = attributes[:'dry_run']
63
+ else
64
+ self.dry_run = false
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
72
+ invalid_properties = Array.new
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
+ warn '[DEPRECATED] the `valid?` method is obsolete'
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ dry_run == o.dry_run
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [dry_run].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ attributes = attributes.transform_keys(&:to_sym)
109
+ transformed_hash = {}
110
+ openapi_types.each_pair do |key, type|
111
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
112
+ transformed_hash["#{key}"] = nil
113
+ elsif type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[attribute_map[key]].is_a?(Array)
117
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
118
+ end
119
+ elsif !attributes[attribute_map[key]].nil?
120
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
121
+ end
122
+ end
123
+ new(transformed_hash)
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def self._deserialize(type, value)
131
+ case type.to_sym
132
+ when :Time
133
+ Time.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ # models (e.g. Pet) or oneOf
164
+ klass = PulpcoreClient.const_get(type)
165
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -0,0 +1,217 @@
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 PulpcoreClient
17
+ class DataRepair7465
18
+ # If true, only report issues without fixing them. If false (default), repair the detected issues.
19
+ attr_accessor :dry_run
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'dry_run' => :'dry_run'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'dry_run' => :'Boolean'
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::DataRepair7465` 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::DataRepair7465`. 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?(:'dry_run')
62
+ self.dry_run = attributes[:'dry_run']
63
+ else
64
+ self.dry_run = false
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
72
+ invalid_properties = Array.new
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
+ warn '[DEPRECATED] the `valid?` method is obsolete'
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ dry_run == o.dry_run
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [dry_run].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ attributes = attributes.transform_keys(&:to_sym)
109
+ transformed_hash = {}
110
+ openapi_types.each_pair do |key, type|
111
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
112
+ transformed_hash["#{key}"] = nil
113
+ elsif type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[attribute_map[key]].is_a?(Array)
117
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
118
+ end
119
+ elsif !attributes[attribute_map[key]].nil?
120
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
121
+ end
122
+ end
123
+ new(transformed_hash)
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def self._deserialize(type, value)
131
+ case type.to_sym
132
+ when :Time
133
+ Time.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ # models (e.g. Pet) or oneOf
164
+ klass = PulpcoreClient.const_get(type)
165
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end