soar_auditor_api 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a9ba1d77677113f3375191caebf327bfad36f1f
4
- data.tar.gz: 9efa8269bab0e41e31cf15abecc2db0c7101dda4
3
+ metadata.gz: a5030e0bde899627dc4b7948d62c7beb4083c7cc
4
+ data.tar.gz: 2ab287eb385b783aaf66035ff2e5519c36f7dca1
5
5
  SHA512:
6
- metadata.gz: ce4b59f664afa5a328b908e2bd0ceff3024e64911299815ff0e364fa9617eeadd1ab56b2daa17ccd3023970aa5ad858cf6d41489db01674a6f2ac1feaf7df3a0
7
- data.tar.gz: d2ba12493e66420f096e423d7aa78ae2e93e9176e95b0eaa1fca36fb730fdbc3355ae15648460ef701ae08895d2aa0369c49b10ce44c0c0ccd957956fa083949
6
+ metadata.gz: e9be17c974061665baf108a1cd9471cb2def004f911c25dd486aa47e77ab4508107d90edbf56d551d9414baefa36898359e4bff96d7f6a20a15601d8f00fb903
7
+ data.tar.gz: 22badc8a993560166dec0a4f1e0f05f7914fbebf81fbc749cc635d1fa723f5be31812e8fe59f2b8d7143607d07811a6eee11bbc55fa91bc034419af802fdf352
@@ -1,5 +1,6 @@
1
1
  require 'soar_auditor_api/version'
2
2
  require 'soar_auditor_api/auditor_api'
3
+ require 'soar_auditor_api/serializable'
3
4
 
4
5
  module SoarAuditorApi
5
6
  end
@@ -1,15 +1,10 @@
1
1
  module SoarAuditorApi
2
2
  class AuditorAPI
3
- DEBUG_PREFIX = "debug:" unless defined? DEBUG_PREFIX; DEBUG_PREFIX.freeze
4
- INFO_PREFIX = "info:" unless defined? INFO_PREFIX; INFO_PREFIX.freeze
5
- WARN_PREFIX = "warn:" unless defined? WARN_PREFIX; WARN_PREFIX.freeze
6
- ERROR_PREFIX = "error:" unless defined? ERROR_PREFIX; ERROR_PREFIX.freeze
7
- FATAL_PREFIX = "fatal:" unless defined? FATAL_PREFIX; FATAL_PREFIX.freeze
3
+ AUDIT_LEVELS = [:debug, :info, :warn, :error, :fatal] unless defined? AUDIT_LEVELS; AUDIT_LEVELS.freeze
8
4
 
9
5
  def initialize
10
6
  @configuration = nil
11
7
  @minimum_audit_level = :info
12
- @audit_levels = [:debug, :info, :warn, :error, :fatal]
13
8
  end
14
9
 
15
10
  def configure(configuration = nil)
@@ -18,32 +13,32 @@ module SoarAuditorApi
18
13
  end
19
14
 
20
15
  def set_audit_level(minimum_audit_level)
21
- raise ArgumentError, "Invalid audit level specified" unless @audit_levels.include?(minimum_audit_level)
16
+ raise ArgumentError, "Invalid audit level specified" unless AUDIT_LEVELS.include?(minimum_audit_level)
22
17
  @minimum_audit_level = minimum_audit_level
23
18
  end
24
19
 
25
20
  def debug(data)
26
- audit(DEBUG_PREFIX + data.to_s) if audit_filtered_out?(:debug)
21
+ audit(data.to_s) if audit_filtered_out?(:debug)
27
22
  end
28
23
 
29
24
  def <<(data)
30
- audit(INFO_PREFIX + data.to_s) if audit_filtered_out?(:info)
25
+ audit(data.to_s) if audit_filtered_out?(:info)
31
26
  end
32
27
 
33
28
  def info(data)
34
- audit(INFO_PREFIX + data.to_s) if audit_filtered_out?(:info)
29
+ audit(data.to_s) if audit_filtered_out?(:info)
35
30
  end
36
31
 
37
32
  def warn(data)
38
- audit(WARN_PREFIX + data.to_s) if audit_filtered_out?(:warn)
33
+ audit(data.to_s) if audit_filtered_out?(:warn)
39
34
  end
40
35
 
41
36
  def error(data)
42
- audit(ERROR_PREFIX + data.to_s) if audit_filtered_out?(:error)
37
+ audit(data.to_s) if audit_filtered_out?(:error)
43
38
  end
44
39
 
45
40
  def fatal(data)
46
- audit(FATAL_PREFIX + data.to_s) if audit_filtered_out?(:fatal)
41
+ audit(data.to_s) if audit_filtered_out?(:fatal)
47
42
  end
48
43
 
49
44
  #Safety to ensure that the Auditor that extends this API implements this IOC method
@@ -59,7 +54,7 @@ module SoarAuditorApi
59
54
  private
60
55
 
61
56
  def audit_filtered_out?(audit_level)
62
- return @audit_levels.index(@minimum_audit_level) <= @audit_levels.index(audit_level)
57
+ return AUDIT_LEVELS.index(@minimum_audit_level) <= AUDIT_LEVELS.index(audit_level)
63
58
  end
64
59
  end
65
60
  end
@@ -1,3 +1,3 @@
1
1
  module SoarAuditorApi
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/sanity/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'byebug'
4
- gem 'soar_auditor_api', "~> 0.0.5"
4
+ gem 'soar_auditor_api', "~> 0.0.6"
data/sanity/sanity.rb CHANGED
@@ -2,7 +2,7 @@ require 'soar_auditor_api'
2
2
  require 'byebug'
3
3
 
4
4
  class SanityAuditor < SoarAuditorApi::AuditorAPI
5
- def configuration_is_valid(configuration)
5
+ def configuration_is_valid?(configuration)
6
6
  return configuration.include?("preprefix")
7
7
  end
8
8
 
@@ -11,6 +11,11 @@ class SanityAuditor < SoarAuditorApi::AuditorAPI
11
11
  end
12
12
  end
13
13
 
14
+ class MyStackTrace < SoarAuditorApi::Serializable
15
+ def to_s
16
+ serialize()
17
+ end
18
+
14
19
  class Main
15
20
  def test_sanity
16
21
  @iut = SanityAuditor.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar_auditor_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barney de Villiers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler