Module: Viking

Defined in:
lib/viking.rb,
lib/viking/base.rb,
lib/viking/akismet.rb,
lib/viking/version.rb,
lib/viking/defensio.rb

Overview

Defensio

Adapted from code originally by Technoweenie. Updated to the 1.2 API, and refactored.

License

Technoweenie fails to mention the license of his original code, so I assume that it is either under MIT or public domain. As such, I release this code under the MIT license.

Copyright © 2008, James Herdman

Important Note

  • most documentation below is adapted from the Defensio API (v 1.2) manual

  • unless otherwise stated, all arguments are expected to be Strings

Defined Under Namespace

Classes: Akismet, Base, Defensio, Error

Constant Summary collapse

VERSION =
"1.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.connect_optionsObject

Returns the value of attribute connect_options.



32
33
34
# File 'lib/viking.rb', line 32

def connect_options
  @connect_options
end

.default_engineObject

Returns the value of attribute default_engine.



31
32
33
# File 'lib/viking.rb', line 31

def default_engine
  @default_engine
end

.default_instanceObject



35
36
37
# File 'lib/viking.rb', line 35

def default_instance
  @default_instance ||= connect(self.default_engine, self.connect_options)
end

.loggerObject

Returns the value of attribute logger.



30
31
32
# File 'lib/viking.rb', line 30

def logger
  @logger
end

Class Method Details

.check_article(options = {}) ⇒ Object



54
55
56
# File 'lib/viking.rb', line 54

def check_article(options = {})
  self.default_instance.check_article(options)
end

.check_comment(options = {}) ⇒ Object



58
59
60
# File 'lib/viking.rb', line 58

def check_comment(options = {})
  self.default_instance.check_comment(options)
end

.connect(engine, options) ⇒ Object



43
44
45
46
47
48
# File 'lib/viking.rb', line 43

def connect(engine, options)
  engine = engine.to_s
  if !engine.empty?
    Viking.const_get(engine.capitalize).new(options)
  end
end

.enabled?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/viking.rb', line 39

def enabled?
  !self.default_instance.nil?
end

.mark_as_ham(options = {}) ⇒ Object



66
67
68
# File 'lib/viking.rb', line 66

def mark_as_ham(options = {})
  self.default_instance.mark_as_ham(options)
end

.mark_as_spam(options = {}) ⇒ Object



62
63
64
# File 'lib/viking.rb', line 62

def mark_as_spam(options = {})
  self.default_instance.mark_as_spam(options)
end

.mark_as_spam_or_ham(is_spam, options = {}) ⇒ Object



74
75
76
# File 'lib/viking.rb', line 74

def mark_as_spam_or_ham(is_spam, options = {})
  self.default_instance.mark_as_spam_or_ham(is_spam, options)
end

.statsObject



70
71
72
# File 'lib/viking.rb', line 70

def stats
  self.default_instance.stats
end

.verified?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/viking.rb', line 50

def verified?
  self.default_instance.verified?
end