Class: SoarAuditingProvider::AuditingProviderAPI
- Inherits:
-
Object
- Object
- SoarAuditingProvider::AuditingProviderAPI
- Defined in:
- lib/soar_auditing_provider_api/auditing_provider_api.rb
Constant Summary collapse
- DEFAULT =
{}
Instance Attribute Summary collapse
-
#auditor ⇒ Object
Returns the value of attribute auditor.
-
#auditors ⇒ Object
Returns the value of attribute auditors.
Instance Method Summary collapse
- #<<(data) ⇒ Object
- #debug(data) ⇒ Object
- #error(data) ⇒ Object
- #fatal(data) ⇒ Object
- #info(data) ⇒ Object
-
#initialize(auditors) ⇒ AuditingProviderAPI
constructor
A new instance of AuditingProviderAPI.
- #select(nfrs = DEFAULT) ⇒ Object
- #warn(data) ⇒ Object
Constructor Details
#initialize(auditors) ⇒ AuditingProviderAPI
Returns a new instance of AuditingProviderAPI.
8 9 10 11 12 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 8 def initialize(auditors) raise ArgumentError.new("Invalid auditors provided") if not auditors.is_a?(Hash) raise ArgumentError.new("No auditors provided") if auditors.nil? or auditors.empty? @auditors = auditors end |
Instance Attribute Details
#auditor ⇒ Object
Returns the value of attribute auditor.
6 7 8 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 6 def auditor @auditor end |
#auditors ⇒ Object
Returns the value of attribute auditors.
5 6 7 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 5 def auditors @auditors end |
Instance Method Details
#<<(data) ⇒ Object
18 19 20 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 18 def <<(data) @auditor.info(data) end |
#debug(data) ⇒ Object
14 15 16 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 14 def debug(data) @auditor.debug(data) end |
#error(data) ⇒ Object
26 27 28 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 26 def error(data) @auditor.error(data) end |
#fatal(data) ⇒ Object
34 35 36 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 34 def fatal(data) @auditor.fatal(data) end |
#info(data) ⇒ Object
22 23 24 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 22 def info(data) @auditor.info(data) end |
#select(nfrs = DEFAULT) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 38 def select(nfrs = DEFAULT) if nfrs.nil? or nfrs.empty? auditor_selected = auditors.keys.first else auditor_selected = nil auditors.each do |auditor, configuration| auditor_nfrs = configuration['nfrs'] nfrs_matched = true nfrs.each do |nfr, value| nfrs_matched = false if not auditor_nfrs[nfr] or (auditor_nfrs[nfr] != value) end if nfrs_matched auditor_selected = auditor break end end raise NFRMatchError.new("Could not match NFRs to an auditor") if auditor_selected.nil? end configuration = auditors[auditor_selected] @auditor = auditor_selected return @auditor, configuration end |
#warn(data) ⇒ Object
30 31 32 |
# File 'lib/soar_auditing_provider_api/auditing_provider_api.rb', line 30 def warn(data) @auditor.warn(data) end |