diff options
| author | Teddy Wing | 2014-06-08 12:31:40 -0400 |
|---|---|---|
| committer | Teddy Wing | 2014-06-08 12:31:40 -0400 |
| commit | 12477d778030901fe69e001ca9d1a856ccfd11ce (patch) | |
| tree | 3e23a3bf88f4b24f9541cffec3037b409c610b7a | |
| parent | f1a17c22776c6affd5fd48d5dd519510f5907431 (diff) | |
| parent | d9fb8accb78af12c544c81cb13ea35bbbebf0bac (diff) | |
| download | sellevate-12477d778030901fe69e001ca9d1a856ccfd11ce.tar.bz2 | |
Merge branch 'feature/contextio-messages' into develop
| -rw-r--r-- | Gemfile | 1 | ||||
| -rw-r--r-- | Gemfile.lock | 12 | ||||
| -rw-r--r-- | app.rb | 6 | ||||
| -rw-r--r-- | fancy_bear/contextio.rb | 1 | ||||
| -rw-r--r-- | fancy_bear/contextio/message.rb | 34 |
5 files changed, 54 insertions, 0 deletions
@@ -2,3 +2,4 @@ source 'https://rubygems.org' gem 'contextio', '~> 1.7.2' gem 'sinatra', '~> 1.4.5' +gem 'sinatra-contrib' diff --git a/Gemfile.lock b/Gemfile.lock index 3501b89..0d0d741 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,7 @@ GEM remote: https://rubygems.org/ specs: + backports (3.6.0) contextio (1.7.2) faraday (~> 0.8.0) faraday_middleware (~> 0.9.0) @@ -9,15 +10,25 @@ GEM multipart-post (~> 1.2.0) faraday_middleware (0.9.1) faraday (>= 0.7.4, < 0.10) + multi_json (1.10.1) multipart-post (1.2.0) rack (1.5.2) rack-protection (1.5.3) rack + rack-test (0.6.2) + rack (>= 1.0) simple_oauth (0.2.0) sinatra (1.4.5) rack (~> 1.4) rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) + sinatra-contrib (1.4.2) + backports (>= 2.0) + multi_json + rack-protection + rack-test + sinatra (~> 1.4.0) + tilt (~> 1.3) tilt (1.4.1) PLATFORMS @@ -26,3 +37,4 @@ PLATFORMS DEPENDENCIES contextio (~> 1.7.2) sinatra (~> 1.4.5) + sinatra-contrib @@ -1,4 +1,5 @@ require 'sinatra' +require 'sinatra/json' require './fancy_bear/fancy_bear' class App < Sinatra::Base @@ -36,4 +37,9 @@ class App < Sinatra::Base redirect to('/') end + + get '/messages.json' do + contextio = FancyBear::ContextIO::Message.new('sellevate.hack@gmail.com') + json contextio.all + end end 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..bae9be4 --- /dev/null +++ b/fancy_bear/contextio/message.rb @@ -0,0 +1,34 @@ +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, + :labels => m.folders + } + end + messages + end + + def get + + end + end + + end +end |
