cloudmersive-spam-detection-api-client

CloudmersiveSpamDetectionApiClient - the Ruby gem for the spamapi

Easily and directly scan and block spam security threats in input.

This SDK is automatically generated by the Swagger Codegen project:

  • API version: v1
  • Package version: 2.4.2
  • Build package: io.swagger.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build cloudmersive-spam-detection-api-client.gemspec

Then either install the gem locally:

gem install ./cloudmersive-spam-detection-api-client-2.4.2.gem

(for development, run gem install --dev ./cloudmersive-spam-detection-api-client-2.4.2.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'cloudmersive-spam-detection-api-client', '~> 2.4.2'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'cloudmersive-spam-detection-api-client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'cloudmersive-spam-detection-api-client'

# Setup authorization
CloudmersiveSpamDetectionApiClient.configure do |config|
  # Configure API key authorization: Apikey
  config.api_key['Apikey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['Apikey'] = 'Bearer'
end

api_instance = CloudmersiveSpamDetectionApiClient::SpamDetectionApi.new

opts = { 
  model: 'Advanced', # String | Optional: Specify which AI model to use.  Possible choices are Normal and Advanced.  Default is Advanced.
  preprocessing: 'Auto', # String | Optional: Specify which preprocessing to Use.  Possible choices are None, Compatability and Auto.  Default is Auto.
  allow_phishing: false, # BOOLEAN | True if phishing should be allowed, false otherwise
  allow_unsolicited_sales: false, # BOOLEAN | True if unsolicited sales should be allowed, false otherwise
  allow_promotional_content: true, # BOOLEAN | True if promotional content should be allowed, false otherwise
  custom_policy_id: 'custom_policy_id_example', # String | Apply a Custom Policy for Spam Enforcement by providing the ID; to create a Custom Policy, navigate to the Cloudmersive Management Portal and select Custom Policies.  Requires Managed Instance or Private Cloud
  input_file: File.new('/path/to/file.txt') # File | 
}

begin
  #Perform advanced AI spam detection and classification against input text file.
  result = api_instance.spam_detect_file_advanced_post(opts)
  p result
rescue CloudmersiveSpamDetectionApiClient::ApiError => e
  puts "Exception when calling SpamDetectionApi->spam_detect_file_advanced_post: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://api.cloudmersive.com

Class Method HTTP request Description
CloudmersiveSpamDetectionApiClient::SpamDetectionApi spam_detect_file_advanced_post POST /spam/detect/file/advanced Perform advanced AI spam detection and classification against input text file.
CloudmersiveSpamDetectionApiClient::SpamDetectionApi spam_detect_file_post POST /spam/detect/file Perform AI spam detection and classification on an input image or document (PDF or DOCX)
CloudmersiveSpamDetectionApiClient::SpamDetectionApi spam_detect_form_submission_advanced_post POST /spam/detect/form-submission/advanced Perform advanced AI spam detection and classification against a form submission
CloudmersiveSpamDetectionApiClient::SpamDetectionApi spam_detect_text_string_advanced_post POST /spam/detect/text-string/advanced Perform advanced AI spam detection and classification against input text string
CloudmersiveSpamDetectionApiClient::SpamDetectionApi spam_detect_text_string_post POST /spam/detect/text-string Perform AI spam detection and classification against input text string

Documentation for Models

Documentation for Authorization

Apikey

  • Type: API key
  • API key parameter name: Apikey
  • Location: HTTP header