pulp_maven_client 0.2.0b1.dev01595620836 → 0.2.0b1.dev01596139522

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pulp_maven_client might be problematic. Click here for more details.

Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -13
  3. data/docs/ContentArtifactApi.md +32 -32
  4. data/docs/ContentSummary.md +3 -3
  5. data/docs/ContentSummaryResponse.md +21 -0
  6. data/docs/DistributionsMavenApi.md +104 -56
  7. data/docs/InlineResponse200.md +3 -3
  8. data/docs/InlineResponse2001.md +3 -3
  9. data/docs/InlineResponse2002.md +3 -3
  10. data/docs/InlineResponse2003.md +3 -3
  11. data/docs/InlineResponse2004.md +3 -3
  12. data/docs/MavenMavenArtifact.md +3 -13
  13. data/docs/MavenMavenArtifactResponse.md +29 -0
  14. data/docs/MavenMavenDistribution.md +1 -7
  15. data/docs/MavenMavenDistributionResponse.md +29 -0
  16. data/docs/MavenMavenRemote.md +2 -8
  17. data/docs/MavenMavenRemoteResponse.md +43 -0
  18. data/docs/MavenMavenRepository.md +4 -10
  19. data/docs/MavenMavenRepositoryResponse.md +29 -0
  20. data/docs/PatchedmavenMavenDistribution.md +23 -0
  21. data/docs/PatchedmavenMavenRemote.md +37 -0
  22. data/docs/PatchedmavenMavenRepository.md +21 -0
  23. data/docs/PolicyEnum.md +16 -0
  24. data/docs/RemotesMavenApi.md +121 -61
  25. data/docs/RepositoriesMavenApi.md +73 -49
  26. data/docs/RepositoriesMavenVersionsApi.md +90 -58
  27. data/docs/RepositoryVersion.md +1 -9
  28. data/docs/RepositoryVersionResponse.md +25 -0
  29. data/lib/pulp_maven_client.rb +12 -2
  30. data/lib/pulp_maven_client/api/content_artifact_api.rb +44 -44
  31. data/lib/pulp_maven_client/api/distributions_maven_api.rb +131 -68
  32. data/lib/pulp_maven_client/api/remotes_maven_api.rb +159 -78
  33. data/lib/pulp_maven_client/api/repositories_maven_api.rb +89 -62
  34. data/lib/pulp_maven_client/api/repositories_maven_versions_api.rb +119 -74
  35. data/lib/pulp_maven_client/api_client.rb +2 -2
  36. data/lib/pulp_maven_client/api_error.rb +2 -2
  37. data/lib/pulp_maven_client/configuration.rb +3 -3
  38. data/lib/pulp_maven_client/models/async_operation_response.rb +3 -2
  39. data/lib/pulp_maven_client/models/content_summary.rb +9 -15
  40. data/lib/pulp_maven_client/models/content_summary_response.rb +240 -0
  41. data/lib/pulp_maven_client/models/inline_response200.rb +3 -13
  42. data/lib/pulp_maven_client/models/inline_response2001.rb +3 -13
  43. data/lib/pulp_maven_client/models/inline_response2002.rb +3 -13
  44. data/lib/pulp_maven_client/models/inline_response2003.rb +3 -13
  45. data/lib/pulp_maven_client/models/inline_response2004.rb +3 -13
  46. data/lib/pulp_maven_client/models/maven_maven_artifact.rb +14 -117
  47. data/lib/pulp_maven_client/models/maven_maven_artifact_response.rb +272 -0
  48. data/lib/pulp_maven_client/models/maven_maven_distribution.rb +4 -85
  49. data/lib/pulp_maven_client/models/maven_maven_distribution_response.rb +279 -0
  50. data/lib/pulp_maven_client/models/maven_maven_remote.rb +5 -197
  51. data/lib/pulp_maven_client/models/maven_maven_remote_response.rb +368 -0
  52. data/lib/pulp_maven_client/models/maven_maven_repository.rb +18 -78
  53. data/lib/pulp_maven_client/models/maven_maven_repository_response.rb +271 -0
  54. data/lib/pulp_maven_client/models/patchedmaven_maven_distribution.rb +240 -0
  55. data/lib/pulp_maven_client/models/patchedmaven_maven_remote.rb +329 -0
  56. data/lib/pulp_maven_client/models/patchedmaven_maven_repository.rb +229 -0
  57. data/lib/pulp_maven_client/models/policy_enum.rb +36 -0
  58. data/lib/pulp_maven_client/models/repository_version.rb +7 -43
  59. data/lib/pulp_maven_client/models/repository_version_response.rb +246 -0
  60. data/lib/pulp_maven_client/version.rb +3 -3
  61. data/pulp_maven_client.gemspec +4 -4
  62. data/spec/api/content_artifact_api_spec.rb +14 -14
  63. data/spec/api/distributions_maven_api_spec.rb +39 -18
  64. data/spec/api/remotes_maven_api_spec.rb +48 -21
  65. data/spec/api/repositories_maven_api_spec.rb +24 -15
  66. data/spec/api/repositories_maven_versions_api_spec.rb +38 -23
  67. data/spec/api_client_spec.rb +2 -2
  68. data/spec/configuration_spec.rb +2 -2
  69. data/spec/models/async_operation_response_spec.rb +2 -2
  70. data/spec/models/content_summary_response_spec.rb +53 -0
  71. data/spec/models/content_summary_spec.rb +2 -2
  72. data/spec/models/inline_response2001_spec.rb +2 -2
  73. data/spec/models/inline_response2002_spec.rb +2 -2
  74. data/spec/models/inline_response2003_spec.rb +2 -2
  75. data/spec/models/inline_response2004_spec.rb +2 -2
  76. data/spec/models/inline_response200_spec.rb +2 -2
  77. data/spec/models/maven_maven_artifact_response_spec.rb +77 -0
  78. data/spec/models/maven_maven_artifact_spec.rb +3 -33
  79. data/spec/models/maven_maven_distribution_response_spec.rb +77 -0
  80. data/spec/models/maven_maven_distribution_spec.rb +2 -20
  81. data/spec/models/maven_maven_remote_response_spec.rb +119 -0
  82. data/spec/models/maven_maven_remote_spec.rb +2 -24
  83. data/spec/models/maven_maven_repository_response_spec.rb +77 -0
  84. data/spec/models/maven_maven_repository_spec.rb +5 -23
  85. data/spec/models/patchedmaven_maven_distribution_spec.rb +59 -0
  86. data/spec/models/patchedmaven_maven_remote_spec.rb +101 -0
  87. data/spec/models/patchedmaven_maven_repository_spec.rb +53 -0
  88. data/spec/models/policy_enum_spec.rb +35 -0
  89. data/spec/models/repository_version_response_spec.rb +65 -0
  90. data/spec/models/repository_version_spec.rb +2 -26
  91. data/spec/spec_helper.rb +2 -2
  92. metadata +44 -4
@@ -1,10 +1,10 @@
1
1
  =begin
2
2
  #Pulp 3 API
3
3
 
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
5
 
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
9
  OpenAPI Generator version: 4.2.3
10
10
 
@@ -38,7 +38,7 @@ module PulpMavenClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<MavenMavenRemote>'
41
+ :'results' => :'Array<MavenMavenRemoteResponse>'
42
42
  }
43
43
  end
44
44
 
@@ -88,22 +88,12 @@ module PulpMavenClient
88
88
  # @return Array for valid properties with the reasons
89
89
  def list_invalid_properties
90
90
  invalid_properties = Array.new
91
- if @count.nil?
92
- invalid_properties.push('invalid value for "count", count cannot be nil.')
93
- end
94
-
95
- if @results.nil?
96
- invalid_properties.push('invalid value for "results", results cannot be nil.')
97
- end
98
-
99
91
  invalid_properties
100
92
  end
101
93
 
102
94
  # Check to see if the all the properties in the model are valid
103
95
  # @return true if the model is valid
104
96
  def valid?
105
- return false if @count.nil?
106
- return false if @results.nil?
107
97
  true
108
98
  end
109
99
 
@@ -1,10 +1,10 @@
1
1
  =begin
2
2
  #Pulp 3 API
3
3
 
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
5
 
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
9
  OpenAPI Generator version: 4.2.3
10
10
 
@@ -38,7 +38,7 @@ module PulpMavenClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<MavenMavenRepository>'
41
+ :'results' => :'Array<MavenMavenRepositoryResponse>'
42
42
  }
43
43
  end
44
44
 
@@ -88,22 +88,12 @@ module PulpMavenClient
88
88
  # @return Array for valid properties with the reasons
89
89
  def list_invalid_properties
90
90
  invalid_properties = Array.new
91
- if @count.nil?
92
- invalid_properties.push('invalid value for "count", count cannot be nil.')
93
- end
94
-
95
- if @results.nil?
96
- invalid_properties.push('invalid value for "results", results cannot be nil.')
97
- end
98
-
99
91
  invalid_properties
100
92
  end
101
93
 
102
94
  # Check to see if the all the properties in the model are valid
103
95
  # @return true if the model is valid
104
96
  def valid?
105
- return false if @count.nil?
106
- return false if @results.nil?
107
97
  true
108
98
  end
109
99
 
@@ -1,10 +1,10 @@
1
1
  =begin
2
2
  #Pulp 3 API
3
3
 
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
5
 
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
9
  OpenAPI Generator version: 4.2.3
10
10
 
@@ -38,7 +38,7 @@ module PulpMavenClient
38
38
  :'count' => :'Integer',
39
39
  :'_next' => :'String',
40
40
  :'previous' => :'String',
41
- :'results' => :'Array<RepositoryVersion>'
41
+ :'results' => :'Array<RepositoryVersionResponse>'
42
42
  }
43
43
  end
44
44
 
@@ -88,22 +88,12 @@ module PulpMavenClient
88
88
  # @return Array for valid properties with the reasons
89
89
  def list_invalid_properties
90
90
  invalid_properties = Array.new
91
- if @count.nil?
92
- invalid_properties.push('invalid value for "count", count cannot be nil.')
93
- end
94
-
95
- if @results.nil?
96
- invalid_properties.push('invalid value for "results", results cannot be nil.')
97
- end
98
-
99
91
  invalid_properties
100
92
  end
101
93
 
102
94
  # Check to see if the all the properties in the model are valid
103
95
  # @return true if the model is valid
104
96
  def valid?
105
- return false if @count.nil?
106
- return false if @results.nil?
107
97
  true
108
98
  end
109
99
 
@@ -1,10 +1,10 @@
1
1
  =begin
2
2
  #Pulp 3 API
3
3
 
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
5
 
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
9
  OpenAPI Generator version: 4.2.3
10
10
 
@@ -13,50 +13,27 @@ OpenAPI Generator version: 4.2.3
13
13
  require 'date'
14
14
 
15
15
  module PulpMavenClient
16
+ # A Serializer for MavenArtifact.
16
17
  class MavenMavenArtifact
17
- attr_accessor :pulp_href
18
-
19
- # Timestamp of creation.
20
- attr_accessor :pulp_created
21
-
22
18
  # Artifact file representing the physical content
23
19
  attr_accessor :artifact
24
20
 
25
- # Group Id of the artifact's package.
26
- attr_accessor :group_id
27
-
28
- # Artifact Id of the artifact's package.
29
- attr_accessor :artifact_id
30
-
31
- # Version of the artifact's package.
32
- attr_accessor :version
33
-
34
- # Filename of the artifact.
35
- attr_accessor :filename
21
+ # Path where the artifact is located relative to distributions base_path
22
+ attr_accessor :relative_path
36
23
 
37
24
  # Attribute mapping from ruby-style variable name to JSON key.
38
25
  def self.attribute_map
39
26
  {
40
- :'pulp_href' => :'pulp_href',
41
- :'pulp_created' => :'pulp_created',
42
27
  :'artifact' => :'artifact',
43
- :'group_id' => :'group_id',
44
- :'artifact_id' => :'artifact_id',
45
- :'version' => :'version',
46
- :'filename' => :'filename'
28
+ :'relative_path' => :'relative_path'
47
29
  }
48
30
  end
49
31
 
50
32
  # Attribute type mapping.
51
33
  def self.openapi_types
52
34
  {
53
- :'pulp_href' => :'String',
54
- :'pulp_created' => :'DateTime',
55
35
  :'artifact' => :'String',
56
- :'group_id' => :'String',
57
- :'artifact_id' => :'String',
58
- :'version' => :'String',
59
- :'filename' => :'String'
36
+ :'relative_path' => :'String'
60
37
  }
61
38
  end
62
39
 
@@ -81,32 +58,12 @@ module PulpMavenClient
81
58
  h[k.to_sym] = v
82
59
  }
83
60
 
84
- if attributes.key?(:'pulp_href')
85
- self.pulp_href = attributes[:'pulp_href']
86
- end
87
-
88
- if attributes.key?(:'pulp_created')
89
- self.pulp_created = attributes[:'pulp_created']
90
- end
91
-
92
61
  if attributes.key?(:'artifact')
93
62
  self.artifact = attributes[:'artifact']
94
63
  end
95
64
 
96
- if attributes.key?(:'group_id')
97
- self.group_id = attributes[:'group_id']
98
- end
99
-
100
- if attributes.key?(:'artifact_id')
101
- self.artifact_id = attributes[:'artifact_id']
102
- end
103
-
104
- if attributes.key?(:'version')
105
- self.version = attributes[:'version']
106
- end
107
-
108
- if attributes.key?(:'filename')
109
- self.filename = attributes[:'filename']
65
+ if attributes.key?(:'relative_path')
66
+ self.relative_path = attributes[:'relative_path']
110
67
  end
111
68
  end
112
69
 
@@ -118,20 +75,8 @@ module PulpMavenClient
118
75
  invalid_properties.push('invalid value for "artifact", artifact cannot be nil.')
119
76
  end
120
77
 
121
- if !@group_id.nil? && @group_id.to_s.length < 1
122
- invalid_properties.push('invalid value for "group_id", the character length must be great than or equal to 1.')
123
- end
124
-
125
- if !@artifact_id.nil? && @artifact_id.to_s.length < 1
126
- invalid_properties.push('invalid value for "artifact_id", the character length must be great than or equal to 1.')
127
- end
128
-
129
- if !@version.nil? && @version.to_s.length < 1
130
- invalid_properties.push('invalid value for "version", the character length must be great than or equal to 1.')
131
- end
132
-
133
- if !@filename.nil? && @filename.to_s.length < 1
134
- invalid_properties.push('invalid value for "filename", the character length must be great than or equal to 1.')
78
+ if @relative_path.nil?
79
+ invalid_properties.push('invalid value for "relative_path", relative_path cannot be nil.')
135
80
  end
136
81
 
137
82
  invalid_properties
@@ -141,65 +86,17 @@ module PulpMavenClient
141
86
  # @return true if the model is valid
142
87
  def valid?
143
88
  return false if @artifact.nil?
144
- return false if !@group_id.nil? && @group_id.to_s.length < 1
145
- return false if !@artifact_id.nil? && @artifact_id.to_s.length < 1
146
- return false if !@version.nil? && @version.to_s.length < 1
147
- return false if !@filename.nil? && @filename.to_s.length < 1
89
+ return false if @relative_path.nil?
148
90
  true
149
91
  end
150
92
 
151
- # Custom attribute writer method with validation
152
- # @param [Object] group_id Value to be assigned
153
- def group_id=(group_id)
154
- if !group_id.nil? && group_id.to_s.length < 1
155
- fail ArgumentError, 'invalid value for "group_id", the character length must be great than or equal to 1.'
156
- end
157
-
158
- @group_id = group_id
159
- end
160
-
161
- # Custom attribute writer method with validation
162
- # @param [Object] artifact_id Value to be assigned
163
- def artifact_id=(artifact_id)
164
- if !artifact_id.nil? && artifact_id.to_s.length < 1
165
- fail ArgumentError, 'invalid value for "artifact_id", the character length must be great than or equal to 1.'
166
- end
167
-
168
- @artifact_id = artifact_id
169
- end
170
-
171
- # Custom attribute writer method with validation
172
- # @param [Object] version Value to be assigned
173
- def version=(version)
174
- if !version.nil? && version.to_s.length < 1
175
- fail ArgumentError, 'invalid value for "version", the character length must be great than or equal to 1.'
176
- end
177
-
178
- @version = version
179
- end
180
-
181
- # Custom attribute writer method with validation
182
- # @param [Object] filename Value to be assigned
183
- def filename=(filename)
184
- if !filename.nil? && filename.to_s.length < 1
185
- fail ArgumentError, 'invalid value for "filename", the character length must be great than or equal to 1.'
186
- end
187
-
188
- @filename = filename
189
- end
190
-
191
93
  # Checks equality by comparing each attribute.
192
94
  # @param [Object] Object to be compared
193
95
  def ==(o)
194
96
  return true if self.equal?(o)
195
97
  self.class == o.class &&
196
- pulp_href == o.pulp_href &&
197
- pulp_created == o.pulp_created &&
198
98
  artifact == o.artifact &&
199
- group_id == o.group_id &&
200
- artifact_id == o.artifact_id &&
201
- version == o.version &&
202
- filename == o.filename
99
+ relative_path == o.relative_path
203
100
  end
204
101
 
205
102
  # @see the `==` method
@@ -211,7 +108,7 @@ module PulpMavenClient
211
108
  # Calculates hash code according to all attributes.
212
109
  # @return [Integer] Hash code
213
110
  def hash
214
- [pulp_href, pulp_created, artifact, group_id, artifact_id, version, filename].hash
111
+ [artifact, relative_path].hash
215
112
  end
216
113
 
217
114
  # Builds the object from hash
@@ -0,0 +1,272 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpMavenClient
16
+ # A Serializer for MavenArtifact.
17
+ class MavenMavenArtifactResponse
18
+ attr_accessor :pulp_href
19
+
20
+ # Timestamp of creation.
21
+ attr_accessor :pulp_created
22
+
23
+ # Artifact file representing the physical content
24
+ attr_accessor :artifact
25
+
26
+ # Group Id of the artifact's package.
27
+ attr_accessor :group_id
28
+
29
+ # Artifact Id of the artifact's package.
30
+ attr_accessor :artifact_id
31
+
32
+ # Version of the artifact's package.
33
+ attr_accessor :version
34
+
35
+ # Filename of the artifact.
36
+ attr_accessor :filename
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'pulp_href' => :'pulp_href',
42
+ :'pulp_created' => :'pulp_created',
43
+ :'artifact' => :'artifact',
44
+ :'group_id' => :'group_id',
45
+ :'artifact_id' => :'artifact_id',
46
+ :'version' => :'version',
47
+ :'filename' => :'filename'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'pulp_href' => :'String',
55
+ :'pulp_created' => :'DateTime',
56
+ :'artifact' => :'String',
57
+ :'group_id' => :'String',
58
+ :'artifact_id' => :'String',
59
+ :'version' => :'String',
60
+ :'filename' => :'String'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpMavenClient::MavenMavenArtifactResponse` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!self.class.attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpMavenClient::MavenMavenArtifactResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'pulp_href')
86
+ self.pulp_href = attributes[:'pulp_href']
87
+ end
88
+
89
+ if attributes.key?(:'pulp_created')
90
+ self.pulp_created = attributes[:'pulp_created']
91
+ end
92
+
93
+ if attributes.key?(:'artifact')
94
+ self.artifact = attributes[:'artifact']
95
+ end
96
+
97
+ if attributes.key?(:'group_id')
98
+ self.group_id = attributes[:'group_id']
99
+ end
100
+
101
+ if attributes.key?(:'artifact_id')
102
+ self.artifact_id = attributes[:'artifact_id']
103
+ end
104
+
105
+ if attributes.key?(:'version')
106
+ self.version = attributes[:'version']
107
+ end
108
+
109
+ if attributes.key?(:'filename')
110
+ self.filename = attributes[:'filename']
111
+ end
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properties with the reasons
116
+ def list_invalid_properties
117
+ invalid_properties = Array.new
118
+ if @artifact.nil?
119
+ invalid_properties.push('invalid value for "artifact", artifact cannot be nil.')
120
+ end
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ return false if @artifact.nil?
129
+ true
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ pulp_href == o.pulp_href &&
138
+ pulp_created == o.pulp_created &&
139
+ artifact == o.artifact &&
140
+ group_id == o.group_id &&
141
+ artifact_id == o.artifact_id &&
142
+ version == o.version &&
143
+ filename == o.filename
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [pulp_href, pulp_created, artifact, group_id, artifact_id, version, filename].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ new.build_from_hash(attributes)
163
+ end
164
+
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def build_from_hash(attributes)
169
+ return nil unless attributes.is_a?(Hash)
170
+ self.class.openapi_types.each_pair do |key, type|
171
+ if type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
175
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
176
+ end
177
+ elsif !attributes[self.class.attribute_map[key]].nil?
178
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
179
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
180
+ end
181
+
182
+ self
183
+ end
184
+
185
+ # Deserializes the data based on type
186
+ # @param string type Data type
187
+ # @param string value Value to be deserialized
188
+ # @return [Object] Deserialized data
189
+ def _deserialize(type, value)
190
+ case type.to_sym
191
+ when :DateTime
192
+ DateTime.parse(value)
193
+ when :Date
194
+ Date.parse(value)
195
+ when :String
196
+ value.to_s
197
+ when :Integer
198
+ value.to_i
199
+ when :Float
200
+ value.to_f
201
+ when :Boolean
202
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
+ true
204
+ else
205
+ false
206
+ end
207
+ when :Object
208
+ # generic object (usually a Hash), return directly
209
+ value
210
+ when /\AArray<(?<inner_type>.+)>\z/
211
+ inner_type = Regexp.last_match[:inner_type]
212
+ value.map { |v| _deserialize(inner_type, v) }
213
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
+ k_type = Regexp.last_match[:k_type]
215
+ v_type = Regexp.last_match[:v_type]
216
+ {}.tap do |hash|
217
+ value.each do |k, v|
218
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
+ end
220
+ end
221
+ else # model
222
+ PulpMavenClient.const_get(type).build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+ end
272
+ end