Ruby wrapper for stopforumspam.com API.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
Gemfile
LICENSE
README.md
ruby-stopforumspam.gemspec

README.md

ruby-stopforumspam

Ruby wrapper for stopforumspam.com API. Check IP addresses, email addresses, and usernames for known spam activity.

Usage

Add the gem to your Gemfile:

gem 'ruby-stopforumspam'

Then in your project:

require 'stopforumspam'

spam_check = StopForumSpam::Check.new(parameters)
spam.check.spammer? # returns Boolean
spam.check.result   # returns Hash

Supply a String to check one IP address, e-mail, or username:

spam_check = StopForumSpam::Check.new('198.51.100.1')
spam_check.spammer? # is this person a spammer?
=> false
spam_check.result   # see full results from API
=> {"ip"=>{"value"=>"198.51.100.1", "frequency"=>"0", "appears"=>"0"}}

Or supply an Array of Strings:

spam_check = StopForumSpam::Check.new(['198.51.100.1', 'test@example.com'])
spam_check.spammer?
=> true
spam_check.result
=> {"ip"=>{"value"=>"198.51.100.1", "frequency"=>"0", "appears"=>"0"}, "email"=>{"value"=>"test@example.com", "lastseen"=>"2014-10-06 13:33:08", "frequency"=>"3", "appears"=>"1"}}

Or supply an Array of Hashes to override the check type (e.g. to force a username check for a string that looks like an IP address):

spam_check = StopForumSpam::Check.new([{check: '198.51.100.1', type: 'username'}])
spam_check.spammer?
=> true
spam_check.result
=> {"username"=>{"value"=>"198.51.100.1", "frequency"=>"0", "appears"=>"0"}}

License

MIT license. See LICENSE.

Author

Warren Guy warren@guy.net.au

https://warrenguy.me