pulp_container_client 2.0.0b2 → 2.0.0b3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -20
  3. data/docs/{ContainerBlobRead.md → ContainerBlob.md} +2 -2
  4. data/docs/ContainerContainerDistribution.md +8 -8
  5. data/docs/{ContainerContainerRepositoryRead.md → ContainerContainerPushRepository.md} +2 -2
  6. data/docs/ContainerContentRedirectContentGuard.md +23 -0
  7. data/docs/{ContainerManifestRead.md → ContainerManifest.md} +2 -2
  8. data/docs/{ContainerTagRead.md → ContainerTag.md} +2 -2
  9. data/docs/ContentBlobsApi.md +2 -2
  10. data/docs/ContentManifestsApi.md +2 -2
  11. data/docs/ContentTagsApi.md +2 -2
  12. data/docs/ContentguardsContentRedirectApi.md +355 -0
  13. data/docs/DistributionsContainerApi.md +4 -4
  14. data/docs/InlineResponse200.md +1 -1
  15. data/docs/InlineResponse2001.md +1 -1
  16. data/docs/InlineResponse2002.md +1 -1
  17. data/docs/InlineResponse2003.md +1 -1
  18. data/docs/InlineResponse2004.md +1 -1
  19. data/docs/InlineResponse2005.md +1 -1
  20. data/docs/InlineResponse2006.md +1 -1
  21. data/docs/InlineResponse2007.md +23 -0
  22. data/docs/InlineResponse2008.md +23 -0
  23. data/docs/RemotesContainerApi.md +6 -6
  24. data/docs/RepositoriesContainerApi.md +6 -6
  25. data/docs/RepositoriesContainerPushApi.md +356 -0
  26. data/docs/RepositoriesContainerVersionsApi.md +285 -20
  27. data/docs/{V2Api.md → TokenApi.md} +5 -5
  28. data/lib/pulp_container_client.rb +10 -12
  29. data/lib/pulp_container_client/api/content_blobs_api.rb +3 -3
  30. data/lib/pulp_container_client/api/content_manifests_api.rb +3 -3
  31. data/lib/pulp_container_client/api/content_tags_api.rb +3 -3
  32. data/lib/pulp_container_client/api/contentguards_content_redirect_api.rb +431 -0
  33. data/lib/pulp_container_client/api/distributions_container_api.rb +6 -6
  34. data/lib/pulp_container_client/api/remotes_container_api.rb +9 -9
  35. data/lib/pulp_container_client/api/repositories_container_api.rb +9 -9
  36. data/lib/pulp_container_client/api/repositories_container_push_api.rb +433 -0
  37. data/lib/pulp_container_client/api/repositories_container_versions_api.rb +354 -34
  38. data/lib/pulp_container_client/api/{v2_api.rb → token_api.rb} +6 -6
  39. data/lib/pulp_container_client/models/{container_blob_read.rb → container_blob.rb} +3 -3
  40. data/lib/pulp_container_client/models/container_container_distribution.rb +60 -61
  41. data/lib/pulp_container_client/models/{container_container_repository_read.rb → container_container_push_repository.rb} +3 -3
  42. data/lib/pulp_container_client/models/container_content_redirect_content_guard.rb +276 -0
  43. data/lib/pulp_container_client/models/{container_manifest_read.rb → container_manifest.rb} +3 -3
  44. data/lib/pulp_container_client/models/{container_tag_read.rb → container_tag.rb} +3 -3
  45. data/lib/pulp_container_client/models/inline_response200.rb +1 -1
  46. data/lib/pulp_container_client/models/inline_response2001.rb +1 -1
  47. data/lib/pulp_container_client/models/inline_response2002.rb +1 -1
  48. data/lib/pulp_container_client/models/inline_response2003.rb +1 -1
  49. data/lib/pulp_container_client/models/inline_response2004.rb +1 -1
  50. data/lib/pulp_container_client/models/inline_response2005.rb +1 -1
  51. data/lib/pulp_container_client/models/inline_response2006.rb +1 -1
  52. data/lib/pulp_container_client/models/{repository_version_read.rb → inline_response2007.rb} +42 -39
  53. data/lib/pulp_container_client/models/inline_response2008.rb +247 -0
  54. data/lib/pulp_container_client/version.rb +1 -1
  55. data/spec/api/content_blobs_api_spec.rb +1 -1
  56. data/spec/api/content_manifests_api_spec.rb +1 -1
  57. data/spec/api/content_tags_api_spec.rb +1 -1
  58. data/spec/api/contentguards_content_redirect_api_spec.rb +117 -0
  59. data/spec/api/distributions_container_api_spec.rb +2 -2
  60. data/spec/api/remotes_container_api_spec.rb +3 -3
  61. data/spec/api/repositories_container_api_spec.rb +3 -3
  62. data/spec/api/repositories_container_push_api_spec.rb +117 -0
  63. data/spec/api/repositories_container_versions_api_spec.rb +77 -7
  64. data/spec/api/{v2_api_spec.rb → token_api_spec.rb} +7 -7
  65. data/spec/models/{container_blob_read_spec.rb → container_blob_spec.rb} +6 -6
  66. data/spec/models/container_container_distribution_spec.rb +7 -7
  67. data/spec/models/{container_container_repository_read_spec.rb → container_container_push_repository_spec.rb} +6 -6
  68. data/spec/models/{repository_version_read_spec.rb → container_content_redirect_content_guard_spec.rb} +8 -14
  69. data/spec/models/{container_manifest_read_spec.rb → container_manifest_spec.rb} +6 -6
  70. data/spec/models/{container_tag_read_spec.rb → container_tag_spec.rb} +6 -6
  71. data/spec/models/inline_response2007_spec.rb +59 -0
  72. data/spec/models/inline_response2008_spec.rb +59 -0
  73. metadata +42 -50
  74. data/docs/ContainerContainerDistributionRead.md +0 -31
  75. data/docs/ContainerContainerRemoteRead.md +0 -47
  76. data/docs/RepositoryVersionRead.md +0 -25
  77. data/docs/V2BlobsApi.md +0 -63
  78. data/docs/V2CatalogApi.md +0 -64
  79. data/docs/V2ListApi.md +0 -66
  80. data/docs/V2UploadsApi.md +0 -61
  81. data/lib/pulp_container_client/api/v2_blobs_api.rb +0 -88
  82. data/lib/pulp_container_client/api/v2_catalog_api.rb +0 -80
  83. data/lib/pulp_container_client/api/v2_list_api.rb +0 -86
  84. data/lib/pulp_container_client/api/v2_uploads_api.rb +0 -82
  85. data/lib/pulp_container_client/models/container_container_distribution_read.rb +0 -342
  86. data/lib/pulp_container_client/models/container_container_remote_read.rb +0 -578
  87. data/spec/api/v2_blobs_api_spec.rb +0 -48
  88. data/spec/api/v2_catalog_api_spec.rb +0 -47
  89. data/spec/api/v2_list_api_spec.rb +0 -48
  90. data/spec/api/v2_uploads_api_spec.rb +0 -47
  91. data/spec/models/container_container_distribution_read_spec.rb +0 -83
  92. data/spec/models/container_container_remote_read_spec.rb +0 -135
@@ -1,80 +0,0 @@
1
- =begin
2
- #Pulp 3 API
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: v3
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module PulpContainerClient
16
- class V2CatalogApi
17
- attr_accessor :api_client
18
-
19
- def initialize(api_client = ApiClient.default)
20
- @api_client = api_client
21
- end
22
- # Handles GET requests for the /v2/_catalog endpoint.
23
- # @param [Hash] opts the optional parameters
24
- # @option opts [String] :fields A list of fields to include in the response.
25
- # @option opts [String] :exclude_fields A list of fields to exclude from the response.
26
- # @return [nil]
27
- def list(opts = {})
28
- list_with_http_info(opts)
29
- nil
30
- end
31
-
32
- # Handles GET requests for the /v2/_catalog endpoint.
33
- # @param [Hash] opts the optional parameters
34
- # @option opts [String] :fields A list of fields to include in the response.
35
- # @option opts [String] :exclude_fields A list of fields to exclude from the response.
36
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
37
- def list_with_http_info(opts = {})
38
- if @api_client.config.debugging
39
- @api_client.config.logger.debug 'Calling API: V2CatalogApi.list ...'
40
- end
41
- # resource path
42
- local_var_path = '/v2/_catalog'
43
-
44
- # query parameters
45
- query_params = opts[:query_params] || {}
46
- query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
47
- query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].nil?
48
-
49
- # header parameters
50
- header_params = opts[:header_params] || {}
51
-
52
- # form parameters
53
- form_params = opts[:form_params] || {}
54
-
55
- # http body (model)
56
- post_body = opts[:body]
57
-
58
- # return_type
59
- return_type = opts[:return_type]
60
-
61
- # auth_names
62
- auth_names = opts[:auth_names] || ['Basic']
63
-
64
- new_options = opts.merge(
65
- :header_params => header_params,
66
- :query_params => query_params,
67
- :form_params => form_params,
68
- :body => post_body,
69
- :auth_names => auth_names,
70
- :return_type => return_type
71
- )
72
-
73
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
74
- if @api_client.config.debugging
75
- @api_client.config.logger.debug "API called: V2CatalogApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
- end
77
- return data, status_code, headers
78
- end
79
- end
80
- end
@@ -1,86 +0,0 @@
1
- =begin
2
- #Pulp 3 API
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: v3
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module PulpContainerClient
16
- class V2ListApi
17
- attr_accessor :api_client
18
-
19
- def initialize(api_client = ApiClient.default)
20
- @api_client = api_client
21
- end
22
- # Handles GET requests to the /v2//tags/list endpoint
23
- # @param path [String]
24
- # @param [Hash] opts the optional parameters
25
- # @option opts [String] :fields A list of fields to include in the response.
26
- # @option opts [String] :exclude_fields A list of fields to exclude from the response.
27
- # @return [nil]
28
- def list(path, opts = {})
29
- list_with_http_info(path, opts)
30
- nil
31
- end
32
-
33
- # Handles GET requests to the /v2//tags/list endpoint
34
- # @param path [String]
35
- # @param [Hash] opts the optional parameters
36
- # @option opts [String] :fields A list of fields to include in the response.
37
- # @option opts [String] :exclude_fields A list of fields to exclude from the response.
38
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
39
- def list_with_http_info(path, opts = {})
40
- if @api_client.config.debugging
41
- @api_client.config.logger.debug 'Calling API: V2ListApi.list ...'
42
- end
43
- # verify the required parameter 'path' is set
44
- if @api_client.config.client_side_validation && path.nil?
45
- fail ArgumentError, "Missing the required parameter 'path' when calling V2ListApi.list"
46
- end
47
- # resource path
48
- local_var_path = '/v2/{path}/tags/list'.sub('{' + 'path' + '}', CGI.escape(path.to_s).gsub('%2F', '/'))
49
-
50
- # query parameters
51
- query_params = opts[:query_params] || {}
52
- query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
53
- query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].nil?
54
-
55
- # header parameters
56
- header_params = opts[:header_params] || {}
57
-
58
- # form parameters
59
- form_params = opts[:form_params] || {}
60
-
61
- # http body (model)
62
- post_body = opts[:body]
63
-
64
- # return_type
65
- return_type = opts[:return_type]
66
-
67
- # auth_names
68
- auth_names = opts[:auth_names] || ['Basic']
69
-
70
- new_options = opts.merge(
71
- :header_params => header_params,
72
- :query_params => query_params,
73
- :form_params => form_params,
74
- :body => post_body,
75
- :auth_names => auth_names,
76
- :return_type => return_type
77
- )
78
-
79
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
80
- if @api_client.config.debugging
81
- @api_client.config.logger.debug "API called: V2ListApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
- end
83
- return data, status_code, headers
84
- end
85
- end
86
- end
@@ -1,82 +0,0 @@
1
- =begin
2
- #Pulp 3 API
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: v3
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module PulpContainerClient
16
- class V2UploadsApi
17
- attr_accessor :api_client
18
-
19
- def initialize(api_client = ApiClient.default)
20
- @api_client = api_client
21
- end
22
- # Create an upload
23
- # This methods handles the creation of an upload.
24
- # @param path [String]
25
- # @param [Hash] opts the optional parameters
26
- # @return [nil]
27
- def create(path, opts = {})
28
- create_with_http_info(path, opts)
29
- nil
30
- end
31
-
32
- # Create an upload
33
- # This methods handles the creation of an upload.
34
- # @param path [String]
35
- # @param [Hash] opts the optional parameters
36
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
37
- def create_with_http_info(path, opts = {})
38
- if @api_client.config.debugging
39
- @api_client.config.logger.debug 'Calling API: V2UploadsApi.create ...'
40
- end
41
- # verify the required parameter 'path' is set
42
- if @api_client.config.client_side_validation && path.nil?
43
- fail ArgumentError, "Missing the required parameter 'path' when calling V2UploadsApi.create"
44
- end
45
- # resource path
46
- local_var_path = '/v2/{path}/blobs/uploads/'.sub('{' + 'path' + '}', CGI.escape(path.to_s).gsub('%2F', '/'))
47
-
48
- # query parameters
49
- query_params = opts[:query_params] || {}
50
-
51
- # header parameters
52
- header_params = opts[:header_params] || {}
53
-
54
- # form parameters
55
- form_params = opts[:form_params] || {}
56
-
57
- # http body (model)
58
- post_body = opts[:body]
59
-
60
- # return_type
61
- return_type = opts[:return_type]
62
-
63
- # auth_names
64
- auth_names = opts[:auth_names] || ['Basic']
65
-
66
- new_options = opts.merge(
67
- :header_params => header_params,
68
- :query_params => query_params,
69
- :form_params => form_params,
70
- :body => post_body,
71
- :auth_names => auth_names,
72
- :return_type => return_type
73
- )
74
-
75
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
76
- if @api_client.config.debugging
77
- @api_client.config.logger.debug "API called: V2UploadsApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
- end
79
- return data, status_code, headers
80
- end
81
- end
82
- end
@@ -1,342 +0,0 @@
1
- =begin
2
- #Pulp 3 API
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: v3
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module PulpContainerClient
16
- class ContainerContainerDistributionRead
17
- # RepositoryVersion to be served
18
- attr_accessor :repository_version
19
-
20
- # An optional content-guard.
21
- attr_accessor :content_guard
22
-
23
- # The base (relative) path component of the published url. Avoid paths that overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")
24
- attr_accessor :base_path
25
-
26
- # The latest RepositoryVersion for this Repository will be served.
27
- attr_accessor :repository
28
-
29
- # Timestamp of creation.
30
- attr_accessor :pulp_created
31
-
32
- # A unique name. Ex, `rawhide` and `stable`.
33
- attr_accessor :name
34
-
35
- attr_accessor :pulp_href
36
-
37
- # The Registry hostame/name/ to use with docker pull command defined by this distribution.
38
- attr_accessor :registry_path
39
-
40
- # Attribute mapping from ruby-style variable name to JSON key.
41
- def self.attribute_map
42
- {
43
- :'repository_version' => :'repository_version',
44
- :'content_guard' => :'content_guard',
45
- :'base_path' => :'base_path',
46
- :'repository' => :'repository',
47
- :'pulp_created' => :'pulp_created',
48
- :'name' => :'name',
49
- :'pulp_href' => :'pulp_href',
50
- :'registry_path' => :'registry_path'
51
- }
52
- end
53
-
54
- # Attribute type mapping.
55
- def self.openapi_types
56
- {
57
- :'repository_version' => :'String',
58
- :'content_guard' => :'String',
59
- :'base_path' => :'String',
60
- :'repository' => :'String',
61
- :'pulp_created' => :'DateTime',
62
- :'name' => :'String',
63
- :'pulp_href' => :'String',
64
- :'registry_path' => :'String'
65
- }
66
- end
67
-
68
- # List of attributes with nullable: true
69
- def self.openapi_nullable
70
- Set.new([
71
- :'repository_version',
72
- :'content_guard',
73
- :'repository',
74
- ])
75
- end
76
-
77
- # Initializes the object
78
- # @param [Hash] attributes Model attributes in the form of hash
79
- def initialize(attributes = {})
80
- if (!attributes.is_a?(Hash))
81
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpContainerClient::ContainerContainerDistributionRead` initialize method"
82
- end
83
-
84
- # check to see if the attribute exists and convert string to symbol for hash key
85
- attributes = attributes.each_with_object({}) { |(k, v), h|
86
- if (!self.class.attribute_map.key?(k.to_sym))
87
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpContainerClient::ContainerContainerDistributionRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
- end
89
- h[k.to_sym] = v
90
- }
91
-
92
- if attributes.key?(:'repository_version')
93
- self.repository_version = attributes[:'repository_version']
94
- end
95
-
96
- if attributes.key?(:'content_guard')
97
- self.content_guard = attributes[:'content_guard']
98
- end
99
-
100
- if attributes.key?(:'base_path')
101
- self.base_path = attributes[:'base_path']
102
- end
103
-
104
- if attributes.key?(:'repository')
105
- self.repository = attributes[:'repository']
106
- end
107
-
108
- if attributes.key?(:'pulp_created')
109
- self.pulp_created = attributes[:'pulp_created']
110
- end
111
-
112
- if attributes.key?(:'name')
113
- self.name = attributes[:'name']
114
- end
115
-
116
- if attributes.key?(:'pulp_href')
117
- self.pulp_href = attributes[:'pulp_href']
118
- end
119
-
120
- if attributes.key?(:'registry_path')
121
- self.registry_path = attributes[:'registry_path']
122
- end
123
- end
124
-
125
- # Show invalid properties with the reasons. Usually used together with valid?
126
- # @return Array for valid properties with the reasons
127
- def list_invalid_properties
128
- invalid_properties = Array.new
129
- if @base_path.nil?
130
- invalid_properties.push('invalid value for "base_path", base_path cannot be nil.')
131
- end
132
-
133
- if @base_path.to_s.length < 1
134
- invalid_properties.push('invalid value for "base_path", the character length must be great than or equal to 1.')
135
- end
136
-
137
- if @name.nil?
138
- invalid_properties.push('invalid value for "name", name cannot be nil.')
139
- end
140
-
141
- if @name.to_s.length < 1
142
- invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
143
- end
144
-
145
- if !@registry_path.nil? && @registry_path.to_s.length < 1
146
- invalid_properties.push('invalid value for "registry_path", the character length must be great than or equal to 1.')
147
- end
148
-
149
- invalid_properties
150
- end
151
-
152
- # Check to see if the all the properties in the model are valid
153
- # @return true if the model is valid
154
- def valid?
155
- return false if @base_path.nil?
156
- return false if @base_path.to_s.length < 1
157
- return false if @name.nil?
158
- return false if @name.to_s.length < 1
159
- return false if !@registry_path.nil? && @registry_path.to_s.length < 1
160
- true
161
- end
162
-
163
- # Custom attribute writer method with validation
164
- # @param [Object] base_path Value to be assigned
165
- def base_path=(base_path)
166
- if base_path.nil?
167
- fail ArgumentError, 'base_path cannot be nil'
168
- end
169
-
170
- if base_path.to_s.length < 1
171
- fail ArgumentError, 'invalid value for "base_path", the character length must be great than or equal to 1.'
172
- end
173
-
174
- @base_path = base_path
175
- end
176
-
177
- # Custom attribute writer method with validation
178
- # @param [Object] name Value to be assigned
179
- def name=(name)
180
- if name.nil?
181
- fail ArgumentError, 'name cannot be nil'
182
- end
183
-
184
- if name.to_s.length < 1
185
- fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
186
- end
187
-
188
- @name = name
189
- end
190
-
191
- # Custom attribute writer method with validation
192
- # @param [Object] registry_path Value to be assigned
193
- def registry_path=(registry_path)
194
- if !registry_path.nil? && registry_path.to_s.length < 1
195
- fail ArgumentError, 'invalid value for "registry_path", the character length must be great than or equal to 1.'
196
- end
197
-
198
- @registry_path = registry_path
199
- end
200
-
201
- # Checks equality by comparing each attribute.
202
- # @param [Object] Object to be compared
203
- def ==(o)
204
- return true if self.equal?(o)
205
- self.class == o.class &&
206
- repository_version == o.repository_version &&
207
- content_guard == o.content_guard &&
208
- base_path == o.base_path &&
209
- repository == o.repository &&
210
- pulp_created == o.pulp_created &&
211
- name == o.name &&
212
- pulp_href == o.pulp_href &&
213
- registry_path == o.registry_path
214
- end
215
-
216
- # @see the `==` method
217
- # @param [Object] Object to be compared
218
- def eql?(o)
219
- self == o
220
- end
221
-
222
- # Calculates hash code according to all attributes.
223
- # @return [Integer] Hash code
224
- def hash
225
- [repository_version, content_guard, base_path, repository, pulp_created, name, pulp_href, registry_path].hash
226
- end
227
-
228
- # Builds the object from hash
229
- # @param [Hash] attributes Model attributes in the form of hash
230
- # @return [Object] Returns the model itself
231
- def self.build_from_hash(attributes)
232
- new.build_from_hash(attributes)
233
- end
234
-
235
- # Builds the object from hash
236
- # @param [Hash] attributes Model attributes in the form of hash
237
- # @return [Object] Returns the model itself
238
- def build_from_hash(attributes)
239
- return nil unless attributes.is_a?(Hash)
240
- self.class.openapi_types.each_pair do |key, type|
241
- if type =~ /\AArray<(.*)>/i
242
- # check to ensure the input is an array given that the attribute
243
- # is documented as an array but the input is not
244
- if attributes[self.class.attribute_map[key]].is_a?(Array)
245
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
246
- end
247
- elsif !attributes[self.class.attribute_map[key]].nil?
248
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
249
- end # or else data not found in attributes(hash), not an issue as the data can be optional
250
- end
251
-
252
- self
253
- end
254
-
255
- # Deserializes the data based on type
256
- # @param string type Data type
257
- # @param string value Value to be deserialized
258
- # @return [Object] Deserialized data
259
- def _deserialize(type, value)
260
- case type.to_sym
261
- when :DateTime
262
- DateTime.parse(value)
263
- when :Date
264
- Date.parse(value)
265
- when :String
266
- value.to_s
267
- when :Integer
268
- value.to_i
269
- when :Float
270
- value.to_f
271
- when :Boolean
272
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
273
- true
274
- else
275
- false
276
- end
277
- when :Object
278
- # generic object (usually a Hash), return directly
279
- value
280
- when /\AArray<(?<inner_type>.+)>\z/
281
- inner_type = Regexp.last_match[:inner_type]
282
- value.map { |v| _deserialize(inner_type, v) }
283
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
284
- k_type = Regexp.last_match[:k_type]
285
- v_type = Regexp.last_match[:v_type]
286
- {}.tap do |hash|
287
- value.each do |k, v|
288
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
289
- end
290
- end
291
- else # model
292
- PulpContainerClient.const_get(type).build_from_hash(value)
293
- end
294
- end
295
-
296
- # Returns the string representation of the object
297
- # @return [String] String presentation of the object
298
- def to_s
299
- to_hash.to_s
300
- end
301
-
302
- # to_body is an alias to to_hash (backward compatibility)
303
- # @return [Hash] Returns the object in the form of hash
304
- def to_body
305
- to_hash
306
- end
307
-
308
- # Returns the object in the form of hash
309
- # @return [Hash] Returns the object in the form of hash
310
- def to_hash
311
- hash = {}
312
- self.class.attribute_map.each_pair do |attr, param|
313
- value = self.send(attr)
314
- if value.nil?
315
- is_nullable = self.class.openapi_nullable.include?(attr)
316
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
317
- end
318
-
319
- hash[param] = _to_hash(value)
320
- end
321
- hash
322
- end
323
-
324
- # Outputs non-array value in the form of hash
325
- # For object, use to_hash. Otherwise, just return the value
326
- # @param [Object] value Any valid value
327
- # @return [Hash] Returns the value in the form of hash
328
- def _to_hash(value)
329
- if value.is_a?(Array)
330
- value.compact.map { |v| _to_hash(v) }
331
- elsif value.is_a?(Hash)
332
- {}.tap do |hash|
333
- value.each { |k, v| hash[k] = _to_hash(v) }
334
- end
335
- elsif value.respond_to? :to_hash
336
- value.to_hash
337
- else
338
- value
339
- end
340
- end
341
- end
342
- end