dependency-tracker-client 1.0.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 (227) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +201 -0
  4. data/README.md +276 -0
  5. data/Rakefile +10 -0
  6. data/dependency-tracker-client.gemspec +39 -0
  7. data/docs/About.md +25 -0
  8. data/docs/Analysis.md +21 -0
  9. data/docs/AnalysisApi.md +177 -0
  10. data/docs/AnalysisComment.md +21 -0
  11. data/docs/AnalysisRequest.md +27 -0
  12. data/docs/ApiKey.md +17 -0
  13. data/docs/BadgeApi.md +102 -0
  14. data/docs/BodyPart.md +31 -0
  15. data/docs/BomApi.md +335 -0
  16. data/docs/BomSubmitRequest.md +25 -0
  17. data/docs/CalculatorApi.md +61 -0
  18. data/docs/CloneProjectRequest.md +19 -0
  19. data/docs/Component.md +69 -0
  20. data/docs/ComponentApi.md +373 -0
  21. data/docs/ComponentMetrics.md +43 -0
  22. data/docs/ConfigProperty.md +25 -0
  23. data/docs/ConfigPropertyApi.md +167 -0
  24. data/docs/ContentDisposition.md +29 -0
  25. data/docs/Cwe.md +19 -0
  26. data/docs/CweApi.md +110 -0
  27. data/docs/DefaultApi.md +434 -0
  28. data/docs/Dependency.md +27 -0
  29. data/docs/DependencyApi.md +222 -0
  30. data/docs/DependencyMetrics.md +45 -0
  31. data/docs/DependencyRequest.md +21 -0
  32. data/docs/Finding.md +23 -0
  33. data/docs/FindingApi.md +113 -0
  34. data/docs/FormDataBodyPart.md +39 -0
  35. data/docs/FormDataContentDisposition.md +31 -0
  36. data/docs/FormDataMultiPart.md +35 -0
  37. data/docs/Framework.md +23 -0
  38. data/docs/IdentifiableObject.md +17 -0
  39. data/docs/LdapApi.md +220 -0
  40. data/docs/LdapUser.md +25 -0
  41. data/docs/License.md +37 -0
  42. data/docs/LicenseApi.md +159 -0
  43. data/docs/ManagedUser.md +37 -0
  44. data/docs/MappedLdapGroup.md +19 -0
  45. data/docs/MappedLdapGroupRequest.md +19 -0
  46. data/docs/MediaType.md +25 -0
  47. data/docs/MetricsApi.md +922 -0
  48. data/docs/MultiPart.md +33 -0
  49. data/docs/NotificationPublisher.md +29 -0
  50. data/docs/NotificationRule.md +35 -0
  51. data/docs/PackageURL.md +29 -0
  52. data/docs/ParameterizedHeader.md +19 -0
  53. data/docs/Permission.md +19 -0
  54. data/docs/PermissionApi.md +279 -0
  55. data/docs/PortfolioMetrics.md +53 -0
  56. data/docs/Project.md +43 -0
  57. data/docs/ProjectApi.md +445 -0
  58. data/docs/ProjectMetrics.md +47 -0
  59. data/docs/ProjectProperty.md +27 -0
  60. data/docs/ProjectPropertyApi.md +232 -0
  61. data/docs/Repository.md +29 -0
  62. data/docs/RepositoryApi.md +325 -0
  63. data/docs/RepositoryMetaComponent.md +27 -0
  64. data/docs/Score.md +23 -0
  65. data/docs/SearchApi.md +120 -0
  66. data/docs/SearchResult.md +17 -0
  67. data/docs/Tag.md +19 -0
  68. data/docs/Team.md +29 -0
  69. data/docs/TeamApi.md +432 -0
  70. data/docs/UserApi.md +715 -0
  71. data/docs/UserPrincipal.md +27 -0
  72. data/docs/VersionApi.md +52 -0
  73. data/docs/Vulnerability.md +69 -0
  74. data/docs/VulnerabilityApi.md +666 -0
  75. data/docs/VulnerabilityMetrics.md +23 -0
  76. data/docs/VulnerableSoftware.md +69 -0
  77. data/lib/dependency-tracker-client/api/analysis_api.rb +209 -0
  78. data/lib/dependency-tracker-client/api/badge_api.rb +148 -0
  79. data/lib/dependency-tracker-client/api/bom_api.rb +382 -0
  80. data/lib/dependency-tracker-client/api/calculator_api.rb +83 -0
  81. data/lib/dependency-tracker-client/api/component_api.rb +422 -0
  82. data/lib/dependency-tracker-client/api/config_property_api.rb +192 -0
  83. data/lib/dependency-tracker-client/api/cwe_api.rb +136 -0
  84. data/lib/dependency-tracker-client/api/default_api.rb +491 -0
  85. data/lib/dependency-tracker-client/api/dependency_api.rb +254 -0
  86. data/lib/dependency-tracker-client/api/finding_api.rb +140 -0
  87. data/lib/dependency-tracker-client/api/ldap_api.rb +254 -0
  88. data/lib/dependency-tracker-client/api/license_api.rb +190 -0
  89. data/lib/dependency-tracker-client/api/metrics_api.rb +1086 -0
  90. data/lib/dependency-tracker-client/api/permission_api.rb +342 -0
  91. data/lib/dependency-tracker-client/api/project_api.rb +504 -0
  92. data/lib/dependency-tracker-client/api/project_property_api.rb +274 -0
  93. data/lib/dependency-tracker-client/api/repository_api.rb +376 -0
  94. data/lib/dependency-tracker-client/api/search_api.rb +143 -0
  95. data/lib/dependency-tracker-client/api/team_api.rb +486 -0
  96. data/lib/dependency-tracker-client/api/user_api.rb +796 -0
  97. data/lib/dependency-tracker-client/api/version_api.rb +78 -0
  98. data/lib/dependency-tracker-client/api/vulnerability_api.rb +780 -0
  99. data/lib/dependency-tracker-client/api_client.rb +388 -0
  100. data/lib/dependency-tracker-client/api_error.rb +57 -0
  101. data/lib/dependency-tracker-client/configuration.rb +261 -0
  102. data/lib/dependency-tracker-client/models/about.rb +242 -0
  103. data/lib/dependency-tracker-client/models/analysis.rb +265 -0
  104. data/lib/dependency-tracker-client/models/analysis_comment.rb +234 -0
  105. data/lib/dependency-tracker-client/models/analysis_request.rb +371 -0
  106. data/lib/dependency-tracker-client/models/api_key.rb +250 -0
  107. data/lib/dependency-tracker-client/models/body_part.rb +273 -0
  108. data/lib/dependency-tracker-client/models/bom_submit_request.rb +328 -0
  109. data/lib/dependency-tracker-client/models/clone_project_request.rb +267 -0
  110. data/lib/dependency-tracker-client/models/component.rb +900 -0
  111. data/lib/dependency-tracker-client/models/component_metrics.rb +338 -0
  112. data/lib/dependency-tracker-client/models/config_property.rb +421 -0
  113. data/lib/dependency-tracker-client/models/content_disposition.rb +262 -0
  114. data/lib/dependency-tracker-client/models/cwe.rb +259 -0
  115. data/lib/dependency-tracker-client/models/dependency.rb +266 -0
  116. data/lib/dependency-tracker-client/models/dependency_metrics.rb +352 -0
  117. data/lib/dependency-tracker-client/models/dependency_request.rb +257 -0
  118. data/lib/dependency-tracker-client/models/finding.rb +239 -0
  119. data/lib/dependency-tracker-client/models/form_data_body_part.rb +309 -0
  120. data/lib/dependency-tracker-client/models/form_data_content_disposition.rb +271 -0
  121. data/lib/dependency-tracker-client/models/form_data_multi_part.rb +295 -0
  122. data/lib/dependency-tracker-client/models/framework.rb +233 -0
  123. data/lib/dependency-tracker-client/models/identifiable_object.rb +206 -0
  124. data/lib/dependency-tracker-client/models/ldap_user.rb +351 -0
  125. data/lib/dependency-tracker-client/models/license.rb +373 -0
  126. data/lib/dependency-tracker-client/models/managed_user.rb +480 -0
  127. data/lib/dependency-tracker-client/models/mapped_ldap_group.rb +255 -0
  128. data/lib/dependency-tracker-client/models/mapped_ldap_group_request.rb +267 -0
  129. data/lib/dependency-tracker-client/models/media_type.rb +244 -0
  130. data/lib/dependency-tracker-client/models/multi_part.rb +284 -0
  131. data/lib/dependency-tracker-client/models/notification_publisher.rb +388 -0
  132. data/lib/dependency-tracker-client/models/notification_rule.rb +426 -0
  133. data/lib/dependency-tracker-client/models/package_url.rb +262 -0
  134. data/lib/dependency-tracker-client/models/parameterized_header.rb +217 -0
  135. data/lib/dependency-tracker-client/models/permission.rb +250 -0
  136. data/lib/dependency-tracker-client/models/portfolio_metrics.rb +378 -0
  137. data/lib/dependency-tracker-client/models/project.rb +420 -0
  138. data/lib/dependency-tracker-client/models/project_metrics.rb +356 -0
  139. data/lib/dependency-tracker-client/models/project_property.rb +430 -0
  140. data/lib/dependency-tracker-client/models/repository.rb +319 -0
  141. data/lib/dependency-tracker-client/models/repository_meta_component.rb +305 -0
  142. data/lib/dependency-tracker-client/models/score.rb +233 -0
  143. data/lib/dependency-tracker-client/models/search_result.rb +208 -0
  144. data/lib/dependency-tracker-client/models/tag.rb +252 -0
  145. data/lib/dependency-tracker-client/models/team.rb +310 -0
  146. data/lib/dependency-tracker-client/models/user_principal.rb +255 -0
  147. data/lib/dependency-tracker-client/models/vulnerability.rb +729 -0
  148. data/lib/dependency-tracker-client/models/vulnerability_metrics.rb +238 -0
  149. data/lib/dependency-tracker-client/models/vulnerable_software.rb +442 -0
  150. data/lib/dependency-tracker-client/version.rb +15 -0
  151. data/lib/dependency-tracker-client.rb +109 -0
  152. data/pkg/dependency-tracker-client-1.0.0.gem +0 -0
  153. data/spec/api/analysis_api_spec.rb +70 -0
  154. data/spec/api/badge_api_spec.rb +58 -0
  155. data/spec/api/bom_api_spec.rb +106 -0
  156. data/spec/api/calculator_api_spec.rb +46 -0
  157. data/spec/api/component_api_spec.rb +110 -0
  158. data/spec/api/config_property_api_spec.rb +67 -0
  159. data/spec/api/cwe_api_spec.rb +56 -0
  160. data/spec/api/default_api_spec.rb +123 -0
  161. data/spec/api/dependency_api_spec.rb +79 -0
  162. data/spec/api/finding_api_spec.rb +57 -0
  163. data/spec/api/ldap_api_spec.rb +79 -0
  164. data/spec/api/license_api_spec.rb +66 -0
  165. data/spec/api/metrics_api_spec.rb +233 -0
  166. data/spec/api/permission_api_spec.rb +94 -0
  167. data/spec/api/project_api_spec.rb +126 -0
  168. data/spec/api/project_property_api_spec.rb +82 -0
  169. data/spec/api/repository_api_spec.rb +100 -0
  170. data/spec/api/search_api_spec.rb +59 -0
  171. data/spec/api/team_api_spec.rb +122 -0
  172. data/spec/api/user_api_spec.rb +183 -0
  173. data/spec/api/version_api_spec.rb +46 -0
  174. data/spec/api/vulnerability_api_spec.rb +177 -0
  175. data/spec/api_client_spec.rb +226 -0
  176. data/spec/configuration_spec.rb +42 -0
  177. data/spec/models/about_spec.rb +65 -0
  178. data/spec/models/analysis_comment_spec.rb +53 -0
  179. data/spec/models/analysis_request_spec.rb +75 -0
  180. data/spec/models/analysis_spec.rb +57 -0
  181. data/spec/models/api_key_spec.rb +41 -0
  182. data/spec/models/body_part_spec.rb +83 -0
  183. data/spec/models/bom_submit_request_spec.rb +65 -0
  184. data/spec/models/clone_project_request_spec.rb +47 -0
  185. data/spec/models/component_metrics_spec.rb +119 -0
  186. data/spec/models/component_spec.rb +201 -0
  187. data/spec/models/config_property_spec.rb +69 -0
  188. data/spec/models/content_disposition_spec.rb +77 -0
  189. data/spec/models/cwe_spec.rb +47 -0
  190. data/spec/models/dependency_metrics_spec.rb +125 -0
  191. data/spec/models/dependency_request_spec.rb +53 -0
  192. data/spec/models/dependency_spec.rb +71 -0
  193. data/spec/models/finding_spec.rb +59 -0
  194. data/spec/models/form_data_body_part_spec.rb +107 -0
  195. data/spec/models/form_data_content_disposition_spec.rb +83 -0
  196. data/spec/models/form_data_multi_part_spec.rb +95 -0
  197. data/spec/models/framework_spec.rb +59 -0
  198. data/spec/models/identifiable_object_spec.rb +41 -0
  199. data/spec/models/ldap_user_spec.rb +65 -0
  200. data/spec/models/license_spec.rb +101 -0
  201. data/spec/models/managed_user_spec.rb +101 -0
  202. data/spec/models/mapped_ldap_group_request_spec.rb +47 -0
  203. data/spec/models/mapped_ldap_group_spec.rb +47 -0
  204. data/spec/models/media_type_spec.rb +65 -0
  205. data/spec/models/multi_part_spec.rb +89 -0
  206. data/spec/models/notification_publisher_spec.rb +77 -0
  207. data/spec/models/notification_rule_spec.rb +107 -0
  208. data/spec/models/package_url_spec.rb +77 -0
  209. data/spec/models/parameterized_header_spec.rb +47 -0
  210. data/spec/models/permission_spec.rb +47 -0
  211. data/spec/models/portfolio_metrics_spec.rb +149 -0
  212. data/spec/models/project_metrics_spec.rb +131 -0
  213. data/spec/models/project_property_spec.rb +75 -0
  214. data/spec/models/project_spec.rb +119 -0
  215. data/spec/models/repository_meta_component_spec.rb +75 -0
  216. data/spec/models/repository_spec.rb +81 -0
  217. data/spec/models/score_spec.rb +59 -0
  218. data/spec/models/search_result_spec.rb +41 -0
  219. data/spec/models/tag_spec.rb +47 -0
  220. data/spec/models/team_spec.rb +77 -0
  221. data/spec/models/user_principal_spec.rb +71 -0
  222. data/spec/models/vulnerability_metrics_spec.rb +59 -0
  223. data/spec/models/vulnerability_spec.rb +201 -0
  224. data/spec/models/vulnerable_software_spec.rb +197 -0
  225. data/spec/spec_helper.rb +111 -0
  226. data/tmp/tmp.rb +11 -0
  227. metadata +402 -0
@@ -0,0 +1,310 @@
1
+ =begin
2
+ #Dependency-Track API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 3.8.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DependencyTracker
16
+ class Team
17
+ attr_accessor :uuid
18
+
19
+ attr_accessor :name
20
+
21
+ attr_accessor :api_keys
22
+
23
+ attr_accessor :ldap_users
24
+
25
+ attr_accessor :managed_users
26
+
27
+ attr_accessor :mapped_ldap_groups
28
+
29
+ attr_accessor :permissions
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'uuid' => :'uuid',
35
+ :'name' => :'name',
36
+ :'api_keys' => :'apiKeys',
37
+ :'ldap_users' => :'ldapUsers',
38
+ :'managed_users' => :'managedUsers',
39
+ :'mapped_ldap_groups' => :'mappedLdapGroups',
40
+ :'permissions' => :'permissions'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'uuid' => :'String',
48
+ :'name' => :'String',
49
+ :'api_keys' => :'Array<ApiKey>',
50
+ :'ldap_users' => :'Array<LdapUser>',
51
+ :'managed_users' => :'Array<ManagedUser>',
52
+ :'mapped_ldap_groups' => :'Array<MappedLdapGroup>',
53
+ :'permissions' => :'Array<Permission>'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DependencyTracker::Team` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DependencyTracker::Team`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'uuid')
79
+ self.uuid = attributes[:'uuid']
80
+ end
81
+
82
+ if attributes.key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.key?(:'api_keys')
87
+ if (value = attributes[:'api_keys']).is_a?(Array)
88
+ self.api_keys = value
89
+ end
90
+ end
91
+
92
+ if attributes.key?(:'ldap_users')
93
+ if (value = attributes[:'ldap_users']).is_a?(Array)
94
+ self.ldap_users = value
95
+ end
96
+ end
97
+
98
+ if attributes.key?(:'managed_users')
99
+ if (value = attributes[:'managed_users']).is_a?(Array)
100
+ self.managed_users = value
101
+ end
102
+ end
103
+
104
+ if attributes.key?(:'mapped_ldap_groups')
105
+ if (value = attributes[:'mapped_ldap_groups']).is_a?(Array)
106
+ self.mapped_ldap_groups = value
107
+ end
108
+ end
109
+
110
+ if attributes.key?(:'permissions')
111
+ if (value = attributes[:'permissions']).is_a?(Array)
112
+ self.permissions = value
113
+ end
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ if @uuid.nil?
122
+ invalid_properties.push('invalid value for "uuid", uuid cannot be nil.')
123
+ end
124
+
125
+ if !@name.nil? && @name.to_s.length > 255
126
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
127
+ end
128
+
129
+ if !@name.nil? && @name.to_s.length < 1
130
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
131
+ end
132
+
133
+ pattern = Regexp.new(/[\P{Cc}]+/)
134
+ if !@name.nil? && @name !~ pattern
135
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ return false if @uuid.nil?
145
+ return false if !@name.nil? && @name.to_s.length > 255
146
+ return false if !@name.nil? && @name.to_s.length < 1
147
+ return false if !@name.nil? && @name !~ Regexp.new(/[\P{Cc}]+/)
148
+ true
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] name Value to be assigned
153
+ def name=(name)
154
+ if !name.nil? && name.to_s.length > 255
155
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.'
156
+ end
157
+
158
+ if !name.nil? && name.to_s.length < 1
159
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
160
+ end
161
+
162
+ pattern = Regexp.new(/[\P{Cc}]+/)
163
+ if !name.nil? && name !~ pattern
164
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
165
+ end
166
+
167
+ @name = name
168
+ end
169
+
170
+ # Checks equality by comparing each attribute.
171
+ # @param [Object] Object to be compared
172
+ def ==(o)
173
+ return true if self.equal?(o)
174
+ self.class == o.class &&
175
+ uuid == o.uuid &&
176
+ name == o.name &&
177
+ api_keys == o.api_keys &&
178
+ ldap_users == o.ldap_users &&
179
+ managed_users == o.managed_users &&
180
+ mapped_ldap_groups == o.mapped_ldap_groups &&
181
+ permissions == o.permissions
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [uuid, name, api_keys, ldap_users, managed_users, mapped_ldap_groups, permissions].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ new.build_from_hash(attributes)
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
+ end
215
+ elsif !attributes[self.class.attribute_map[key]].nil?
216
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
218
+ end
219
+
220
+ self
221
+ end
222
+
223
+ # Deserializes the data based on type
224
+ # @param string type Data type
225
+ # @param string value Value to be deserialized
226
+ # @return [Object] Deserialized data
227
+ def _deserialize(type, value)
228
+ case type.to_sym
229
+ when :DateTime
230
+ DateTime.parse(value)
231
+ when :Date
232
+ Date.parse(value)
233
+ when :String
234
+ value.to_s
235
+ when :Integer
236
+ value.to_i
237
+ when :Float
238
+ value.to_f
239
+ when :Boolean
240
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
+ true
242
+ else
243
+ false
244
+ end
245
+ when :Object
246
+ # generic object (usually a Hash), return directly
247
+ value
248
+ when /\AArray<(?<inner_type>.+)>\z/
249
+ inner_type = Regexp.last_match[:inner_type]
250
+ value.map { |v| _deserialize(inner_type, v) }
251
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
+ k_type = Regexp.last_match[:k_type]
253
+ v_type = Regexp.last_match[:v_type]
254
+ {}.tap do |hash|
255
+ value.each do |k, v|
256
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
+ end
258
+ end
259
+ else # model
260
+ DependencyTracker.const_get(type).build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
287
+ hash[param] = _to_hash(value)
288
+ end
289
+ hash
290
+ end
291
+
292
+ # Outputs non-array value in the form of hash
293
+ # For object, use to_hash. Otherwise, just return the value
294
+ # @param [Object] value Any valid value
295
+ # @return [Hash] Returns the value in the form of hash
296
+ def _to_hash(value)
297
+ if value.is_a?(Array)
298
+ value.compact.map { |v| _to_hash(v) }
299
+ elsif value.is_a?(Hash)
300
+ {}.tap do |hash|
301
+ value.each { |k, v| hash[k] = _to_hash(v) }
302
+ end
303
+ elsif value.respond_to? :to_hash
304
+ value.to_hash
305
+ else
306
+ value
307
+ end
308
+ end
309
+ end
310
+ end
@@ -0,0 +1,255 @@
1
+ =begin
2
+ #Dependency-Track API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 3.8.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DependencyTracker
16
+ class UserPrincipal
17
+ attr_accessor :permissions
18
+
19
+ attr_accessor :teams
20
+
21
+ attr_accessor :username
22
+
23
+ attr_accessor :email
24
+
25
+ attr_accessor :id
26
+
27
+ attr_accessor :name
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'permissions' => :'permissions',
33
+ :'teams' => :'teams',
34
+ :'username' => :'username',
35
+ :'email' => :'email',
36
+ :'id' => :'id',
37
+ :'name' => :'name'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'permissions' => :'Array<Permission>',
45
+ :'teams' => :'Array<Team>',
46
+ :'username' => :'String',
47
+ :'email' => :'String',
48
+ :'id' => :'Integer',
49
+ :'name' => :'String'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DependencyTracker::UserPrincipal` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DependencyTracker::UserPrincipal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'permissions')
75
+ if (value = attributes[:'permissions']).is_a?(Array)
76
+ self.permissions = value
77
+ end
78
+ end
79
+
80
+ if attributes.key?(:'teams')
81
+ if (value = attributes[:'teams']).is_a?(Array)
82
+ self.teams = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'username')
87
+ self.username = attributes[:'username']
88
+ end
89
+
90
+ if attributes.key?(:'email')
91
+ self.email = attributes[:'email']
92
+ end
93
+
94
+ if attributes.key?(:'id')
95
+ self.id = attributes[:'id']
96
+ end
97
+
98
+ if attributes.key?(:'name')
99
+ self.name = attributes[:'name']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ permissions == o.permissions &&
122
+ teams == o.teams &&
123
+ username == o.username &&
124
+ email == o.email &&
125
+ id == o.id &&
126
+ name == o.name
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [permissions, teams, username, email, id, name].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ new.build_from_hash(attributes)
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ self.class.openapi_types.each_pair do |key, type|
154
+ if type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :DateTime
175
+ DateTime.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ DependencyTracker.const_get(type).build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+ end
255
+ end