Class: Mailinator::Models::Email

Inherits:
Base
  • Object
show all
Defined in:
lib/mailinator/models/email.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #original

Constructor Details

This class inherits a constructor from Mailinator::Models::Base

Instance Method Details

#transform_dataObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mailinator/models/email.rb', line 6

def transform_data
  {
    id: @data['data']['id'],
    body: @data['data']['parts'].first['body'],
    body_html: retrieve_body_html,
    inbox_fetches_left: @data['apiInboxFetchesLeft'],
    email_fetches_left: @data['apiEmailFetchesLeft'],
    forwards_left: @data['forwardsLeft'],
    sender: @data['data']['headers']['sender'],
    from: @data['data']['from'],
    date: DateTime.parse(@data['data']['headers']['date']),
    time: @data['data']['time'],
    ip: @data['data']['ip'],
    to: @data['data']['headers']['to'],
    reply_to: @data['data']['headers']['reply-to'],
    received: @data['data']['headers']['received'],
    read?: @data['data']['been_read']
  }
end