Spam Detector API - Ruby Gem
Spam Detector is a simple tool for detecting spam in a text. It utilize an email address or IP address to validate the given text against the spam database.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_spamdetector'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_spamdetector
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_spamdetector'
# Initialize the client
client = APIVerve::Spamdetector::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
text: "Can you please spare some change?! Desperate!!! Send cash",
email: "bankers@fre.323hotlain.net",
ip: "122.180.184.182"
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ text: "Can you please spare some change?! Desperate!!! Send cash", email: "bankers@fre.323hotlain.net", ip: "122.180.184.182" })
puts response["data"]
rescue APIVerve::Spamdetector::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Spamdetector::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Spamdetector::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"likelySpam": true,
"isDisposableEmail": false,
"isIPBlacklisted": false,
"ipDetails": {
"country": "IN",
"region": "DL"
},
"parsed": true
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/spamdetector?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.