aboutsummaryrefslogtreecommitdiffstats
path: root/fancy_bear
diff options
context:
space:
mode:
authorTeddy Wing2014-06-08 12:19:48 -0400
committerTeddy Wing2014-06-08 12:19:48 -0400
commitbf52bc3a520bff96be32cfb815738660a607f3ab (patch)
tree2752aedad137cc8763c3b9e19372ab9bac444afd /fancy_bear
parentb41ddb4aa9944057d4dfee5a4b9662dc8326d124 (diff)
downloadsellevate-bf52bc3a520bff96be32cfb815738660a607f3ab.tar.bz2
Create JSON route for message list
Create a route to get a list of messages in JSON, tied to a hard-coded email account for now.
Diffstat (limited to 'fancy_bear')
-rw-r--r--fancy_bear/contextio.rb1
-rw-r--r--fancy_bear/contextio/message.rb33
2 files changed, 34 insertions, 0 deletions
diff --git a/fancy_bear/contextio.rb b/fancy_bear/contextio.rb
index a7198e1..2750755 100644
--- a/fancy_bear/contextio.rb
+++ b/fancy_bear/contextio.rb
@@ -2,6 +2,7 @@ require_relative 'contextio/config'
require_relative 'contextio/base'
require_relative 'contextio/auth'
require_relative 'contextio/label'
+require_relative 'contextio/message'
module FancyBear
module ContextIO
diff --git a/fancy_bear/contextio/message.rb b/fancy_bear/contextio/message.rb
new file mode 100644
index 0000000..ba9e00c
--- /dev/null
+++ b/fancy_bear/contextio/message.rb
@@ -0,0 +1,33 @@
+require 'contextio'
+
+module FancyBear
+ module ContextIO
+
+ class Message < Base
+ def initialize(email)
+ super()
+
+ @account = @contextio.accounts.where(:email => email).first
+ end
+
+ def all
+ messages = []
+ @account.messages.each do |m|
+ messages << {
+ :id => m.message_id,
+ :from_address => m.from['email'],
+ :from_name => m.from['name'],
+ :subject => m.subject,
+ :timestamp => m.date
+ }
+ end
+ messages
+ end
+
+ def get
+
+ end
+ end
+
+ end
+end