Class: Mailosaur::Analysis
- Inherits:
-
Object
- Object
- Mailosaur::Analysis
- Defined in:
- lib/Mailosaur/analysis.rb
Instance Attribute Summary collapse
-
#conn ⇒ Connection
readonly
The client connection.
Instance Method Summary collapse
-
#deliverability(email) ⇒ DeliverabilityReport
Perform a deliverability report.
-
#initialize(conn, handle_http_error) ⇒ Analysis
constructor
Creates and initializes a new instance of the Analysis class.
-
#spam(email) ⇒ SpamAnalysisResult
Perform a spam test.
Constructor Details
#initialize(conn, handle_http_error) ⇒ Analysis
Creates and initializes a new instance of the Analysis class.
7 8 9 10 |
# File 'lib/Mailosaur/analysis.rb', line 7 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.
13 14 15 |
# File 'lib/Mailosaur/analysis.rb', line 13 def conn @conn end |
Instance Method Details
#deliverability(email) ⇒ DeliverabilityReport
Perform a deliverability report
Perform deliverability test on the specified email
40 41 42 43 44 45 |
# File 'lib/Mailosaur/analysis.rb', line 40 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) ⇒ SpamAnalysisResult
Perform a spam test
Perform spam testing on the specified email
24 25 26 27 28 29 |
# 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.parse(response.body) Mailosaur::Models::SpamAnalysisResult.new(model) end |