Module: Blogspam::Concern

Extended by:
ActiveSupport::Concern
Defined in:
lib/blogspam/concern.rb

Instance Method Summary collapse

Instance Method Details

#blogspam_argsObject

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/blogspam/concern.rb', line 12

def blogspam_args
  raise NotImplementedError, "You need to implement `blogspam_args` in your model to pass in the attributes blogspam can use to analyze the comment."
end

#check_spam!Object



16
17
18
19
20
21
22
# File 'lib/blogspam/concern.rb', line 16

def check_spam!
  response = Blogspam.check_spam(blogspam_args)

  if response["result"] == "SPAM"
    update!(is_spam: true, spam_reason: response["reason"])
  end
end