class MandrillInboundParser::Parser

Public Class Methods

new(raw_data) click to toggle source
# File lib/mandrill_inbound_parser/parser.rb, line 4
def initialize(raw_data)
  raw = JSON.parse(raw_data)
  @raw = raw.first
  @raw
end

Public Instance Methods

attachments() click to toggle source
# File lib/mandrill_inbound_parser/parser.rb, line 58
def attachments
  @raw["msg"]["attachments"]
end
email_from() click to toggle source

get sender email

# File lib/mandrill_inbound_parser/parser.rb, line 21
def email_from
  @raw["msg"]["from_email"]
end
event() click to toggle source

Get event

# File lib/mandrill_inbound_parser/parser.rb, line 16
def event
  @raw["event"]
end
get_keys() click to toggle source

Get all keys

# File lib/mandrill_inbound_parser/parser.rb, line 11
def get_keys
  @raw.keys
end
html() click to toggle source
# File lib/mandrill_inbound_parser/parser.rb, line 50
def html
  @raw["msg"]["html"]
end
images() click to toggle source
# File lib/mandrill_inbound_parser/parser.rb, line 62
def images
  @raw["msg"]["images"]
end
recipient_emails() click to toggle source

Return to Array

# File lib/mandrill_inbound_parser/parser.rb, line 36
def recipient_emails
  @raw["msg"]["to"].map{|x| x.first}
end
recipient_names() click to toggle source

Returns to Array

# File lib/mandrill_inbound_parser/parser.rb, line 41
def recipient_names
  @raw["msg"]["to"].map{|x| x.last}
end
recipients() click to toggle source
# File lib/mandrill_inbound_parser/parser.rb, line 54
def recipients
  @raw["msg"]["to"]
end
sender_name() click to toggle source

Returns the sender name

# File lib/mandrill_inbound_parser/parser.rb, line 26
def sender_name
  @raw["msg"]["from_name"]
end
subject() click to toggle source

Returns the subject

# File lib/mandrill_inbound_parser/parser.rb, line 46
def subject
  @raw["msg"]["subject"]
end
text() click to toggle source

Message content as text

# File lib/mandrill_inbound_parser/parser.rb, line 31
def text
  @raw["msg"]["text"]
end