pulp_container_client 2.6.0 → 2.7.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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +16 -12
  4. data/docs/ContainerContainerDistribution.md +5 -5
  5. data/docs/ContainerContainerDistributionResponse.md +7 -7
  6. data/docs/ContainerContainerPushRepository.md +23 -0
  7. data/docs/ContainerContainerPushRepositoryResponse.md +9 -11
  8. data/docs/ContainerContainerRemote.md +7 -5
  9. data/docs/ContainerContainerRemoteResponse.md +7 -5
  10. data/docs/ManifestCopy.md +1 -1
  11. data/docs/PatchedcontainerContainerDistribution.md +5 -5
  12. data/docs/PatchedcontainerContainerPushRepository.md +23 -0
  13. data/docs/PatchedcontainerContainerRemote.md +7 -5
  14. data/docs/RecursiveManage.md +1 -1
  15. data/docs/RepositoriesContainerPushApi.md +112 -0
  16. data/docs/RepositoriesContainerPushVersionsApi.md +271 -0
  17. data/docs/RepositoriesContainerVersionsApi.md +16 -279
  18. data/docs/TagCopy.md +1 -1
  19. data/lib/pulp_container_client.rb +4 -1
  20. data/lib/pulp_container_client/api/content_blobs_api.rb +1 -1
  21. data/lib/pulp_container_client/api/content_manifests_api.rb +1 -1
  22. data/lib/pulp_container_client/api/content_tags_api.rb +1 -1
  23. data/lib/pulp_container_client/api/contentguards_content_redirect_api.rb +1 -1
  24. data/lib/pulp_container_client/api/distributions_container_api.rb +1 -1
  25. data/lib/pulp_container_client/api/pulp_container_namespaces_api.rb +1 -1
  26. data/lib/pulp_container_client/api/remotes_container_api.rb +1 -1
  27. data/lib/pulp_container_client/api/repositories_container_api.rb +1 -1
  28. data/lib/pulp_container_client/api/repositories_container_push_api.rb +141 -1
  29. data/lib/pulp_container_client/api/repositories_container_push_versions_api.rb +339 -0
  30. data/lib/pulp_container_client/api/repositories_container_versions_api.rb +26 -343
  31. data/lib/pulp_container_client/api/token_api.rb +1 -1
  32. data/lib/pulp_container_client/api_client.rb +12 -8
  33. data/lib/pulp_container_client/api_error.rb +1 -1
  34. data/lib/pulp_container_client/configuration.rb +8 -1
  35. data/lib/pulp_container_client/models/async_operation_response.rb +1 -1
  36. data/lib/pulp_container_client/models/container_blob_response.rb +1 -1
  37. data/lib/pulp_container_client/models/container_container_distribution.rb +21 -21
  38. data/lib/pulp_container_client/models/container_container_distribution_response.rb +25 -25
  39. data/lib/pulp_container_client/models/container_container_namespace.rb +1 -1
  40. data/lib/pulp_container_client/models/container_container_namespace_response.rb +1 -1
  41. data/lib/pulp_container_client/models/container_container_push_repository.rb +259 -0
  42. data/lib/pulp_container_client/models/container_container_push_repository_response.rb +33 -43
  43. data/lib/pulp_container_client/models/container_container_remote.rb +19 -7
  44. data/lib/pulp_container_client/models/container_container_remote_response.rb +19 -7
  45. data/lib/pulp_container_client/models/container_container_repository.rb +1 -1
  46. data/lib/pulp_container_client/models/container_container_repository_response.rb +1 -1
  47. data/lib/pulp_container_client/models/container_content_redirect_content_guard.rb +1 -1
  48. data/lib/pulp_container_client/models/container_content_redirect_content_guard_response.rb +1 -1
  49. data/lib/pulp_container_client/models/container_manifest_response.rb +1 -1
  50. data/lib/pulp_container_client/models/container_tag_response.rb +1 -1
  51. data/lib/pulp_container_client/models/content_summary.rb +1 -1
  52. data/lib/pulp_container_client/models/content_summary_response.rb +1 -1
  53. data/lib/pulp_container_client/models/manifest_copy.rb +2 -2
  54. data/lib/pulp_container_client/models/media_types_enum.rb +1 -1
  55. data/lib/pulp_container_client/models/oci_build_image.rb +1 -1
  56. data/lib/pulp_container_client/models/paginated_repository_version_response_list.rb +1 -1
  57. data/lib/pulp_container_client/models/paginatedcontainer_blob_response_list.rb +1 -1
  58. data/lib/pulp_container_client/models/paginatedcontainer_container_distribution_response_list.rb +1 -1
  59. data/lib/pulp_container_client/models/paginatedcontainer_container_namespace_response_list.rb +1 -1
  60. data/lib/pulp_container_client/models/paginatedcontainer_container_push_repository_response_list.rb +1 -1
  61. data/lib/pulp_container_client/models/paginatedcontainer_container_remote_response_list.rb +1 -1
  62. data/lib/pulp_container_client/models/paginatedcontainer_container_repository_response_list.rb +1 -1
  63. data/lib/pulp_container_client/models/paginatedcontainer_content_redirect_content_guard_response_list.rb +1 -1
  64. data/lib/pulp_container_client/models/paginatedcontainer_manifest_response_list.rb +1 -1
  65. data/lib/pulp_container_client/models/paginatedcontainer_tag_response_list.rb +1 -1
  66. data/lib/pulp_container_client/models/patchedcontainer_container_distribution.rb +21 -21
  67. data/lib/pulp_container_client/models/patchedcontainer_container_push_repository.rb +254 -0
  68. data/lib/pulp_container_client/models/patchedcontainer_container_remote.rb +19 -7
  69. data/lib/pulp_container_client/models/patchedcontainer_container_repository.rb +1 -1
  70. data/lib/pulp_container_client/models/patchedcontainer_content_redirect_content_guard.rb +1 -1
  71. data/lib/pulp_container_client/models/policy_enum.rb +1 -1
  72. data/lib/pulp_container_client/models/recursive_manage.rb +2 -2
  73. data/lib/pulp_container_client/models/remove_image.rb +1 -1
  74. data/lib/pulp_container_client/models/repository_sync_url.rb +1 -1
  75. data/lib/pulp_container_client/models/repository_version.rb +1 -1
  76. data/lib/pulp_container_client/models/repository_version_response.rb +1 -1
  77. data/lib/pulp_container_client/models/tag_copy.rb +2 -2
  78. data/lib/pulp_container_client/models/tag_image.rb +1 -1
  79. data/lib/pulp_container_client/models/un_tag_image.rb +1 -1
  80. data/lib/pulp_container_client/version.rb +2 -2
  81. data/pulp_container_client.gemspec +1 -1
  82. data/spec/api/content_blobs_api_spec.rb +1 -1
  83. data/spec/api/content_manifests_api_spec.rb +1 -1
  84. data/spec/api/content_tags_api_spec.rb +1 -1
  85. data/spec/api/contentguards_content_redirect_api_spec.rb +1 -1
  86. data/spec/api/distributions_container_api_spec.rb +1 -1
  87. data/spec/api/pulp_container_namespaces_api_spec.rb +1 -1
  88. data/spec/api/remotes_container_api_spec.rb +1 -1
  89. data/spec/api/repositories_container_api_spec.rb +1 -1
  90. data/spec/api/repositories_container_push_api_spec.rb +27 -1
  91. data/spec/api/repositories_container_push_versions_api_spec.rb +104 -0
  92. data/spec/api/repositories_container_versions_api_spec.rb +5 -74
  93. data/spec/api/token_api_spec.rb +1 -1
  94. data/spec/api_client_spec.rb +2 -2
  95. data/spec/configuration_spec.rb +1 -1
  96. data/spec/models/async_operation_response_spec.rb +1 -1
  97. data/spec/models/container_blob_response_spec.rb +1 -1
  98. data/spec/models/container_container_distribution_response_spec.rb +8 -8
  99. data/spec/models/container_container_distribution_spec.rb +6 -6
  100. data/spec/models/container_container_namespace_response_spec.rb +1 -1
  101. data/spec/models/container_container_namespace_spec.rb +1 -1
  102. data/spec/models/container_container_push_repository_response_spec.rb +7 -13
  103. data/spec/models/container_container_push_repository_spec.rb +59 -0
  104. data/spec/models/container_container_remote_response_spec.rb +7 -1
  105. data/spec/models/container_container_remote_spec.rb +7 -1
  106. data/spec/models/container_container_repository_response_spec.rb +1 -1
  107. data/spec/models/container_container_repository_spec.rb +1 -1
  108. data/spec/models/container_content_redirect_content_guard_response_spec.rb +1 -1
  109. data/spec/models/container_content_redirect_content_guard_spec.rb +1 -1
  110. data/spec/models/container_manifest_response_spec.rb +1 -1
  111. data/spec/models/container_tag_response_spec.rb +1 -1
  112. data/spec/models/content_summary_response_spec.rb +1 -1
  113. data/spec/models/content_summary_spec.rb +1 -1
  114. data/spec/models/manifest_copy_spec.rb +1 -1
  115. data/spec/models/media_types_enum_spec.rb +1 -1
  116. data/spec/models/oci_build_image_spec.rb +1 -1
  117. data/spec/models/paginated_repository_version_response_list_spec.rb +1 -1
  118. data/spec/models/paginatedcontainer_blob_response_list_spec.rb +1 -1
  119. data/spec/models/paginatedcontainer_container_distribution_response_list_spec.rb +1 -1
  120. data/spec/models/paginatedcontainer_container_namespace_response_list_spec.rb +1 -1
  121. data/spec/models/paginatedcontainer_container_push_repository_response_list_spec.rb +1 -1
  122. data/spec/models/paginatedcontainer_container_remote_response_list_spec.rb +1 -1
  123. data/spec/models/paginatedcontainer_container_repository_response_list_spec.rb +1 -1
  124. data/spec/models/paginatedcontainer_content_redirect_content_guard_response_list_spec.rb +1 -1
  125. data/spec/models/paginatedcontainer_manifest_response_list_spec.rb +1 -1
  126. data/spec/models/paginatedcontainer_tag_response_list_spec.rb +1 -1
  127. data/spec/models/patchedcontainer_container_distribution_spec.rb +6 -6
  128. data/spec/models/patchedcontainer_container_push_repository_spec.rb +59 -0
  129. data/spec/models/patchedcontainer_container_remote_spec.rb +7 -1
  130. data/spec/models/patchedcontainer_container_repository_spec.rb +1 -1
  131. data/spec/models/patchedcontainer_content_redirect_content_guard_spec.rb +1 -1
  132. data/spec/models/policy_enum_spec.rb +1 -1
  133. data/spec/models/recursive_manage_spec.rb +1 -1
  134. data/spec/models/remove_image_spec.rb +1 -1
  135. data/spec/models/repository_sync_url_spec.rb +1 -1
  136. data/spec/models/repository_version_response_spec.rb +1 -1
  137. data/spec/models/repository_version_spec.rb +1 -1
  138. data/spec/models/tag_copy_spec.rb +1 -1
  139. data/spec/models/tag_image_spec.rb +1 -1
  140. data/spec/models/un_tag_image_spec.rb +1 -1
  141. data/spec/spec_helper.rb +1 -1
  142. metadata +51 -39
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.2.3
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -15,20 +15,20 @@ require 'date'
15
15
  module PulpContainerClient
16
16
  # A serializer for ContainerDistribution.
17
17
  class PatchedcontainerContainerDistribution
18
- # The latest RepositoryVersion for this Repository will be served.
19
- attr_accessor :repository
20
-
21
- attr_accessor :pulp_labels
22
-
23
18
  # A unique name. Ex, `rawhide` and `stable`.
24
19
  attr_accessor :name
25
20
 
21
+ # The latest RepositoryVersion for this Repository will be served.
22
+ attr_accessor :repository
23
+
26
24
  # An optional content-guard. If none is specified, a default one will be used.
27
25
  attr_accessor :content_guard
28
26
 
29
27
  # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
30
28
  attr_accessor :base_path
31
29
 
30
+ attr_accessor :pulp_labels
31
+
32
32
  # RepositoryVersion to be served
33
33
  attr_accessor :repository_version
34
34
 
@@ -41,11 +41,11 @@ module PulpContainerClient
41
41
  # Attribute mapping from ruby-style variable name to JSON key.
42
42
  def self.attribute_map
43
43
  {
44
- :'repository' => :'repository',
45
- :'pulp_labels' => :'pulp_labels',
46
44
  :'name' => :'name',
45
+ :'repository' => :'repository',
47
46
  :'content_guard' => :'content_guard',
48
47
  :'base_path' => :'base_path',
48
+ :'pulp_labels' => :'pulp_labels',
49
49
  :'repository_version' => :'repository_version',
50
50
  :'private' => :'private',
51
51
  :'description' => :'description'
@@ -55,11 +55,11 @@ module PulpContainerClient
55
55
  # Attribute type mapping.
56
56
  def self.openapi_types
57
57
  {
58
- :'repository' => :'String',
59
- :'pulp_labels' => :'Object',
60
58
  :'name' => :'String',
59
+ :'repository' => :'String',
61
60
  :'content_guard' => :'String',
62
61
  :'base_path' => :'String',
62
+ :'pulp_labels' => :'Object',
63
63
  :'repository_version' => :'String',
64
64
  :'private' => :'Boolean',
65
65
  :'description' => :'String'
@@ -90,18 +90,14 @@ module PulpContainerClient
90
90
  h[k.to_sym] = v
91
91
  }
92
92
 
93
- if attributes.key?(:'repository')
94
- self.repository = attributes[:'repository']
95
- end
96
-
97
- if attributes.key?(:'pulp_labels')
98
- self.pulp_labels = attributes[:'pulp_labels']
99
- end
100
-
101
93
  if attributes.key?(:'name')
102
94
  self.name = attributes[:'name']
103
95
  end
104
96
 
97
+ if attributes.key?(:'repository')
98
+ self.repository = attributes[:'repository']
99
+ end
100
+
105
101
  if attributes.key?(:'content_guard')
106
102
  self.content_guard = attributes[:'content_guard']
107
103
  end
@@ -110,6 +106,10 @@ module PulpContainerClient
110
106
  self.base_path = attributes[:'base_path']
111
107
  end
112
108
 
109
+ if attributes.key?(:'pulp_labels')
110
+ self.pulp_labels = attributes[:'pulp_labels']
111
+ end
112
+
113
113
  if attributes.key?(:'repository_version')
114
114
  self.repository_version = attributes[:'repository_version']
115
115
  end
@@ -141,11 +141,11 @@ module PulpContainerClient
141
141
  def ==(o)
142
142
  return true if self.equal?(o)
143
143
  self.class == o.class &&
144
- repository == o.repository &&
145
- pulp_labels == o.pulp_labels &&
146
144
  name == o.name &&
145
+ repository == o.repository &&
147
146
  content_guard == o.content_guard &&
148
147
  base_path == o.base_path &&
148
+ pulp_labels == o.pulp_labels &&
149
149
  repository_version == o.repository_version &&
150
150
  private == o.private &&
151
151
  description == o.description
@@ -160,7 +160,7 @@ module PulpContainerClient
160
160
  # Calculates hash code according to all attributes.
161
161
  # @return [Integer] Hash code
162
162
  def hash
163
- [repository, pulp_labels, name, content_guard, base_path, repository_version, private, description].hash
163
+ [name, repository, content_guard, base_path, pulp_labels, repository_version, private, description].hash
164
164
  end
165
165
 
166
166
  # Builds the object from hash
@@ -0,0 +1,254 @@
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 PulpContainerClient
16
+ # Serializer for Container Push Repositories.
17
+ class PatchedcontainerContainerPushRepository
18
+ # A unique name for this repository.
19
+ attr_accessor :name
20
+
21
+ # An optional description.
22
+ attr_accessor :description
23
+
24
+ # Retain X versions of the repository. Default is null which retains all versions. This is provided as a tech preview in Pulp 3 and may change in the future.
25
+ attr_accessor :retained_versions
26
+
27
+ attr_accessor :pulp_labels
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'name' => :'name',
33
+ :'description' => :'description',
34
+ :'retained_versions' => :'retained_versions',
35
+ :'pulp_labels' => :'pulp_labels'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'name' => :'String',
43
+ :'description' => :'String',
44
+ :'retained_versions' => :'Integer',
45
+ :'pulp_labels' => :'Object'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ :'description',
53
+ :'retained_versions',
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::PatchedcontainerContainerPushRepository` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::PatchedcontainerContainerPushRepository`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'name')
73
+ self.name = attributes[:'name']
74
+ end
75
+
76
+ if attributes.key?(:'description')
77
+ self.description = attributes[:'description']
78
+ end
79
+
80
+ if attributes.key?(:'retained_versions')
81
+ self.retained_versions = attributes[:'retained_versions']
82
+ end
83
+
84
+ if attributes.key?(:'pulp_labels')
85
+ self.pulp_labels = attributes[:'pulp_labels']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ if !@retained_versions.nil? && @retained_versions < 1
94
+ invalid_properties.push('invalid value for "retained_versions", must be greater than or equal to 1.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if !@retained_versions.nil? && @retained_versions < 1
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] retained_versions Value to be assigned
109
+ def retained_versions=(retained_versions)
110
+ if !retained_versions.nil? && retained_versions < 1
111
+ fail ArgumentError, 'invalid value for "retained_versions", must be greater than or equal to 1.'
112
+ end
113
+
114
+ @retained_versions = retained_versions
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ name == o.name &&
123
+ description == o.description &&
124
+ retained_versions == o.retained_versions &&
125
+ pulp_labels == o.pulp_labels
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [name, description, retained_versions, pulp_labels].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ new.build_from_hash(attributes)
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.openapi_types.each_pair do |key, type|
153
+ if type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
157
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ end
159
+ elsif !attributes[self.class.attribute_map[key]].nil?
160
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :Boolean
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ PulpContainerClient.const_get(type).build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+ end
254
+ end