Class: Mailosaur::Analysis
- Inherits:
-
Object
- Object
- Mailosaur::Analysis
- Defined in:
- lib/Mailosaur/analysis.rb
Overview
Operations for analyzing the content and deliverability of an email, including SpamAssassin scoring and per-provider deliverability reports. Accessed via client.analysis.
Instance Attribute Summary collapse
-
#conn ⇒ Connection
readonly
The client connection.
Instance Method Summary collapse
-
#deliverability(email) ⇒ Mailosaur::Models::DeliverabilityReport
Perform a deliverability report of an email.
-
#initialize(conn, handle_http_error) ⇒ Analysis
constructor
Creates and initializes a new instance of the Analysis class.
-
#spam(email) ⇒ Mailosaur::Models::SpamAnalysisResult
Perform a spam analysis of an email.
Constructor Details
#initialize(conn, handle_http_error) ⇒ Analysis
Creates and initializes a new instance of the Analysis class.
10 11 12 13 |
# File 'lib/Mailosaur/analysis.rb', line 10 def initialize(conn, handle_http_error) @conn = conn @handle_http_error = handle_http_error end |
Instance Attribute Details
#conn ⇒ Connection (readonly)
Returns the client connection.
16 17 18 |
# File 'lib/Mailosaur/analysis.rb', line 16 def conn @conn end |
Instance Method Details
#deliverability(email) ⇒ Mailosaur::Models::DeliverabilityReport
Perform a deliverability report of an email.
39 40 41 42 43 44 |
# File 'lib/Mailosaur/analysis.rb', line 39 def deliverability(email) response = conn.get "api/analysis/deliverability/#{email}" @handle_http_error.call(response) unless response.status == 200 model = JSON.parse(response.body) Mailosaur::Models::DeliverabilityReport.new(model) end |
#spam(email) ⇒ Mailosaur::Models::SpamAnalysisResult
Perform a spam analysis of an email.
25 26 27 28 29 30 |
# File 'lib/Mailosaur/analysis.rb', line 25 def spam(email) response = conn.get "api/analysis/spam/#{email}" @handle_http_error.call(response) unless response.status == 200 model = JSON.parse(response.body) Mailosaur::Models::SpamAnalysisResult.new(model) end |