Class: Spam::HamService

Inherits:
Object
  • Object
show all
Includes:
AkismetMethods
Defined in:
app/services/spam/ham_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AkismetMethods

#akismet, #target_owner

Constructor Details

#initialize(spam_log) ⇒ HamService

Returns a new instance of HamService.



9
10
11
12
13
14
15
16
# File 'app/services/spam/ham_service.rb', line 9

def initialize(spam_log)
  @spam_log = spam_log
  @user = spam_log.user
  @options = {
      ip_address: spam_log.source_ip,
      user_agent: spam_log.user_agent
  }
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'app/services/spam/ham_service.rb', line 7

def options
  @options
end

#spam_logObject Also known as: target

Returns the value of attribute spam_log.



7
8
9
# File 'app/services/spam/ham_service.rb', line 7

def spam_log
  @spam_log
end

Instance Method Details

#executeObject



18
19
20
21
22
23
24
# File 'app/services/spam/ham_service.rb', line 18

def execute
  if akismet.submit_ham
    spam_log.update_attribute(:submitted_as_ham, true)
  else
    false
  end
end