Class: Temp::Mail::Client
- Inherits:
-
Object
- Object
- Temp::Mail::Client
- Defined in:
- lib/temp/mail/client.rb
Instance Method Summary collapse
Instance Method Details
#available_domains ⇒ Object
8 9 10 11 |
# File 'lib/temp/mail/client.rb', line 8 def available_domains response = Net::HTTP.get_response(URI('https://api.temp-mail.ru/request/domains/format/json/')) JSON.parse(response.body, symbolize_names: true) end |
#incoming_emails(email) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/temp/mail/client.rb', line 13 def incoming_emails(email) hash = Digest::MD5.hexdigest(email) response = Net::HTTP.get_response(URI("https://api.temp-mail.ru/request/mail/id/#{hash}/format/json/")) if response.is_a?(Net::HTTPNotFound) [] else JSON.parse(response.body, symbolize_names: true) end end |