pulp_gem_client 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -8
  3. data/docs/AsyncOperationResponse.md +8 -7
  4. data/docs/ContentGemApi.md +118 -66
  5. data/docs/ContentSummaryResponse.md +12 -11
  6. data/docs/DistributionsGemApi.md +388 -183
  7. data/docs/GemGemContentResponse.md +32 -29
  8. data/docs/GemGemDistribution.md +22 -21
  9. data/docs/GemGemDistributionResponse.md +34 -29
  10. data/docs/GemGemPublication.md +10 -9
  11. data/docs/GemGemPublicationResponse.md +18 -15
  12. data/docs/GemGemRemote.md +54 -53
  13. data/docs/GemGemRemoteResponse.md +54 -51
  14. data/docs/GemGemRemoteResponseHiddenFieldsInner.md +20 -0
  15. data/docs/GemGemRepository.md +16 -15
  16. data/docs/GemGemRepositoryResponse.md +28 -25
  17. data/docs/MyPermissionsResponse.md +8 -7
  18. data/docs/NestedRole.md +12 -11
  19. data/docs/NestedRoleResponse.md +12 -11
  20. data/docs/ObjectRolesResponse.md +8 -7
  21. data/docs/PaginatedRepositoryVersionResponseList.md +14 -13
  22. data/docs/PaginatedgemGemContentResponseList.md +14 -13
  23. data/docs/PaginatedgemGemDistributionResponseList.md +14 -13
  24. data/docs/PaginatedgemGemPublicationResponseList.md +14 -13
  25. data/docs/PaginatedgemGemRemoteResponseList.md +14 -13
  26. data/docs/PaginatedgemGemRepositoryResponseList.md +14 -13
  27. data/docs/PatchedgemGemDistribution.md +22 -21
  28. data/docs/PatchedgemGemRemote.md +54 -53
  29. data/docs/PatchedgemGemRepository.md +16 -15
  30. data/docs/PolicyEnum.md +4 -5
  31. data/docs/PublicationsGemApi.md +271 -132
  32. data/docs/RemotesGemApi.md +392 -185
  33. data/docs/Repair.md +8 -7
  34. data/docs/RepositoriesGemApi.md +449 -210
  35. data/docs/RepositoriesGemVersionsApi.md +155 -83
  36. data/docs/RepositoryAddRemoveContent.md +12 -11
  37. data/docs/RepositorySyncURL.md +10 -9
  38. data/docs/RepositoryVersionResponse.md +22 -19
  39. data/docs/SetLabel.md +10 -9
  40. data/docs/SetLabelResponse.md +10 -9
  41. data/docs/UnsetLabel.md +8 -7
  42. data/docs/UnsetLabelResponse.md +10 -9
  43. data/lib/pulp_gem_client/api/content_gem_api.rb +31 -22
  44. data/lib/pulp_gem_client/api/distributions_gem_api.rb +94 -58
  45. data/lib/pulp_gem_client/api/publications_gem_api.rb +81 -58
  46. data/lib/pulp_gem_client/api/remotes_gem_api.rb +109 -70
  47. data/lib/pulp_gem_client/api/repositories_gem_api.rb +116 -72
  48. data/lib/pulp_gem_client/api/repositories_gem_versions_api.rb +50 -37
  49. data/lib/pulp_gem_client/api_client.rb +137 -102
  50. data/lib/pulp_gem_client/api_error.rb +2 -1
  51. data/lib/pulp_gem_client/configuration.rb +162 -21
  52. data/lib/pulp_gem_client/models/async_operation_response.rb +32 -22
  53. data/lib/pulp_gem_client/models/content_summary_response.rb +36 -22
  54. data/lib/pulp_gem_client/models/gem_gem_content_response.rb +45 -25
  55. data/lib/pulp_gem_client/models/gem_gem_distribution.rb +34 -22
  56. data/lib/pulp_gem_client/models/gem_gem_distribution_response.rb +57 -25
  57. data/lib/pulp_gem_client/models/gem_gem_publication.rb +30 -22
  58. data/lib/pulp_gem_client/models/gem_gem_publication_response.rb +43 -25
  59. data/lib/pulp_gem_client/models/gem_gem_remote.rb +56 -22
  60. data/lib/pulp_gem_client/models/gem_gem_remote_response.rb +70 -26
  61. data/lib/pulp_gem_client/models/{gem_gem_remote_response_hidden_fields.rb → gem_gem_remote_response_hidden_fields_inner.rb} +37 -25
  62. data/lib/pulp_gem_client/models/gem_gem_repository.rb +32 -22
  63. data/lib/pulp_gem_client/models/gem_gem_repository_response.rb +45 -25
  64. data/lib/pulp_gem_client/models/my_permissions_response.rb +32 -22
  65. data/lib/pulp_gem_client/models/nested_role.rb +32 -22
  66. data/lib/pulp_gem_client/models/nested_role_response.rb +32 -22
  67. data/lib/pulp_gem_client/models/object_roles_response.rb +32 -22
  68. data/lib/pulp_gem_client/models/paginated_repository_version_response_list.rb +34 -22
  69. data/lib/pulp_gem_client/models/paginatedgem_gem_content_response_list.rb +34 -22
  70. data/lib/pulp_gem_client/models/paginatedgem_gem_distribution_response_list.rb +34 -22
  71. data/lib/pulp_gem_client/models/paginatedgem_gem_publication_response_list.rb +34 -22
  72. data/lib/pulp_gem_client/models/paginatedgem_gem_remote_response_list.rb +34 -22
  73. data/lib/pulp_gem_client/models/paginatedgem_gem_repository_response_list.rb +34 -22
  74. data/lib/pulp_gem_client/models/patchedgem_gem_distribution.rb +40 -24
  75. data/lib/pulp_gem_client/models/patchedgem_gem_remote.rb +62 -24
  76. data/lib/pulp_gem_client/models/patchedgem_gem_repository.rb +35 -23
  77. data/lib/pulp_gem_client/models/policy_enum.rb +8 -4
  78. data/lib/pulp_gem_client/models/repair.rb +30 -22
  79. data/lib/pulp_gem_client/models/repository_add_remove_content.rb +31 -23
  80. data/lib/pulp_gem_client/models/repository_sync_url.rb +30 -22
  81. data/lib/pulp_gem_client/models/repository_version_response.rb +44 -26
  82. data/lib/pulp_gem_client/models/set_label.rb +34 -22
  83. data/lib/pulp_gem_client/models/set_label_response.rb +34 -22
  84. data/lib/pulp_gem_client/models/unset_label.rb +32 -22
  85. data/lib/pulp_gem_client/models/unset_label_response.rb +32 -22
  86. data/lib/pulp_gem_client/version.rb +2 -2
  87. data/lib/pulp_gem_client.rb +2 -3
  88. data/pulp_gem_client.gemspec +9 -6
  89. data/spec/api/content_gem_api_spec.rb +9 -8
  90. data/spec/api/distributions_gem_api_spec.rb +15 -14
  91. data/spec/api/publications_gem_api_spec.rb +22 -20
  92. data/spec/api/remotes_gem_api_spec.rb +22 -20
  93. data/spec/api/repositories_gem_api_spec.rb +19 -18
  94. data/spec/api/repositories_gem_versions_api_spec.rb +16 -14
  95. data/spec/models/async_operation_response_spec.rb +7 -12
  96. data/spec/models/content_summary_response_spec.rb +9 -14
  97. data/spec/models/gem_gem_content_response_spec.rb +24 -23
  98. data/spec/models/gem_gem_distribution_response_spec.rb +30 -23
  99. data/spec/models/gem_gem_distribution_spec.rb +14 -19
  100. data/spec/models/gem_gem_publication_response_spec.rb +17 -16
  101. data/spec/models/gem_gem_publication_spec.rb +8 -13
  102. data/spec/models/{gem_gem_remote_response_hidden_fields_spec.rb → gem_gem_remote_response_hidden_fields_inner_spec.rb} +11 -16
  103. data/spec/models/gem_gem_remote_response_spec.rb +35 -34
  104. data/spec/models/gem_gem_remote_spec.rb +30 -35
  105. data/spec/models/gem_gem_repository_response_spec.rb +22 -21
  106. data/spec/models/gem_gem_repository_spec.rb +11 -16
  107. data/spec/models/my_permissions_response_spec.rb +7 -12
  108. data/spec/models/nested_role_response_spec.rb +9 -14
  109. data/spec/models/nested_role_spec.rb +9 -14
  110. data/spec/models/object_roles_response_spec.rb +7 -12
  111. data/spec/models/paginated_repository_version_response_list_spec.rb +10 -15
  112. data/spec/models/paginatedgem_gem_content_response_list_spec.rb +10 -15
  113. data/spec/models/paginatedgem_gem_distribution_response_list_spec.rb +10 -15
  114. data/spec/models/paginatedgem_gem_publication_response_list_spec.rb +10 -15
  115. data/spec/models/paginatedgem_gem_remote_response_list_spec.rb +10 -15
  116. data/spec/models/paginatedgem_gem_repository_response_list_spec.rb +10 -15
  117. data/spec/models/patchedgem_gem_distribution_spec.rb +14 -19
  118. data/spec/models/patchedgem_gem_remote_spec.rb +30 -35
  119. data/spec/models/patchedgem_gem_repository_spec.rb +11 -16
  120. data/spec/models/policy_enum_spec.rb +6 -11
  121. data/spec/models/repair_spec.rb +7 -12
  122. data/spec/models/repository_add_remove_content_spec.rb +9 -14
  123. data/spec/models/repository_sync_url_spec.rb +8 -13
  124. data/spec/models/repository_version_response_spec.rb +19 -18
  125. data/spec/models/set_label_response_spec.rb +8 -13
  126. data/spec/models/set_label_spec.rb +8 -13
  127. data/spec/models/unset_label_response_spec.rb +8 -13
  128. data/spec/models/unset_label_spec.rb +7 -12
  129. data/spec/spec_helper.rb +1 -1
  130. metadata +80 -60
  131. data/docs/GemGemContent.md +0 -21
  132. data/docs/GemGemRemoteResponseHiddenFields.md +0 -19
  133. data/lib/pulp_gem_client/models/gem_gem_content.rb +0 -228
  134. data/spec/api_client_spec.rb +0 -188
  135. data/spec/configuration_spec.rb +0 -42
  136. data/spec/models/gem_gem_content_spec.rb +0 -53
@@ -6,17 +6,21 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpGemClient
16
17
  # A Serializer for GemPublication.
17
18
  class GemGemPublicationResponse
18
19
  attr_accessor :pulp_href
19
20
 
21
+ # The Pulp Resource Name (PRN).
22
+ attr_accessor :prn
23
+
20
24
  # Timestamp of creation.
21
25
  attr_accessor :pulp_created
22
26
 
@@ -32,6 +36,7 @@ module PulpGemClient
32
36
  def self.attribute_map
33
37
  {
34
38
  :'pulp_href' => :'pulp_href',
39
+ :'prn' => :'prn',
35
40
  :'pulp_created' => :'pulp_created',
36
41
  :'pulp_last_updated' => :'pulp_last_updated',
37
42
  :'repository_version' => :'repository_version',
@@ -39,12 +44,18 @@ module PulpGemClient
39
44
  }
40
45
  end
41
46
 
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
42
52
  # Attribute type mapping.
43
53
  def self.openapi_types
44
54
  {
45
55
  :'pulp_href' => :'String',
46
- :'pulp_created' => :'DateTime',
47
- :'pulp_last_updated' => :'DateTime',
56
+ :'prn' => :'String',
57
+ :'pulp_created' => :'Time',
58
+ :'pulp_last_updated' => :'Time',
48
59
  :'repository_version' => :'String',
49
60
  :'repository' => :'String'
50
61
  }
@@ -75,6 +86,10 @@ module PulpGemClient
75
86
  self.pulp_href = attributes[:'pulp_href']
76
87
  end
77
88
 
89
+ if attributes.key?(:'prn')
90
+ self.prn = attributes[:'prn']
91
+ end
92
+
78
93
  if attributes.key?(:'pulp_created')
79
94
  self.pulp_created = attributes[:'pulp_created']
80
95
  end
@@ -95,6 +110,7 @@ module PulpGemClient
95
110
  # Show invalid properties with the reasons. Usually used together with valid?
96
111
  # @return Array for valid properties with the reasons
97
112
  def list_invalid_properties
113
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
98
114
  invalid_properties = Array.new
99
115
  invalid_properties
100
116
  end
@@ -102,6 +118,7 @@ module PulpGemClient
102
118
  # Check to see if the all the properties in the model are valid
103
119
  # @return true if the model is valid
104
120
  def valid?
121
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
122
  true
106
123
  end
107
124
 
@@ -111,6 +128,7 @@ module PulpGemClient
111
128
  return true if self.equal?(o)
112
129
  self.class == o.class &&
113
130
  pulp_href == o.pulp_href &&
131
+ prn == o.prn &&
114
132
  pulp_created == o.pulp_created &&
115
133
  pulp_last_updated == o.pulp_last_updated &&
116
134
  repository_version == o.repository_version &&
@@ -126,44 +144,40 @@ module PulpGemClient
126
144
  # Calculates hash code according to all attributes.
127
145
  # @return [Integer] Hash code
128
146
  def hash
129
- [pulp_href, pulp_created, pulp_last_updated, repository_version, repository].hash
147
+ [pulp_href, prn, pulp_created, pulp_last_updated, repository_version, repository].hash
130
148
  end
131
149
 
132
150
  # Builds the object from hash
133
151
  # @param [Hash] attributes Model attributes in the form of hash
134
152
  # @return [Object] Returns the model itself
135
153
  def self.build_from_hash(attributes)
136
- new.build_from_hash(attributes)
137
- end
138
-
139
- # Builds the object from hash
140
- # @param [Hash] attributes Model attributes in the form of hash
141
- # @return [Object] Returns the model itself
142
- def build_from_hash(attributes)
143
154
  return nil unless attributes.is_a?(Hash)
144
- self.class.openapi_types.each_pair do |key, type|
145
- if type =~ /\AArray<(.*)>/i
155
+ attributes = attributes.transform_keys(&:to_sym)
156
+ transformed_hash = {}
157
+ openapi_types.each_pair do |key, type|
158
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = nil
160
+ elsif type =~ /\AArray<(.*)>/i
146
161
  # check to ensure the input is an array given that the attribute
147
162
  # is documented as an array but the input is not
148
- if attributes[self.class.attribute_map[key]].is_a?(Array)
149
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ if attributes[attribute_map[key]].is_a?(Array)
164
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
165
  end
151
- elsif !attributes[self.class.attribute_map[key]].nil?
152
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
- end # or else data not found in attributes(hash), not an issue as the data can be optional
166
+ elsif !attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
168
+ end
154
169
  end
155
-
156
- self
170
+ new(transformed_hash)
157
171
  end
158
172
 
159
173
  # Deserializes the data based on type
160
174
  # @param string type Data type
161
175
  # @param string value Value to be deserialized
162
176
  # @return [Object] Deserialized data
163
- def _deserialize(type, value)
177
+ def self._deserialize(type, value)
164
178
  case type.to_sym
165
- when :DateTime
166
- DateTime.parse(value)
179
+ when :Time
180
+ Time.parse(value)
167
181
  when :Date
168
182
  Date.parse(value)
169
183
  when :String
@@ -193,7 +207,9 @@ module PulpGemClient
193
207
  end
194
208
  end
195
209
  else # model
196
- PulpGemClient.const_get(type).build_from_hash(value)
210
+ # models (e.g. Pet) or oneOf
211
+ klass = PulpGemClient.const_get(type)
212
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
213
  end
198
214
  end
199
215
 
@@ -219,7 +235,7 @@ module PulpGemClient
219
235
  is_nullable = self.class.openapi_nullable.include?(attr)
220
236
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
237
  end
222
-
238
+
223
239
  hash[param] = _to_hash(value)
224
240
  end
225
241
  hash
@@ -242,5 +258,7 @@ module PulpGemClient
242
258
  value
243
259
  end
244
260
  end
261
+
245
262
  end
263
+
246
264
  end
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpGemClient
16
17
  # A Serializer for GemRemote.
@@ -83,6 +84,28 @@ module PulpGemClient
83
84
 
84
85
  attr_accessor :excludes
85
86
 
87
+ class EnumAttributeValidator
88
+ attr_reader :datatype
89
+ attr_reader :allowable_values
90
+
91
+ def initialize(datatype, allowable_values)
92
+ @allowable_values = allowable_values.map do |value|
93
+ case datatype.to_s
94
+ when /Integer/i
95
+ value.to_i
96
+ when /Float/i
97
+ value.to_f
98
+ else
99
+ value
100
+ end
101
+ end
102
+ end
103
+
104
+ def valid?(value)
105
+ !value || allowable_values.include?(value)
106
+ end
107
+ end
108
+
86
109
  # Attribute mapping from ruby-style variable name to JSON key.
87
110
  def self.attribute_map
88
111
  {
@@ -113,6 +136,11 @@ module PulpGemClient
113
136
  }
114
137
  end
115
138
 
139
+ # Returns all the JSON keys this model knows about
140
+ def self.acceptable_attributes
141
+ attribute_map.values
142
+ end
143
+
116
144
  # Attribute type mapping.
117
145
  def self.openapi_types
118
146
  {
@@ -183,10 +211,14 @@ module PulpGemClient
183
211
 
184
212
  if attributes.key?(:'name')
185
213
  self.name = attributes[:'name']
214
+ else
215
+ self.name = nil
186
216
  end
187
217
 
188
218
  if attributes.key?(:'url')
189
219
  self.url = attributes[:'url']
220
+ else
221
+ self.url = nil
190
222
  end
191
223
 
192
224
  if attributes.key?(:'ca_cert')
@@ -291,6 +323,7 @@ module PulpGemClient
291
323
  # Show invalid properties with the reasons. Usually used together with valid?
292
324
  # @return Array for valid properties with the reasons
293
325
  def list_invalid_properties
326
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
294
327
  invalid_properties = Array.new
295
328
  if @name.nil?
296
329
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -366,6 +399,7 @@ module PulpGemClient
366
399
  # Check to see if the all the properties in the model are valid
367
400
  # @return true if the model is valid
368
401
  def valid?
402
+ warn '[DEPRECATED] the `valid?` method is obsolete'
369
403
  return false if @name.nil?
370
404
  return false if @name.to_s.length < 1
371
405
  return false if @url.nil?
@@ -591,37 +625,33 @@ module PulpGemClient
591
625
  # @param [Hash] attributes Model attributes in the form of hash
592
626
  # @return [Object] Returns the model itself
593
627
  def self.build_from_hash(attributes)
594
- new.build_from_hash(attributes)
595
- end
596
-
597
- # Builds the object from hash
598
- # @param [Hash] attributes Model attributes in the form of hash
599
- # @return [Object] Returns the model itself
600
- def build_from_hash(attributes)
601
628
  return nil unless attributes.is_a?(Hash)
602
- self.class.openapi_types.each_pair do |key, type|
603
- if type =~ /\AArray<(.*)>/i
629
+ attributes = attributes.transform_keys(&:to_sym)
630
+ transformed_hash = {}
631
+ openapi_types.each_pair do |key, type|
632
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
633
+ transformed_hash["#{key}"] = nil
634
+ elsif type =~ /\AArray<(.*)>/i
604
635
  # check to ensure the input is an array given that the attribute
605
636
  # is documented as an array but the input is not
606
- if attributes[self.class.attribute_map[key]].is_a?(Array)
607
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
637
+ if attributes[attribute_map[key]].is_a?(Array)
638
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
608
639
  end
609
- elsif !attributes[self.class.attribute_map[key]].nil?
610
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
611
- end # or else data not found in attributes(hash), not an issue as the data can be optional
640
+ elsif !attributes[attribute_map[key]].nil?
641
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
642
+ end
612
643
  end
613
-
614
- self
644
+ new(transformed_hash)
615
645
  end
616
646
 
617
647
  # Deserializes the data based on type
618
648
  # @param string type Data type
619
649
  # @param string value Value to be deserialized
620
650
  # @return [Object] Deserialized data
621
- def _deserialize(type, value)
651
+ def self._deserialize(type, value)
622
652
  case type.to_sym
623
- when :DateTime
624
- DateTime.parse(value)
653
+ when :Time
654
+ Time.parse(value)
625
655
  when :Date
626
656
  Date.parse(value)
627
657
  when :String
@@ -651,7 +681,9 @@ module PulpGemClient
651
681
  end
652
682
  end
653
683
  else # model
654
- PulpGemClient.const_get(type).build_from_hash(value)
684
+ # models (e.g. Pet) or oneOf
685
+ klass = PulpGemClient.const_get(type)
686
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
655
687
  end
656
688
  end
657
689
 
@@ -677,7 +709,7 @@ module PulpGemClient
677
709
  is_nullable = self.class.openapi_nullable.include?(attr)
678
710
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
679
711
  end
680
-
712
+
681
713
  hash[param] = _to_hash(value)
682
714
  end
683
715
  hash
@@ -700,5 +732,7 @@ module PulpGemClient
700
732
  value
701
733
  end
702
734
  end
735
+
703
736
  end
737
+
704
738
  end
@@ -6,17 +6,21 @@
6
6
  The version of the OpenAPI document: v3
7
7
  Contact: pulp-list@redhat.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.10.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module PulpGemClient
16
17
  # A Serializer for GemRemote.
17
18
  class GemGemRemoteResponse
18
19
  attr_accessor :pulp_href
19
20
 
21
+ # The Pulp Resource Name (PRN).
22
+ attr_accessor :prn
23
+
20
24
  # Timestamp of creation.
21
25
  attr_accessor :pulp_created
22
26
 
@@ -79,10 +83,33 @@ module PulpGemClient
79
83
 
80
84
  attr_accessor :excludes
81
85
 
86
+ class EnumAttributeValidator
87
+ attr_reader :datatype
88
+ attr_reader :allowable_values
89
+
90
+ def initialize(datatype, allowable_values)
91
+ @allowable_values = allowable_values.map do |value|
92
+ case datatype.to_s
93
+ when /Integer/i
94
+ value.to_i
95
+ when /Float/i
96
+ value.to_f
97
+ else
98
+ value
99
+ end
100
+ end
101
+ end
102
+
103
+ def valid?(value)
104
+ !value || allowable_values.include?(value)
105
+ end
106
+ end
107
+
82
108
  # Attribute mapping from ruby-style variable name to JSON key.
83
109
  def self.attribute_map
84
110
  {
85
111
  :'pulp_href' => :'pulp_href',
112
+ :'prn' => :'prn',
86
113
  :'pulp_created' => :'pulp_created',
87
114
  :'pulp_last_updated' => :'pulp_last_updated',
88
115
  :'name' => :'name',
@@ -108,12 +135,18 @@ module PulpGemClient
108
135
  }
109
136
  end
110
137
 
138
+ # Returns all the JSON keys this model knows about
139
+ def self.acceptable_attributes
140
+ attribute_map.values
141
+ end
142
+
111
143
  # Attribute type mapping.
112
144
  def self.openapi_types
113
145
  {
114
146
  :'pulp_href' => :'String',
115
- :'pulp_created' => :'DateTime',
116
- :'pulp_last_updated' => :'DateTime',
147
+ :'prn' => :'String',
148
+ :'pulp_created' => :'Time',
149
+ :'pulp_last_updated' => :'Time',
117
150
  :'name' => :'String',
118
151
  :'url' => :'String',
119
152
  :'ca_cert' => :'String',
@@ -130,7 +163,7 @@ module PulpGemClient
130
163
  :'sock_read_timeout' => :'Float',
131
164
  :'headers' => :'Array<Object>',
132
165
  :'rate_limit' => :'Integer',
133
- :'hidden_fields' => :'Array<GemGemRemoteResponseHiddenFields>',
166
+ :'hidden_fields' => :'Array<GemGemRemoteResponseHiddenFieldsInner>',
134
167
  :'prereleases' => :'Boolean',
135
168
  :'includes' => :'Hash<String, String>',
136
169
  :'excludes' => :'Hash<String, String>'
@@ -174,6 +207,10 @@ module PulpGemClient
174
207
  self.pulp_href = attributes[:'pulp_href']
175
208
  end
176
209
 
210
+ if attributes.key?(:'prn')
211
+ self.prn = attributes[:'prn']
212
+ end
213
+
177
214
  if attributes.key?(:'pulp_created')
178
215
  self.pulp_created = attributes[:'pulp_created']
179
216
  end
@@ -184,10 +221,14 @@ module PulpGemClient
184
221
 
185
222
  if attributes.key?(:'name')
186
223
  self.name = attributes[:'name']
224
+ else
225
+ self.name = nil
187
226
  end
188
227
 
189
228
  if attributes.key?(:'url')
190
229
  self.url = attributes[:'url']
230
+ else
231
+ self.url = nil
191
232
  end
192
233
 
193
234
  if attributes.key?(:'ca_cert')
@@ -278,6 +319,7 @@ module PulpGemClient
278
319
  # Show invalid properties with the reasons. Usually used together with valid?
279
320
  # @return Array for valid properties with the reasons
280
321
  def list_invalid_properties
322
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
281
323
  invalid_properties = Array.new
282
324
  if @name.nil?
283
325
  invalid_properties.push('invalid value for "name", name cannot be nil.')
@@ -313,6 +355,7 @@ module PulpGemClient
313
355
  # Check to see if the all the properties in the model are valid
314
356
  # @return true if the model is valid
315
357
  def valid?
358
+ warn '[DEPRECATED] the `valid?` method is obsolete'
316
359
  return false if @name.nil?
317
360
  return false if @url.nil?
318
361
  return false if !@download_concurrency.nil? && @download_concurrency < 1
@@ -379,6 +422,7 @@ module PulpGemClient
379
422
  return true if self.equal?(o)
380
423
  self.class == o.class &&
381
424
  pulp_href == o.pulp_href &&
425
+ prn == o.prn &&
382
426
  pulp_created == o.pulp_created &&
383
427
  pulp_last_updated == o.pulp_last_updated &&
384
428
  name == o.name &&
@@ -412,44 +456,40 @@ module PulpGemClient
412
456
  # Calculates hash code according to all attributes.
413
457
  # @return [Integer] Hash code
414
458
  def hash
415
- [pulp_href, pulp_created, pulp_last_updated, name, url, ca_cert, client_cert, tls_validation, proxy_url, pulp_labels, download_concurrency, max_retries, policy, total_timeout, connect_timeout, sock_connect_timeout, sock_read_timeout, headers, rate_limit, hidden_fields, prereleases, includes, excludes].hash
459
+ [pulp_href, prn, pulp_created, pulp_last_updated, name, url, ca_cert, client_cert, tls_validation, proxy_url, pulp_labels, download_concurrency, max_retries, policy, total_timeout, connect_timeout, sock_connect_timeout, sock_read_timeout, headers, rate_limit, hidden_fields, prereleases, includes, excludes].hash
416
460
  end
417
461
 
418
462
  # Builds the object from hash
419
463
  # @param [Hash] attributes Model attributes in the form of hash
420
464
  # @return [Object] Returns the model itself
421
465
  def self.build_from_hash(attributes)
422
- new.build_from_hash(attributes)
423
- end
424
-
425
- # Builds the object from hash
426
- # @param [Hash] attributes Model attributes in the form of hash
427
- # @return [Object] Returns the model itself
428
- def build_from_hash(attributes)
429
466
  return nil unless attributes.is_a?(Hash)
430
- self.class.openapi_types.each_pair do |key, type|
431
- if type =~ /\AArray<(.*)>/i
467
+ attributes = attributes.transform_keys(&:to_sym)
468
+ transformed_hash = {}
469
+ openapi_types.each_pair do |key, type|
470
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
471
+ transformed_hash["#{key}"] = nil
472
+ elsif type =~ /\AArray<(.*)>/i
432
473
  # check to ensure the input is an array given that the attribute
433
474
  # is documented as an array but the input is not
434
- if attributes[self.class.attribute_map[key]].is_a?(Array)
435
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
475
+ if attributes[attribute_map[key]].is_a?(Array)
476
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
436
477
  end
437
- elsif !attributes[self.class.attribute_map[key]].nil?
438
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
439
- end # or else data not found in attributes(hash), not an issue as the data can be optional
478
+ elsif !attributes[attribute_map[key]].nil?
479
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
480
+ end
440
481
  end
441
-
442
- self
482
+ new(transformed_hash)
443
483
  end
444
484
 
445
485
  # Deserializes the data based on type
446
486
  # @param string type Data type
447
487
  # @param string value Value to be deserialized
448
488
  # @return [Object] Deserialized data
449
- def _deserialize(type, value)
489
+ def self._deserialize(type, value)
450
490
  case type.to_sym
451
- when :DateTime
452
- DateTime.parse(value)
491
+ when :Time
492
+ Time.parse(value)
453
493
  when :Date
454
494
  Date.parse(value)
455
495
  when :String
@@ -479,7 +519,9 @@ module PulpGemClient
479
519
  end
480
520
  end
481
521
  else # model
482
- PulpGemClient.const_get(type).build_from_hash(value)
522
+ # models (e.g. Pet) or oneOf
523
+ klass = PulpGemClient.const_get(type)
524
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
483
525
  end
484
526
  end
485
527
 
@@ -505,7 +547,7 @@ module PulpGemClient
505
547
  is_nullable = self.class.openapi_nullable.include?(attr)
506
548
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
507
549
  end
508
-
550
+
509
551
  hash[param] = _to_hash(value)
510
552
  end
511
553
  hash
@@ -528,5 +570,7 @@ module PulpGemClient
528
570
  value
529
571
  end
530
572
  end
573
+
531
574
  end
575
+
532
576
  end