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
optionshave 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.
6 7 8 |
# File 'lib/viking/base.rb', line 6 def initialize( = {}) self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/viking/base.rb', line 4 def end |
Class Method Details
.logger ⇒ Object
48 49 50 |
# File 'lib/viking/base.rb', line 48 def self.logger Viking.logger end |
Instance Method Details
#check_article(options = {}) ⇒ Object
13 14 |
# File 'lib/viking/base.rb', line 13 def check_article( = {}) end |
#check_comment(options = {}) ⇒ Object
16 17 |
# File 'lib/viking/base.rb', line 16 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.
61 62 63 |
# File 'lib/viking/base.rb', line 61 def self.[:api_key].nil? || self.[:blog].nil? end |
#logger ⇒ Object
44 45 46 |
# File 'lib/viking/base.rb', line 44 def logger Viking.logger end |
#mark_as_ham(options = {}) ⇒ Object
22 23 |
# File 'lib/viking/base.rb', line 22 def mark_as_ham( = {}) end |
#mark_as_spam(options = {}) ⇒ Object
19 20 |
# File 'lib/viking/base.rb', line 19 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_spamormark_as_hamaccepts
37 38 39 |
# File 'lib/viking/base.rb', line 37 def mark_as_spam_or_ham(is_spam, = {}) is_spam ? mark_as_spam() : mark_as_ham() end |
#stats ⇒ Object
41 42 |
# File 'lib/viking/base.rb', line 41 def stats end |
#verified? ⇒ Boolean
10 11 |
# File 'lib/viking/base.rb', line 10 def verified? end |