petstroepack 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +86 -0
  4. data/lib/ctd_documentation/api_helper.rb +10 -0
  5. data/lib/ctd_documentation/client.rb +140 -0
  6. data/lib/ctd_documentation/configuration.rb +103 -0
  7. data/lib/ctd_documentation/controllers/activities_controller.rb +69 -0
  8. data/lib/ctd_documentation/controllers/alerts_controller.rb +170 -0
  9. data/lib/ctd_documentation/controllers/assets_controller.rb +409 -0
  10. data/lib/ctd_documentation/controllers/base_controller.rb +65 -0
  11. data/lib/ctd_documentation/controllers/custom_attributes_categories_controller.rb +50 -0
  12. data/lib/ctd_documentation/controllers/events_controller.rb +67 -0
  13. data/lib/ctd_documentation/controllers/groups_controller.rb +28 -0
  14. data/lib/ctd_documentation/controllers/insights_controller.rb +111 -0
  15. data/lib/ctd_documentation/controllers/license_controller.rb +73 -0
  16. data/lib/ctd_documentation/controllers/login_controller.rb +31 -0
  17. data/lib/ctd_documentation/controllers/queries_controller.rb +128 -0
  18. data/lib/ctd_documentation/controllers/sensors_controller.rb +26 -0
  19. data/lib/ctd_documentation/controllers/sites_controller.rb +39 -0
  20. data/lib/ctd_documentation/controllers/tasks_controller.rb +148 -0
  21. data/lib/ctd_documentation/controllers/tasks_queries_controller.rb +29 -0
  22. data/lib/ctd_documentation/controllers/users_controller.rb +28 -0
  23. data/lib/ctd_documentation/exceptions/api_exception.rb +10 -0
  24. data/lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb +48 -0
  25. data/lib/ctd_documentation/http/auth/custom_header_auth.rb +25 -0
  26. data/lib/ctd_documentation/http/http_call_back.rb +10 -0
  27. data/lib/ctd_documentation/http/http_method_enum.rb +10 -0
  28. data/lib/ctd_documentation/http/http_request.rb +10 -0
  29. data/lib/ctd_documentation/http/http_response.rb +10 -0
  30. data/lib/ctd_documentation/models/actionable.rb +70 -0
  31. data/lib/ctd_documentation/models/actionable_asset.rb +80 -0
  32. data/lib/ctd_documentation/models/actionable_cap.rb +80 -0
  33. data/lib/ctd_documentation/models/actionable_information.rb +80 -0
  34. data/lib/ctd_documentation/models/actionable_policy.rb +361 -0
  35. data/lib/ctd_documentation/models/actionable_related_asset.rb +142 -0
  36. data/lib/ctd_documentation/models/active_history.rb +311 -0
  37. data/lib/ctd_documentation/models/activities_object.rb +150 -0
  38. data/lib/ctd_documentation/models/activities_response.rb +100 -0
  39. data/lib/ctd_documentation/models/activity.rb +150 -0
  40. data/lib/ctd_documentation/models/add_license_response.rb +79 -0
  41. data/lib/ctd_documentation/models/alert.rb +455 -0
  42. data/lib/ctd_documentation/models/alert_severity_enum.rb +23 -0
  43. data/lib/ctd_documentation/models/asset.rb +527 -0
  44. data/lib/ctd_documentation/models/assets_with_insights.rb +252 -0
  45. data/lib/ctd_documentation/models/assets_with_insights_response.rb +90 -0
  46. data/lib/ctd_documentation/models/authenticate.rb +57 -0
  47. data/lib/ctd_documentation/models/base_model.rb +58 -0
  48. data/lib/ctd_documentation/models/base_task.rb +198 -0
  49. data/lib/ctd_documentation/models/cap.rb +90 -0
  50. data/lib/ctd_documentation/models/code_sections.rb +70 -0
  51. data/lib/ctd_documentation/models/content_type_enum.rb +14 -0
  52. data/lib/ctd_documentation/models/create_a_new_query.rb +57 -0
  53. data/lib/ctd_documentation/models/create_a_new_query_response.rb +57 -0
  54. data/lib/ctd_documentation/models/create_group_response.rb +48 -0
  55. data/lib/ctd_documentation/models/create_user_response.rb +48 -0
  56. data/lib/ctd_documentation/models/createanewtask.rb +57 -0
  57. data/lib/ctd_documentation/models/createanewtask_response.rb +57 -0
  58. data/lib/ctd_documentation/models/ctd_login_exception.rb +81 -0
  59. data/lib/ctd_documentation/models/ctd_login_response.rb +101 -0
  60. data/lib/ctd_documentation/models/custom_attribute_category.rb +90 -0
  61. data/lib/ctd_documentation/models/db_statistics.rb +50 -0
  62. data/lib/ctd_documentation/models/delete_a_query_response.rb +48 -0
  63. data/lib/ctd_documentation/models/delete_a_task_response.rb +48 -0
  64. data/lib/ctd_documentation/models/destination_virtual_zone.rb +60 -0
  65. data/lib/ctd_documentation/models/detail.rb +60 -0
  66. data/lib/ctd_documentation/models/discovery_params.rb +82 -0
  67. data/lib/ctd_documentation/models/entity.rb +70 -0
  68. data/lib/ctd_documentation/models/event.rb +175 -0
  69. data/lib/ctd_documentation/models/find_asset_by_id_response.rb +547 -0
  70. data/lib/ctd_documentation/models/format1_enum.rb +22 -0
  71. data/lib/ctd_documentation/models/format_enum.rb +20 -0
  72. data/lib/ctd_documentation/models/get_active_detection_history_response.rb +90 -0
  73. data/lib/ctd_documentation/models/get_alerts_response.rb +90 -0
  74. data/lib/ctd_documentation/models/get_all_sites_response.rb +90 -0
  75. data/lib/ctd_documentation/models/get_assets_response.rb +90 -0
  76. data/lib/ctd_documentation/models/get_custom_attribute_categories_response.rb +90 -0
  77. data/lib/ctd_documentation/models/get_events_response.rb +90 -0
  78. data/lib/ctd_documentation/models/get_license_details_response.rb +81 -0
  79. data/lib/ctd_documentation/models/get_queries_ids_and_assigned_task_response.rb +70 -0
  80. data/lib/ctd_documentation/models/get_queries_response.rb +90 -0
  81. data/lib/ctd_documentation/models/get_tasks_response.rb +90 -0
  82. data/lib/ctd_documentation/models/get_types_response.rb +57 -0
  83. data/lib/ctd_documentation/models/group.rb +73 -0
  84. data/lib/ctd_documentation/models/identifiable.rb +70 -0
  85. data/lib/ctd_documentation/models/indicator_info.rb +90 -0
  86. data/lib/ctd_documentation/models/indicators.rb +122 -0
  87. data/lib/ctd_documentation/models/information.rb +183 -0
  88. data/lib/ctd_documentation/models/insight_status_enum.rb +20 -0
  89. data/lib/ctd_documentation/models/insight_status_exact1_enum.rb +21 -0
  90. data/lib/ctd_documentation/models/insight_status_exact_enum.rb +20 -0
  91. data/lib/ctd_documentation/models/license_request.rb +48 -0
  92. data/lib/ctd_documentation/models/network.rb +80 -0
  93. data/lib/ctd_documentation/models/new_queryobject.rb +199 -0
  94. data/lib/ctd_documentation/models/new_taskobject.rb +199 -0
  95. data/lib/ctd_documentation/models/object.rb +70 -0
  96. data/lib/ctd_documentation/models/paginated_response.rb +71 -0
  97. data/lib/ctd_documentation/models/policy.rb +331 -0
  98. data/lib/ctd_documentation/models/queryextraparams.rb +60 -0
  99. data/lib/ctd_documentation/models/ranger_system_check_response.rb +57 -0
  100. data/lib/ctd_documentation/models/risk_vector.rb +89 -0
  101. data/lib/ctd_documentation/models/selection_params.rb +58 -0
  102. data/lib/ctd_documentation/models/selection_params1.rb +80 -0
  103. data/lib/ctd_documentation/models/site.rb +256 -0
  104. data/lib/ctd_documentation/models/site_list_slim_enum.rb +14 -0
  105. data/lib/ctd_documentation/models/slim_insight.rb +139 -0
  106. data/lib/ctd_documentation/models/sort1_enum.rb +65 -0
  107. data/lib/ctd_documentation/models/sort31_enum.rb +59 -0
  108. data/lib/ctd_documentation/models/sort3_enum.rb +59 -0
  109. data/lib/ctd_documentation/models/sort41_enum.rb +41 -0
  110. data/lib/ctd_documentation/models/sort4_enum.rb +41 -0
  111. data/lib/ctd_documentation/models/sort5_enum.rb +35 -0
  112. data/lib/ctd_documentation/models/sort6_enum.rb +41 -0
  113. data/lib/ctd_documentation/models/sort_enum.rb +125 -0
  114. data/lib/ctd_documentation/models/source_virtual_zone.rb +60 -0
  115. data/lib/ctd_documentation/models/special_hint_enum.rb +26 -0
  116. data/lib/ctd_documentation/models/special_hint_exact_enum.rb +26 -0
  117. data/lib/ctd_documentation/models/status_enum.rb +17 -0
  118. data/lib/ctd_documentation/models/status_exact_enum.rb +23 -0
  119. data/lib/ctd_documentation/models/subnet.rb +50 -0
  120. data/lib/ctd_documentation/models/task.rb +281 -0
  121. data/lib/ctd_documentation/models/taskextraparams.rb +71 -0
  122. data/lib/ctd_documentation/models/update_a_single_query_response.rb +57 -0
  123. data/lib/ctd_documentation/models/update_a_single_task_response.rb +57 -0
  124. data/lib/ctd_documentation/models/update_license_response.rb +79 -0
  125. data/lib/ctd_documentation/models/user.rb +88 -0
  126. data/lib/ctd_documentation/models/virtual_zones.rb +118 -0
  127. data/lib/ctd_documentation/utilities/date_time_helper.rb +11 -0
  128. data/lib/ctd_documentation/utilities/file_wrapper.rb +16 -0
  129. data/lib/ctd_documentation.rb +155 -0
  130. data/test/controllers/controller_test_base.rb +29 -0
  131. data/test/controllers/test_activities_controller.rb +64 -0
  132. data/test/controllers/test_alerts_controller.rb +16 -0
  133. data/test/controllers/test_assets_controller.rb +79 -0
  134. data/test/controllers/test_custom_attributes_categories_controller.rb +52 -0
  135. data/test/controllers/test_events_controller.rb +55 -0
  136. data/test/controllers/test_login_controller.rb +45 -0
  137. data/test/controllers/test_queries_controller.rb +292 -0
  138. data/test/controllers/test_sites_controller.rb +53 -0
  139. data/test/controllers/test_tasks_controller.rb +250 -0
  140. data/test/http_response_catcher.rb +19 -0
  141. metadata +259 -0
@@ -0,0 +1,23 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # AlertSeverity.
8
+ class AlertSeverityEnum
9
+ ALERT_SEVERITY_ENUM = [
10
+ # TODO: Write general description for ENUM_NAMELOWVALUE0
11
+ ENUM_NAMELOWVALUE0 = '{"name":"Low","value":0}'.freeze,
12
+
13
+ # TODO: Write general description for ENUM_NAMEMEDIUMVALUE1
14
+ ENUM_NAMEMEDIUMVALUE1 = '{"name":"Medium","value":1}'.freeze,
15
+
16
+ # TODO: Write general description for ENUM_NAMEHIGHVALUE2
17
+ ENUM_NAMEHIGHVALUE2 = '{"name":"High","value":2}'.freeze,
18
+
19
+ # TODO: Write general description for ENUM_NAMECRITICALVALUE3
20
+ ENUM_NAMECRITICALVALUE3 = '{"name":"Critical","value":3}'.freeze
21
+ ].freeze
22
+ end
23
+ end
@@ -0,0 +1,527 @@
1
+ # ctd_documentation
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CtdDocumentation
7
+ # Asset Model.
8
+ class Asset < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :resource_id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :id
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Integer]
22
+ attr_accessor :site_id
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [TrueClass|FalseClass]
26
+ attr_accessor :approved
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [Integer]
30
+ attr_accessor :asset_type_number
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
34
+ attr_accessor :asset_type_name
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [String]
38
+ attr_accessor :class_type
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [Integer]
42
+ attr_accessor :criticality_number
43
+
44
+ # TODO: Write general description for this method
45
+ # @return [String]
46
+ attr_accessor :criticality_name
47
+
48
+ # TODO: Write general description for this method
49
+ # @return [String]
50
+ attr_accessor :display_name
51
+
52
+ # TODO: Write general description for this method
53
+ # @return [String]
54
+ attr_accessor :first_seen
55
+
56
+ # TODO: Write general description for this method
57
+ # @return [String]
58
+ attr_accessor :last_seen
59
+
60
+ # TODO: Write general description for this method
61
+ # @return [String]
62
+ attr_accessor :last_updated
63
+
64
+ # TODO: Write general description for this method
65
+ # @return [TrueClass|FalseClass]
66
+ attr_accessor :ghost
67
+
68
+ # TODO: Write general description for this method
69
+ # @return [String]
70
+ attr_accessor :hostname
71
+
72
+ # TODO: Write general description for this method
73
+ # @return [Integer]
74
+ attr_accessor :installed_programs_count
75
+
76
+ # TODO: Write general description for this method
77
+ # @return [List of String]
78
+ attr_accessor :mac
79
+
80
+ # TODO: Write general description for this method
81
+ # @return [String]
82
+ attr_accessor :name
83
+
84
+ # TODO: Write general description for this method
85
+ # @return [Integer]
86
+ attr_accessor :network_id
87
+
88
+ # TODO: Write general description for this method
89
+ # @return [Integer]
90
+ attr_accessor :num_alerts
91
+
92
+ # TODO: Write general description for this method
93
+ # @return [Integer]
94
+ attr_accessor :patch_count
95
+
96
+ # TODO: Write general description for this method
97
+ # @return [TrueClass|FalseClass]
98
+ attr_accessor :parsed
99
+
100
+ # TODO: Write general description for this method
101
+ # @return [List of String]
102
+ attr_accessor :protocol
103
+
104
+ # TODO: Write general description for this method
105
+ # @return [Float]
106
+ attr_accessor :purdue_level
107
+
108
+ # TODO: Write general description for this method
109
+ # @return [Integer]
110
+ attr_accessor :risk_level
111
+
112
+ # TODO: Write general description for this method
113
+ # @return [String]
114
+ attr_accessor :site_name
115
+
116
+ # TODO: Write general description for this method
117
+ # @return [Integer]
118
+ attr_accessor :special_hint
119
+
120
+ # TODO: Write general description for this method
121
+ # @return [String]
122
+ attr_accessor :special_hint_name
123
+
124
+ # TODO: Write general description for this method
125
+ # @return [List of String]
126
+ attr_accessor :vlan
127
+
128
+ # TODO: Write general description for this method
129
+ # @return [Integer]
130
+ attr_accessor :virtual_zone_id
131
+
132
+ # TODO: Write general description for this method
133
+ # @return [String]
134
+ attr_accessor :virtual_zone_name
135
+
136
+ # TODO: Write general description for this method
137
+ # @return [String]
138
+ attr_accessor :vendor
139
+
140
+ # TODO: Write general description for this method
141
+ # @return [TrueClass|FalseClass]
142
+ attr_accessor :valid
143
+
144
+ # TODO: Write general description for this method
145
+ # @return [Integer]
146
+ attr_accessor :subnet_id
147
+
148
+ # TODO: Write general description for this method
149
+ # @return [Integer]
150
+ attr_accessor :usb_devices_count
151
+
152
+ # TODO: Write general description for this method
153
+ # @return [String]
154
+ attr_accessor :timestamp
155
+
156
+ # TODO: Write general description for this method
157
+ # @return [Network]
158
+ attr_accessor :network
159
+
160
+ # TODO: Write general description for this method
161
+ # @return [List of String]
162
+ attr_accessor :active_queries_names
163
+
164
+ # TODO: Write general description for this method
165
+ # @return [List of String]
166
+ attr_accessor :active_scans_names
167
+
168
+ # TODO: Write general description for this method
169
+ # @return [List of Object]
170
+ attr_accessor :children
171
+
172
+ # TODO: Write general description for this method
173
+ # @return [List of Object]
174
+ attr_accessor :custom_attributes
175
+
176
+ # TODO: Write general description for this method
177
+ # @return [List of Object]
178
+ attr_accessor :custom_informations
179
+
180
+ # TODO: Write general description for this method
181
+ # @return [List of String]
182
+ attr_accessor :insight_names
183
+
184
+ # TODO: Write general description for this method
185
+ # @return [List of CodeSections]
186
+ attr_accessor :code_sections
187
+
188
+ # A mapping from model property names to API property names.
189
+ def self.names
190
+ @_hash = {} if @_hash.nil?
191
+ @_hash['resource_id'] = 'resource_id'
192
+ @_hash['id'] = 'id'
193
+ @_hash['site_id'] = 'site_id'
194
+ @_hash['approved'] = 'approved'
195
+ @_hash['asset_type_number'] = 'asset_type_number'
196
+ @_hash['asset_type_name'] = 'asset_type_name'
197
+ @_hash['class_type'] = 'class_type'
198
+ @_hash['criticality_number'] = 'criticality_number'
199
+ @_hash['criticality_name'] = 'criticality_name'
200
+ @_hash['display_name'] = 'display_name'
201
+ @_hash['first_seen'] = 'first_seen'
202
+ @_hash['last_seen'] = 'last_seen'
203
+ @_hash['last_updated'] = 'last_updated'
204
+ @_hash['ghost'] = 'ghost'
205
+ @_hash['hostname'] = 'hostname'
206
+ @_hash['installed_programs_count'] = 'installed_programs_count'
207
+ @_hash['mac'] = 'mac'
208
+ @_hash['name'] = 'name'
209
+ @_hash['network_id'] = 'network_id'
210
+ @_hash['num_alerts'] = 'num_alerts'
211
+ @_hash['patch_count'] = 'patch_count'
212
+ @_hash['parsed'] = 'parsed'
213
+ @_hash['protocol'] = 'protocol'
214
+ @_hash['purdue_level'] = 'purdue_level'
215
+ @_hash['risk_level'] = 'risk_level'
216
+ @_hash['site_name'] = 'site_name'
217
+ @_hash['special_hint'] = 'special_hint_'
218
+ @_hash['special_hint_name'] = 'special_hint_name'
219
+ @_hash['vlan'] = 'vlan'
220
+ @_hash['virtual_zone_id'] = 'virtual_zone_id'
221
+ @_hash['virtual_zone_name'] = 'virtual_zone_name'
222
+ @_hash['vendor'] = 'vendor'
223
+ @_hash['valid'] = 'valid'
224
+ @_hash['subnet_id'] = 'subnet_id'
225
+ @_hash['usb_devices_count'] = 'usb_devices_count'
226
+ @_hash['timestamp'] = 'timestamp'
227
+ @_hash['network'] = 'network'
228
+ @_hash['active_queries_names'] = 'active_queries_names'
229
+ @_hash['active_scans_names'] = 'active_scans_names'
230
+ @_hash['children'] = 'children'
231
+ @_hash['custom_attributes'] = 'custom_attributes'
232
+ @_hash['custom_informations'] = 'custom_informations'
233
+ @_hash['insight_names'] = 'insight_names'
234
+ @_hash['code_sections'] = 'code_sections'
235
+ @_hash
236
+ end
237
+
238
+ # An array for optional fields
239
+ def self.optionals
240
+ %w[
241
+ resource_id
242
+ id
243
+ site_id
244
+ approved
245
+ asset_type_number
246
+ asset_type_name
247
+ class_type
248
+ criticality_number
249
+ criticality_name
250
+ display_name
251
+ first_seen
252
+ last_seen
253
+ last_updated
254
+ ghost
255
+ hostname
256
+ installed_programs_count
257
+ mac
258
+ name
259
+ network_id
260
+ num_alerts
261
+ patch_count
262
+ parsed
263
+ protocol
264
+ purdue_level
265
+ risk_level
266
+ site_name
267
+ special_hint
268
+ special_hint_name
269
+ vlan
270
+ virtual_zone_id
271
+ virtual_zone_name
272
+ vendor
273
+ valid
274
+ subnet_id
275
+ usb_devices_count
276
+ timestamp
277
+ network
278
+ active_queries_names
279
+ active_scans_names
280
+ children
281
+ custom_attributes
282
+ custom_informations
283
+ insight_names
284
+ code_sections
285
+ ]
286
+ end
287
+
288
+ # An array for nullable fields
289
+ def self.nullables
290
+ []
291
+ end
292
+
293
+ def initialize(resource_id = SKIP,
294
+ id = SKIP,
295
+ site_id = SKIP,
296
+ approved = SKIP,
297
+ asset_type_number = SKIP,
298
+ asset_type_name = SKIP,
299
+ class_type = SKIP,
300
+ criticality_number = SKIP,
301
+ criticality_name = SKIP,
302
+ display_name = SKIP,
303
+ first_seen = SKIP,
304
+ last_seen = SKIP,
305
+ last_updated = SKIP,
306
+ ghost = SKIP,
307
+ hostname = SKIP,
308
+ installed_programs_count = SKIP,
309
+ mac = SKIP,
310
+ name = SKIP,
311
+ network_id = SKIP,
312
+ num_alerts = SKIP,
313
+ patch_count = SKIP,
314
+ parsed = SKIP,
315
+ protocol = SKIP,
316
+ purdue_level = 3,
317
+ risk_level = SKIP,
318
+ site_name = SKIP,
319
+ special_hint = SKIP,
320
+ special_hint_name = SKIP,
321
+ vlan = SKIP,
322
+ virtual_zone_id = SKIP,
323
+ virtual_zone_name = SKIP,
324
+ vendor = SKIP,
325
+ valid = SKIP,
326
+ subnet_id = SKIP,
327
+ usb_devices_count = SKIP,
328
+ timestamp = SKIP,
329
+ network = SKIP,
330
+ active_queries_names = SKIP,
331
+ active_scans_names = SKIP,
332
+ children = SKIP,
333
+ custom_attributes = SKIP,
334
+ custom_informations = SKIP,
335
+ insight_names = SKIP,
336
+ code_sections = SKIP)
337
+ @resource_id = resource_id unless resource_id == SKIP
338
+ @id = id unless id == SKIP
339
+ @site_id = site_id unless site_id == SKIP
340
+ @approved = approved unless approved == SKIP
341
+ @asset_type_number = asset_type_number unless asset_type_number == SKIP
342
+ @asset_type_name = asset_type_name unless asset_type_name == SKIP
343
+ @class_type = class_type unless class_type == SKIP
344
+ @criticality_number = criticality_number unless criticality_number == SKIP
345
+ @criticality_name = criticality_name unless criticality_name == SKIP
346
+ @display_name = display_name unless display_name == SKIP
347
+ @first_seen = first_seen unless first_seen == SKIP
348
+ @last_seen = last_seen unless last_seen == SKIP
349
+ @last_updated = last_updated unless last_updated == SKIP
350
+ @ghost = ghost unless ghost == SKIP
351
+ @hostname = hostname unless hostname == SKIP
352
+ @installed_programs_count = installed_programs_count unless installed_programs_count == SKIP
353
+ @mac = mac unless mac == SKIP
354
+ @name = name unless name == SKIP
355
+ @network_id = network_id unless network_id == SKIP
356
+ @num_alerts = num_alerts unless num_alerts == SKIP
357
+ @patch_count = patch_count unless patch_count == SKIP
358
+ @parsed = parsed unless parsed == SKIP
359
+ @protocol = protocol unless protocol == SKIP
360
+ @purdue_level = purdue_level unless purdue_level == SKIP
361
+ @risk_level = risk_level unless risk_level == SKIP
362
+ @site_name = site_name unless site_name == SKIP
363
+ @special_hint = special_hint unless special_hint == SKIP
364
+ @special_hint_name = special_hint_name unless special_hint_name == SKIP
365
+ @vlan = vlan unless vlan == SKIP
366
+ @virtual_zone_id = virtual_zone_id unless virtual_zone_id == SKIP
367
+ @virtual_zone_name = virtual_zone_name unless virtual_zone_name == SKIP
368
+ @vendor = vendor unless vendor == SKIP
369
+ @valid = valid unless valid == SKIP
370
+ @subnet_id = subnet_id unless subnet_id == SKIP
371
+ @usb_devices_count = usb_devices_count unless usb_devices_count == SKIP
372
+ @timestamp = timestamp unless timestamp == SKIP
373
+ @network = network unless network == SKIP
374
+ @active_queries_names = active_queries_names unless active_queries_names == SKIP
375
+ @active_scans_names = active_scans_names unless active_scans_names == SKIP
376
+ @children = children unless children == SKIP
377
+ @custom_attributes = custom_attributes unless custom_attributes == SKIP
378
+ @custom_informations = custom_informations unless custom_informations == SKIP
379
+ @insight_names = insight_names unless insight_names == SKIP
380
+ @code_sections = code_sections unless code_sections == SKIP
381
+ end
382
+
383
+ # Creates an instance of the object from a hash.
384
+ def self.from_hash(hash)
385
+ return nil unless hash
386
+
387
+ # Extract variables from the hash.
388
+ resource_id = hash.key?('resource_id') ? hash['resource_id'] : SKIP
389
+ id = hash.key?('id') ? hash['id'] : SKIP
390
+ site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
391
+ approved = hash.key?('approved') ? hash['approved'] : SKIP
392
+ asset_type_number =
393
+ hash.key?('asset_type_number') ? hash['asset_type_number'] : SKIP
394
+ asset_type_name =
395
+ hash.key?('asset_type_name') ? hash['asset_type_name'] : SKIP
396
+ class_type = hash.key?('class_type') ? hash['class_type'] : SKIP
397
+ criticality_number =
398
+ hash.key?('criticality_number') ? hash['criticality_number'] : SKIP
399
+ criticality_name =
400
+ hash.key?('criticality_name') ? hash['criticality_name'] : SKIP
401
+ display_name = hash.key?('display_name') ? hash['display_name'] : SKIP
402
+ first_seen = hash.key?('first_seen') ? hash['first_seen'] : SKIP
403
+ last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP
404
+ last_updated = hash.key?('last_updated') ? hash['last_updated'] : SKIP
405
+ ghost = hash.key?('ghost') ? hash['ghost'] : SKIP
406
+ hostname = hash.key?('hostname') ? hash['hostname'] : SKIP
407
+ installed_programs_count =
408
+ hash.key?('installed_programs_count') ? hash['installed_programs_count'] : SKIP
409
+ mac = hash.key?('mac') ? hash['mac'] : SKIP
410
+ name = hash.key?('name') ? hash['name'] : SKIP
411
+ network_id = hash.key?('network_id') ? hash['network_id'] : SKIP
412
+ num_alerts = hash.key?('num_alerts') ? hash['num_alerts'] : SKIP
413
+ patch_count = hash.key?('patch_count') ? hash['patch_count'] : SKIP
414
+ parsed = hash.key?('parsed') ? hash['parsed'] : SKIP
415
+ protocol = hash.key?('protocol') ? hash['protocol'] : SKIP
416
+ purdue_level = hash['purdue_level'] ||= 3
417
+ risk_level = hash.key?('risk_level') ? hash['risk_level'] : SKIP
418
+ site_name = hash.key?('site_name') ? hash['site_name'] : SKIP
419
+ special_hint = hash.key?('special_hint_') ? hash['special_hint_'] : SKIP
420
+ special_hint_name =
421
+ hash.key?('special_hint_name') ? hash['special_hint_name'] : SKIP
422
+ vlan = hash.key?('vlan') ? hash['vlan'] : SKIP
423
+ virtual_zone_id =
424
+ hash.key?('virtual_zone_id') ? hash['virtual_zone_id'] : SKIP
425
+ virtual_zone_name =
426
+ hash.key?('virtual_zone_name') ? hash['virtual_zone_name'] : SKIP
427
+ vendor = hash.key?('vendor') ? hash['vendor'] : SKIP
428
+ valid = hash.key?('valid') ? hash['valid'] : SKIP
429
+ subnet_id = hash.key?('subnet_id') ? hash['subnet_id'] : SKIP
430
+ usb_devices_count =
431
+ hash.key?('usb_devices_count') ? hash['usb_devices_count'] : SKIP
432
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
433
+ network = Network.from_hash(hash['network']) if hash['network']
434
+ active_queries_names =
435
+ hash.key?('active_queries_names') ? hash['active_queries_names'] : SKIP
436
+ active_scans_names =
437
+ hash.key?('active_scans_names') ? hash['active_scans_names'] : SKIP
438
+ # Parameter is an array, so we need to iterate through it
439
+ children = nil
440
+ unless hash['children'].nil?
441
+ children = []
442
+ hash['children'].each do |structure|
443
+ children << (Object.from_hash(structure) if structure)
444
+ end
445
+ end
446
+
447
+ children = SKIP unless hash.key?('children')
448
+ # Parameter is an array, so we need to iterate through it
449
+ custom_attributes = nil
450
+ unless hash['custom_attributes'].nil?
451
+ custom_attributes = []
452
+ hash['custom_attributes'].each do |structure|
453
+ custom_attributes << (Object.from_hash(structure) if structure)
454
+ end
455
+ end
456
+
457
+ custom_attributes = SKIP unless hash.key?('custom_attributes')
458
+ # Parameter is an array, so we need to iterate through it
459
+ custom_informations = nil
460
+ unless hash['custom_informations'].nil?
461
+ custom_informations = []
462
+ hash['custom_informations'].each do |structure|
463
+ custom_informations << (Object.from_hash(structure) if structure)
464
+ end
465
+ end
466
+
467
+ custom_informations = SKIP unless hash.key?('custom_informations')
468
+ insight_names = hash.key?('insight_names') ? hash['insight_names'] : SKIP
469
+ # Parameter is an array, so we need to iterate through it
470
+ code_sections = nil
471
+ unless hash['code_sections'].nil?
472
+ code_sections = []
473
+ hash['code_sections'].each do |structure|
474
+ code_sections << (CodeSections.from_hash(structure) if structure)
475
+ end
476
+ end
477
+
478
+ code_sections = SKIP unless hash.key?('code_sections')
479
+
480
+ # Create object from extracted values.
481
+ Asset.new(resource_id,
482
+ id,
483
+ site_id,
484
+ approved,
485
+ asset_type_number,
486
+ asset_type_name,
487
+ class_type,
488
+ criticality_number,
489
+ criticality_name,
490
+ display_name,
491
+ first_seen,
492
+ last_seen,
493
+ last_updated,
494
+ ghost,
495
+ hostname,
496
+ installed_programs_count,
497
+ mac,
498
+ name,
499
+ network_id,
500
+ num_alerts,
501
+ patch_count,
502
+ parsed,
503
+ protocol,
504
+ purdue_level,
505
+ risk_level,
506
+ site_name,
507
+ special_hint,
508
+ special_hint_name,
509
+ vlan,
510
+ virtual_zone_id,
511
+ virtual_zone_name,
512
+ vendor,
513
+ valid,
514
+ subnet_id,
515
+ usb_devices_count,
516
+ timestamp,
517
+ network,
518
+ active_queries_names,
519
+ active_scans_names,
520
+ children,
521
+ custom_attributes,
522
+ custom_informations,
523
+ insight_names,
524
+ code_sections)
525
+ end
526
+ end
527
+ end