Class: MailFetcher::GmailMessage
Constant Summary
collapse
- CONTENT_TYPE_PLAIN =
/text\/plain/
- CONTENT_TYPE_HTML =
/text\/html/
Constants inherited
from EmailMessage
EmailMessage::URL_PATTERN
Instance Method Summary
collapse
#initialize
Instance Method Details
#html_body ⇒ Object
16
17
18
|
# File 'lib/mail_fetcher/gmail_message.rb', line 16
def html_body
find_part_by_content_type(CONTENT_TYPE_HTML).body.decoded
end
|
#html_urls ⇒ Object
20
21
22
|
# File 'lib/mail_fetcher/gmail_message.rb', line 20
def html_urls
html_body.scan(%r{href="(#{URL_PATTERN.source})"}).flatten
end
|
#plain_text_body ⇒ Object
8
9
10
|
# File 'lib/mail_fetcher/gmail_message.rb', line 8
def plain_text_body
find_part_by_content_type(CONTENT_TYPE_PLAIN).body.decoded
end
|
#plain_text_urls ⇒ Object
12
13
14
|
# File 'lib/mail_fetcher/gmail_message.rb', line 12
def plain_text_urls
plain_text_body.match(URL_PATTERN).to_a
end
|