Class: Howitzer::OnesecmailApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/howitzer/onesecmail_api/client.rb

Overview

A Onesecmail::Client object is used to communicate with the 1secMail API.

Constant Summary collapse

BASE_URL =

:nodoc:

'https://www.1secmail.com/api/v1/'.freeze

Instance Method Summary collapse

Instance Method Details

#find_message(recipient, subject) ⇒ Hash

Finds message according to given parameters

Parameters:

  • recipient (String)

    this is recipient mail address for message filtering

  • subject (String)

    this is subject of the message to filter particular message

Returns:

  • (Hash)

    json message parsed to ruby hash



16
17
18
19
# File 'lib/howitzer/onesecmail_api/client.rb', line 16

def find_message(recipient, subject)
  messages = filter_by_subject(recipient[/[^@]+/], subject)
  latest_message(messages)
end