class Mailosaur::Analysis

Attributes

conn[R]

@return [Connection] the client connection.

Public Class Methods

new(conn, handle_http_error) click to toggle source

Creates and initializes a new instance of the Analysis class. @param conn client connection.

# File lib/Mailosaur/analysis.rb, line 7
def initialize(conn, handle_http_error)
  @conn = conn
  @handle_http_error = handle_http_error
end

Public Instance Methods

spam(email) click to toggle source

Perform a spam test

Perform spam testing on the specified email

@param email The identifier of the email to be analyzed.

@return [SpamAnalysisResult] operation results.

# File lib/Mailosaur/analysis.rb, line 24
def spam(email)
  response = conn.get 'api/analysis/spam/' + email
  @handle_http_error.call(response) unless response.status == 200
  model = JSON.load(response.body)
  Mailosaur::Models::SpamAnalysisResult.new(model)
end