Class: Spam::AkismetMarkAsSpamService

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AkismetMethods

#akismet, #target_owner

Constructor Details

#initialize(target:) ⇒ AkismetMarkAsSpamService

Returns a new instance of AkismetMarkAsSpamService.



9
10
11
12
# File 'app/services/spam/akismet_mark_as_spam_service.rb', line 9

def initialize(target:)
  @target = target
  @options = {}
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

#targetObject

Returns the value of attribute target.



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

def target
  @target
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
# File 'app/services/spam/akismet_mark_as_spam_service.rb', line 14

def execute
  @options[:ip_address] = @target.ip_address
  @options[:user_agent] = @target.user_agent

  return unless target.submittable_as_spam?
  return unless akismet.submit_spam

  target.user_agent_detail.update_attribute(:submitted, true)
end