diff options
author | Patricio Cano <suprnova32@gmail.com> | 2016-08-09 12:43:47 -0500 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2016-08-15 17:20:57 -0500 |
commit | 5994c11910822463faeabb7b5f11d6529036db9d (patch) | |
tree | a80a8ffea4d4ef868790aab627abfcaa1c982d10 /app/services/ham_service.rb | |
parent | 43e756d4eafd79f4d2f366b646ebb94af78b5a4c (diff) | |
download | gitlab-ce-5994c11910822463faeabb7b5f11d6529036db9d.tar.gz |
Further refactor and syntax fixes.
Diffstat (limited to 'app/services/ham_service.rb')
-rw-r--r-- | app/services/ham_service.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/services/ham_service.rb b/app/services/ham_service.rb new file mode 100644 index 00000000000..b0e1799b489 --- /dev/null +++ b/app/services/ham_service.rb @@ -0,0 +1,26 @@ +class HamService + attr_accessor :spam_log + + def initialize(spam_log) + @spam_log = spam_log + end + + def mark_as_ham! + if akismet.submit_ham + spam_log.update_attribute(:submitted_as_ham, true) + else + false + end + end + + private + + def akismet + @akismet ||= AkismetService.new( + spam_log.user, + spam_log.text, + ip_address: spam_log.source_ip, + user_agent: spam_log.user_agent + ) + end +end |