diff options
| author | Teddy Wing | 2014-06-08 12:41:41 -0400 |
|---|---|---|
| committer | Teddy Wing | 2014-06-08 12:41:41 -0400 |
| commit | 30aed87e9e78c82fb2df528d0f37967469aa0cdb (patch) | |
| tree | 76a0e3074a927bbf330b84f33e010fda080e2878 | |
| parent | 12477d778030901fe69e001ca9d1a856ccfd11ce (diff) | |
| parent | dbdf6a3486a3456b6a6d4fc4f2c5973113015109 (diff) | |
| download | sellevate-develop.tar.bz2 | |
| -rw-r--r-- | app.rb | 5 | ||||
| -rw-r--r-- | fancy_bear/contextio/message.rb | 17 |
2 files changed, 21 insertions, 1 deletions
@@ -42,4 +42,9 @@ class App < Sinatra::Base contextio = FancyBear::ContextIO::Message.new('sellevate.hack@gmail.com') json contextio.all end + + get '/messages/:id.json' do + contextio = FancyBear::ContextIO::Message.new('sellevate.hack@gmail.com') + json contextio.get(params[:id]) + end end diff --git a/fancy_bear/contextio/message.rb b/fancy_bear/contextio/message.rb index bae9be4..abf4a09 100644 --- a/fancy_bear/contextio/message.rb +++ b/fancy_bear/contextio/message.rb @@ -25,8 +25,23 @@ module FancyBear messages end - def get + def get(id) + output = {} + message = @account.messages.where(:message_id => id).first + output['from_address'] = message.from['email'] + output['from_name'] = message.from['name'] + output['subject'] = message.subject + output['timestamp'] = message.date + output['labels'] = message.folders + + message.body_parts.each do |p| + if p.content + output['html'] = p.html? + output['content'] = p.content + end + end + output end end |
