Class: Spam::MarkAsSpamService

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AkismetMethods

#akismet, #target_owner

Constructor Details

#initialize(target:) ⇒ MarkAsSpamService

Returns a new instance of MarkAsSpamService.


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

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

  @options[:ip_address] = @target.ip_address
  @options[:user_agent] = @target.user_agent
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options


7
8
9
# File 'app/services/spam/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/mark_as_spam_service.rb', line 7

def target
  @target
end

Instance Method Details

#executeObject


17
18
19
20
21
22
# File 'app/services/spam/mark_as_spam_service.rb', line 17

def execute
  return unless target.submittable_as_spam?
  return unless akismet.submit_spam

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