Class: NoradBeacon::Result
- Inherits:
-
Object
- Object
- NoradBeacon::Result
- Defined in:
- lib/norad_beacon/result.rb
Constant Summary collapse
- SIGNATURE_DIGEST =
I’m making this value a constant to reinforce the idea that it should never change. If it does, all ignore rules in the Norad database will be invalidated.
OpenSSL::Digest::SHA256
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#nid ⇒ Object
readonly
Returns the value of attribute nid.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#sir ⇒ Object
readonly
Returns the value of attribute sir.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(nid, status, output, title, description, sir = 'unevaluated', text_to_fingerprint = nil) ⇒ Result
constructor
rubocop:disable ParameterLists.
-
#to_json(*a) ⇒ Object
rubocop:enable ParameterLists.
Constructor Details
#initialize(nid, status, output, title, description, sir = 'unevaluated', text_to_fingerprint = nil) ⇒ Result
rubocop:disable ParameterLists
15 16 17 18 19 20 21 22 23 |
# File 'lib/norad_beacon/result.rb', line 15 def initialize(nid, status, output, title, description, sir = 'unevaluated', text_to_fingerprint = nil) @nid = nid.to_s @sir = cvss_to_sir(sir) @status = status.to_s @output = output.to_s @title = title.to_s @description = description.to_s @signature = compute_signature(text_to_fingerprint) end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/norad_beacon/result.rb', line 8 def description @description end |
#nid ⇒ Object (readonly)
Returns the value of attribute nid.
8 9 10 |
# File 'lib/norad_beacon/result.rb', line 8 def nid @nid end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
8 9 10 |
# File 'lib/norad_beacon/result.rb', line 8 def output @output end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
8 9 10 |
# File 'lib/norad_beacon/result.rb', line 8 def signature @signature end |
#sir ⇒ Object (readonly)
Returns the value of attribute sir.
8 9 10 |
# File 'lib/norad_beacon/result.rb', line 8 def sir @sir end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/norad_beacon/result.rb', line 8 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/norad_beacon/result.rb', line 8 def title @title end |
Instance Method Details
#to_json(*a) ⇒ Object
rubocop:enable ParameterLists
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/norad_beacon/result.rb', line 26 def to_json(*a) { nid: nid, sir: sir, status: status, output: output, title: title, description: description, signature: signature }.to_json(*a) end |