Class: GetTestMailClient
- Inherits:
-
Object
- Object
- GetTestMailClient
- Includes:
- HTTParty
- Defined in:
- lib/gettestmailclient.rb
Instance Method Summary collapse
- #create_new(expires_at = nil) ⇒ Object
-
#initialize(api_key) ⇒ GetTestMailClient
constructor
A new instance of GetTestMailClient.
- #wait_for_message(id) ⇒ Object
Constructor Details
#initialize(api_key) ⇒ GetTestMailClient
Returns a new instance of GetTestMailClient.
11 12 13 |
# File 'lib/gettestmailclient.rb', line 11 def initialize(api_key) @api_key = api_key end |
Instance Method Details
#create_new(expires_at = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gettestmailclient.rb', line 15 def create_new(expires_at = nil) payload = {} payload[:expiresAt] = expires_at if expires_at response = self.class.post( '/gettestmail', headers: headers, body: payload.to_json ) handle_response(response) end |
#wait_for_message(id) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/gettestmailclient.rb', line 28 def (id) response = self.class.get( "/gettestmail/#{id}", headers: headers, follow_redirects: true ) handle_response(response, id) end |