pulp_maven_client 0.33.2 → 0.34.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cddbc97c0dc3ef9735f53036b1c1af7a70564f713472908aaf66b98579831e4f
4
- data.tar.gz: c0ecd2830aafc29383b69e0480d3d02ce0dc8a8c9c2df646753fe6537bf0093b
3
+ metadata.gz: 2c8209c7c15123e15c72e3ddedfbe54c84808dc8fecb47db6fb63ec42d755f7c
4
+ data.tar.gz: 314b128a60f41891746a8b0faa17a2b883b9bc0a4fe6098ff4eece710d020575
5
5
  SHA512:
6
- metadata.gz: 4dc286543fa68a468bdfec4c04c06250321a645a3ad074a3dcad45e5fee726cb4941b0d149b247c737cdb24d403b79fb68c24ee91241785597fef70eb611dac5
7
- data.tar.gz: 33a6dcd8c9bf852fab41d7ff7592e0d1c58c44f311bb9883abe33fd84ff354fea606e3d251f92daf77dc62b0244205f54f8dea6be0bbf601114cb398fffaf7ab
6
+ metadata.gz: ae612690d1d1c9a4a84a92aada9ea430f6b33160ff75f156b29f97991d053c1b4f79d7ed28484e196677ad83071911782b0797932971325c2a2a18769b1974ff
7
+ data.tar.gz: 80d3cdb9f6160eebe998f0a6d789c40de3ec13965d2dc4c73fa5bcd9423bda81f54bf9b22000aba77130df8df7cecce7cd603559940f3c0f6f514880b562b227
data/README.md CHANGED
@@ -7,7 +7,7 @@ Fetch, Upload, Organize, and Distribute Software Packages
7
7
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
8
 
9
9
  - API version: v3
10
- - Package version: 0.33.2
10
+ - Package version: 0.34.0
11
11
  - Generator version: 7.10.0
12
12
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
13
13
  For more information, please visit [https://pulpproject.org](https://pulpproject.org)
@@ -25,16 +25,16 @@ gem build pulp_maven_client.gemspec
25
25
  Then either install the gem locally:
26
26
 
27
27
  ```shell
28
- gem install ./pulp_maven_client-0.33.2.gem
28
+ gem install ./pulp_maven_client-0.34.0.gem
29
29
  ```
30
30
 
31
- (for development, run `gem install --dev ./pulp_maven_client-0.33.2.gem` to install the development dependencies)
31
+ (for development, run `gem install --dev ./pulp_maven_client-0.34.0.gem` to install the development dependencies)
32
32
 
33
33
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
34
34
 
35
35
  Finally add this to the Gemfile:
36
36
 
37
- gem 'pulp_maven_client', '~> 0.33.2'
37
+ gem 'pulp_maven_client', '~> 0.34.0'
38
38
 
39
39
  ### Install from Git
40
40
 
@@ -154,6 +154,7 @@ Class | Method | HTTP request | Description
154
154
  *PulpMavenClient::RepositoriesMavenApi* | [**modify**](docs/RepositoriesMavenApi.md#modify) | **POST** {maven_maven_repository_href}modify/ | Modify Repository Content
155
155
  *PulpMavenClient::RepositoriesMavenApi* | [**my_permissions**](docs/RepositoriesMavenApi.md#my_permissions) | **GET** {maven_maven_repository_href}my_permissions/ | List user permissions
156
156
  *PulpMavenClient::RepositoriesMavenApi* | [**packages**](docs/RepositoriesMavenApi.md#packages) | **GET** {maven_maven_repository_href}packages/ | List packages
157
+ *PulpMavenClient::RepositoriesMavenApi* | [**packages_flat**](docs/RepositoriesMavenApi.md#packages_flat) | **GET** {maven_maven_repository_href}packages/flat/ | List packages (flat)
157
158
  *PulpMavenClient::RepositoriesMavenApi* | [**partial_update**](docs/RepositoriesMavenApi.md#partial_update) | **PATCH** {maven_maven_repository_href} | Update a maven repository
158
159
  *PulpMavenClient::RepositoriesMavenApi* | [**path_index_status**](docs/RepositoriesMavenApi.md#path_index_status) | **GET** {maven_maven_repository_href}path_index_status/ |
159
160
  *PulpMavenClient::RepositoriesMavenApi* | [**read**](docs/RepositoriesMavenApi.md#read) | **GET** {maven_maven_repository_href} | Inspect a maven repository
@@ -184,14 +185,17 @@ Class | Method | HTTP request | Description
184
185
  - [PulpMavenClient::MavenMavenRemoteResponseHiddenFieldsInner](docs/MavenMavenRemoteResponseHiddenFieldsInner.md)
185
186
  - [PulpMavenClient::MavenMavenRepository](docs/MavenMavenRepository.md)
186
187
  - [PulpMavenClient::MavenMavenRepositoryResponse](docs/MavenMavenRepositoryResponse.md)
188
+ - [PulpMavenClient::MavenPackageLicenseResponse](docs/MavenPackageLicenseResponse.md)
187
189
  - [PulpMavenClient::MavenPackageReleaseResponse](docs/MavenPackageReleaseResponse.md)
188
190
  - [PulpMavenClient::MavenPathIndexStatusResponse](docs/MavenPathIndexStatusResponse.md)
191
+ - [PulpMavenClient::MavenRepositoryFlatPackageResponse](docs/MavenRepositoryFlatPackageResponse.md)
189
192
  - [PulpMavenClient::MavenRepositoryMetricsResponse](docs/MavenRepositoryMetricsResponse.md)
190
193
  - [PulpMavenClient::MavenRepositoryPackageResponse](docs/MavenRepositoryPackageResponse.md)
191
194
  - [PulpMavenClient::MyPermissionsResponse](docs/MyPermissionsResponse.md)
192
195
  - [PulpMavenClient::NestedRole](docs/NestedRole.md)
193
196
  - [PulpMavenClient::NestedRoleResponse](docs/NestedRoleResponse.md)
194
197
  - [PulpMavenClient::ObjectRolesResponse](docs/ObjectRolesResponse.md)
198
+ - [PulpMavenClient::PaginatedMavenRepositoryFlatPackageListResponse](docs/PaginatedMavenRepositoryFlatPackageListResponse.md)
195
199
  - [PulpMavenClient::PaginatedMavenRepositoryPackageListResponse](docs/PaginatedMavenRepositoryPackageListResponse.md)
196
200
  - [PulpMavenClient::PaginatedRepositoryVersionResponseList](docs/PaginatedRepositoryVersionResponseList.md)
197
201
  - [PulpMavenClient::PaginatedmavenMavenArtifactResponseList](docs/PaginatedmavenMavenArtifactResponseList.md)
@@ -0,0 +1,20 @@
1
+ # PulpMavenClient::MavenPackageLicenseResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | License name from the POM. Empty when the POM omitted it. | |
8
+ | **url** | **String** | License URL from the POM. Empty when the POM omitted it. | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'pulp_maven_client'
14
+
15
+ instance = PulpMavenClient::MavenPackageLicenseResponse.new(
16
+ name: null,
17
+ url: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,28 @@
1
+ # PulpMavenClient::MavenRepositoryFlatPackageResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **group_id** | **String** | Maven groupId. | |
8
+ | **artifact_id** | **String** | Maven artifactId. | |
9
+ | **version** | **String** | Version stored on the MavenPackage, including any rebuild suffix. | |
10
+ | **last_updated** | **Time** | When this GAV entered the repository version: RepositoryContent.pulp_created, falling back to the content unit's pulp_created. | |
11
+ | **description** | **String** | Description from the POM. Empty when the POM has none. | |
12
+ | **licenses** | [**Array<MavenPackageLicenseResponse>**](MavenPackageLicenseResponse.md) | Licenses from the POM. Empty when the POM has none. | |
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'pulp_maven_client'
18
+
19
+ instance = PulpMavenClient::MavenRepositoryFlatPackageResponse.new(
20
+ group_id: null,
21
+ artifact_id: null,
22
+ version: null,
23
+ last_updated: null,
24
+ description: null,
25
+ licenses: null
26
+ )
27
+ ```
28
+
@@ -0,0 +1,24 @@
1
+ # PulpMavenClient::PaginatedMavenRepositoryFlatPackageListResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **count** | **Integer** | | |
8
+ | **_next** | **String** | | |
9
+ | **previous** | **String** | | |
10
+ | **results** | [**Array<MavenRepositoryFlatPackageResponse>**](MavenRepositoryFlatPackageResponse.md) | | |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'pulp_maven_client'
16
+
17
+ instance = PulpMavenClient::PaginatedMavenRepositoryFlatPackageListResponse.new(
18
+ count: null,
19
+ _next: null,
20
+ previous: null,
21
+ results: null
22
+ )
23
+ ```
24
+
@@ -15,6 +15,7 @@ All URIs are relative to *http://localhost:24817*
15
15
  | [**modify**](RepositoriesMavenApi.md#modify) | **POST** {maven_maven_repository_href}modify/ | Modify Repository Content |
16
16
  | [**my_permissions**](RepositoriesMavenApi.md#my_permissions) | **GET** {maven_maven_repository_href}my_permissions/ | List user permissions |
17
17
  | [**packages**](RepositoriesMavenApi.md#packages) | **GET** {maven_maven_repository_href}packages/ | List packages |
18
+ | [**packages_flat**](RepositoriesMavenApi.md#packages_flat) | **GET** {maven_maven_repository_href}packages/flat/ | List packages (flat) |
18
19
  | [**partial_update**](RepositoriesMavenApi.md#partial_update) | **PATCH** {maven_maven_repository_href} | Update a maven repository |
19
20
  | [**path_index_status**](RepositoriesMavenApi.md#path_index_status) | **GET** {maven_maven_repository_href}path_index_status/ | |
20
21
  | [**read**](RepositoriesMavenApi.md#read) | **GET** {maven_maven_repository_href} | Inspect a maven repository |
@@ -952,6 +953,86 @@ end
952
953
  - **Accept**: application/json
953
954
 
954
955
 
956
+ ## packages_flat
957
+
958
+ > <PaginatedMavenRepositoryFlatPackageListResponse> packages_flat(maven_maven_repository_href, opts)
959
+
960
+ List packages (flat)
961
+
962
+ Return one MavenPackage row per stored GAV in a repository version (latest complete version if repository_version is omitted). version is the stored string, so rebuilds are separate rows. Pagination count is the number of GAVs. description is an empty string when the POM has none. licenses is an empty list when the POM has none. Ordered by group_id, artifact_id, version in byte order.
963
+
964
+ ### Examples
965
+
966
+ ```ruby
967
+ require 'time'
968
+ require 'pulp_maven_client'
969
+ # setup authorization
970
+ PulpMavenClient.configure do |config|
971
+ # Configure HTTP basic authorization: basicAuth
972
+ config.username = 'YOUR USERNAME'
973
+ config.password = 'YOUR PASSWORD'
974
+ end
975
+
976
+ api_instance = PulpMavenClient::RepositoriesMavenApi.new
977
+ maven_maven_repository_href = 'maven_maven_repository_href_example' # String |
978
+ opts = {
979
+ x_task_diagnostics: ['inner_example'], # Array<String> | List of profilers to use on tasks.
980
+ repository_version: 'repository_version_example', # String | HREF or PRN of a version of this repository. Defaults to the latest complete version.
981
+ fields: ['inner_example'], # Array<String> | A list of fields to include in the response.
982
+ exclude_fields: ['inner_example'] # Array<String> | A list of fields to exclude from the response.
983
+ }
984
+
985
+ begin
986
+ # List packages (flat)
987
+ result = api_instance.packages_flat(maven_maven_repository_href, opts)
988
+ p result
989
+ rescue PulpMavenClient::ApiError => e
990
+ puts "Error when calling RepositoriesMavenApi->packages_flat: #{e}"
991
+ end
992
+ ```
993
+
994
+ #### Using the packages_flat_with_http_info variant
995
+
996
+ This returns an Array which contains the response data, status code and headers.
997
+
998
+ > <Array(<PaginatedMavenRepositoryFlatPackageListResponse>, Integer, Hash)> packages_flat_with_http_info(maven_maven_repository_href, opts)
999
+
1000
+ ```ruby
1001
+ begin
1002
+ # List packages (flat)
1003
+ data, status_code, headers = api_instance.packages_flat_with_http_info(maven_maven_repository_href, opts)
1004
+ p status_code # => 2xx
1005
+ p headers # => { ... }
1006
+ p data # => <PaginatedMavenRepositoryFlatPackageListResponse>
1007
+ rescue PulpMavenClient::ApiError => e
1008
+ puts "Error when calling RepositoriesMavenApi->packages_flat_with_http_info: #{e}"
1009
+ end
1010
+ ```
1011
+
1012
+ ### Parameters
1013
+
1014
+ | Name | Type | Description | Notes |
1015
+ | ---- | ---- | ----------- | ----- |
1016
+ | **maven_maven_repository_href** | **String** | | |
1017
+ | **x_task_diagnostics** | [**Array&lt;String&gt;**](String.md) | List of profilers to use on tasks. | [optional] |
1018
+ | **repository_version** | **String** | HREF or PRN of a version of this repository. Defaults to the latest complete version. | [optional] |
1019
+ | **fields** | [**Array&lt;String&gt;**](String.md) | A list of fields to include in the response. | [optional] |
1020
+ | **exclude_fields** | [**Array&lt;String&gt;**](String.md) | A list of fields to exclude from the response. | [optional] |
1021
+
1022
+ ### Return type
1023
+
1024
+ [**PaginatedMavenRepositoryFlatPackageListResponse**](PaginatedMavenRepositoryFlatPackageListResponse.md)
1025
+
1026
+ ### Authorization
1027
+
1028
+ [basicAuth](../README.md#basicAuth)
1029
+
1030
+ ### HTTP request headers
1031
+
1032
+ - **Content-Type**: Not defined
1033
+ - **Accept**: application/json
1034
+
1035
+
955
1036
  ## partial_update
956
1037
 
957
1038
  > <MavenMavenRepositoryResponse> partial_update(maven_maven_repository_href, patchedmaven_maven_repository, opts)
@@ -931,6 +931,81 @@ module PulpMavenClient
931
931
  return data, status_code, headers
932
932
  end
933
933
 
934
+ # List packages (flat)
935
+ # Return one MavenPackage row per stored GAV in a repository version (latest complete version if repository_version is omitted). version is the stored string, so rebuilds are separate rows. Pagination count is the number of GAVs. description is an empty string when the POM has none. licenses is an empty list when the POM has none. Ordered by group_id, artifact_id, version in byte order.
936
+ # @param maven_maven_repository_href [String]
937
+ # @param [Hash] opts the optional parameters
938
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
939
+ # @option opts [String] :repository_version HREF or PRN of a version of this repository. Defaults to the latest complete version.
940
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
941
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
942
+ # @return [PaginatedMavenRepositoryFlatPackageListResponse]
943
+ def packages_flat(maven_maven_repository_href, opts = {})
944
+ data, _status_code, _headers = packages_flat_with_http_info(maven_maven_repository_href, opts)
945
+ data
946
+ end
947
+
948
+ # List packages (flat)
949
+ # Return one MavenPackage row per stored GAV in a repository version (latest complete version if repository_version is omitted). version is the stored string, so rebuilds are separate rows. Pagination count is the number of GAVs. description is an empty string when the POM has none. licenses is an empty list when the POM has none. Ordered by group_id, artifact_id, version in byte order.
950
+ # @param maven_maven_repository_href [String]
951
+ # @param [Hash] opts the optional parameters
952
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
953
+ # @option opts [String] :repository_version HREF or PRN of a version of this repository. Defaults to the latest complete version.
954
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
955
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
956
+ # @return [Array<(PaginatedMavenRepositoryFlatPackageListResponse, Integer, Hash)>] PaginatedMavenRepositoryFlatPackageListResponse data, response status code and response headers
957
+ def packages_flat_with_http_info(maven_maven_repository_href, opts = {})
958
+ if @api_client.config.debugging
959
+ @api_client.config.logger.debug 'Calling API: RepositoriesMavenApi.packages_flat ...'
960
+ end
961
+ # verify the required parameter 'maven_maven_repository_href' is set
962
+ if @api_client.config.client_side_validation && maven_maven_repository_href.nil?
963
+ fail ArgumentError, "Missing the required parameter 'maven_maven_repository_href' when calling RepositoriesMavenApi.packages_flat"
964
+ end
965
+ # resource path
966
+ local_var_path = '{maven_maven_repository_href}packages/flat/'.sub('{' + 'maven_maven_repository_href' + '}', CGI.escape(maven_maven_repository_href.to_s).gsub('%2F', '/'))
967
+
968
+ # query parameters
969
+ query_params = opts[:query_params] || {}
970
+ query_params[:'repository_version'] = opts[:'repository_version'] if !opts[:'repository_version'].nil?
971
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
972
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
973
+
974
+ # header parameters
975
+ header_params = opts[:header_params] || {}
976
+ # HTTP header 'Accept' (if needed)
977
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
978
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
979
+
980
+ # form parameters
981
+ form_params = opts[:form_params] || {}
982
+
983
+ # http body (model)
984
+ post_body = opts[:debug_body]
985
+
986
+ # return_type
987
+ return_type = opts[:debug_return_type] || 'PaginatedMavenRepositoryFlatPackageListResponse'
988
+
989
+ # auth_names
990
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
991
+
992
+ new_options = opts.merge(
993
+ :operation => :"RepositoriesMavenApi.packages_flat",
994
+ :header_params => header_params,
995
+ :query_params => query_params,
996
+ :form_params => form_params,
997
+ :body => post_body,
998
+ :auth_names => auth_names,
999
+ :return_type => return_type
1000
+ )
1001
+
1002
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1003
+ if @api_client.config.debugging
1004
+ @api_client.config.logger.debug "API called: RepositoriesMavenApi#packages_flat\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1005
+ end
1006
+ return data, status_code, headers
1007
+ end
1008
+
934
1009
  # Update a maven repository
935
1010
  # Update the entity partially and trigger an asynchronous task if necessary
936
1011
  # @param maven_maven_repository_href [String]
@@ -0,0 +1,240 @@
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 PulpMavenClient
17
+ # One license entry on the flat package list.
18
+ class MavenPackageLicenseResponse
19
+ # License name from the POM. Empty when the POM omitted it.
20
+ attr_accessor :name
21
+
22
+ # License URL from the POM. Empty when the POM omitted it.
23
+ attr_accessor :url
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'name' => :'name',
29
+ :'url' => :'url'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'name' => :'String',
42
+ :'url' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpMavenClient::MavenPackageLicenseResponse` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpMavenClient::MavenPackageLicenseResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'name')
68
+ self.name = attributes[:'name']
69
+ else
70
+ self.name = nil
71
+ end
72
+
73
+ if attributes.key?(:'url')
74
+ self.url = attributes[:'url']
75
+ else
76
+ self.url = nil
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
+ invalid_properties = Array.new
85
+ if @name.nil?
86
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
87
+ end
88
+
89
+ if @url.nil?
90
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
+ return false if @name.nil?
101
+ return false if @url.nil?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ name == o.name &&
111
+ url == o.url
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(o)
117
+ self == o
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Integer] Hash code
122
+ def hash
123
+ [name, url].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ transformed_hash = {}
133
+ openapi_types.each_pair do |key, type|
134
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = nil
136
+ elsif type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[attribute_map[key]].is_a?(Array)
140
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
+ end
142
+ elsif !attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
+ end
145
+ end
146
+ new(transformed_hash)
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def self._deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = PulpMavenClient.const_get(type)
188
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end