Class: Postmark::SpamCheck::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/postmark/spam_check/client.rb

Constant Summary collapse

SPAM_CHECK_URI =
"http://spamcheck.postmarkapp.com/filter"

Instance Method Summary collapse

Constructor Details

#initialize(timeout = 60) ⇒ Client

Returns a new instance of Client.



13
14
15
# File 'lib/postmark/spam_check/client.rb', line 13

def initialize(timeout = 60)
  @timeout = timeout
end

Instance Method Details

#check(raw_email, report_format = :long) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/postmark/spam_check/client.rb', line 17

def check(raw_email, report_format = :long)
  report = SpamCheck::Report.new(raw_email)
  result = fetch_report(raw_email, report_format)
  report.load_results(result)
rescue StandardError => error
  report.error = error.message || error.inspect
  report
end