Class: Viking::Base
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #check_article(options = {}) ⇒ Object
- #check_comment(options = {}) ⇒ Object
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
-
#invalid_options? ⇒ Boolean
Checks to ensure that the minimum number of
options
have been provided to make a call to the spam protection service. - #logger ⇒ Object
- #mark_as_ham(options = {}) ⇒ Object
- #mark_as_spam(options = {}) ⇒ Object
-
#mark_as_spam_or_ham(is_spam, options = {}) ⇒ Object
Automatically determines whether to mark as spam or ham depending on a boolean switch,
is_spam
. - #stats ⇒ Object
- #verified? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/viking/base.rb', line 7 def initialize() self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/viking/base.rb', line 5 def @options end |
Class Method Details
Instance Method Details
#check_article(options = {}) ⇒ Object
14 15 |
# File 'lib/viking/base.rb', line 14 def check_article(={}) end |
#check_comment(options = {}) ⇒ Object
17 18 |
# File 'lib/viking/base.rb', line 17 def check_comment(={}) end |
#invalid_options? ⇒ Boolean
Checks to ensure that the minimum number of options
have been provided to make a call to the spam protection service.
Required options include:
-
api_key
-
blog
See the module for your desired spam protection service for details on the format of these options.
62 63 64 |
# File 'lib/viking/base.rb', line 62 def [:api_key].nil? || [:blog].nil? end |
#mark_as_ham(options = {}) ⇒ Object
23 24 |
# File 'lib/viking/base.rb', line 23 def mark_as_ham(={}) end |
#mark_as_spam(options = {}) ⇒ Object
20 21 |
# File 'lib/viking/base.rb', line 20 def mark_as_spam(={}) end |
#mark_as_spam_or_ham(is_spam, options = {}) ⇒ Object
Automatically determines whether to mark as spam or ham depending on a boolean switch, is_spam
. The post will be marked as spam when is_spam
is true
. The post will be marked as ham if is_spam
is false
.
Arguments
is_spam
<Boolean>-
determines whether to mark a post as spam or ham – spam when true, ham when false
options
<Hash>-
any options either
mark_as_spam
ormark_as_ham
accepts
38 39 40 |
# File 'lib/viking/base.rb', line 38 def mark_as_spam_or_ham(is_spam, ={}) is_spam ? mark_as_spam() : mark_as_ham() end |
#stats ⇒ Object
42 43 |
# File 'lib/viking/base.rb', line 42 def stats end |
#verified? ⇒ Boolean
11 12 |
# File 'lib/viking/base.rb', line 11 def verified? end |