diff options
| author | Teddy Wing | 2014-06-08 11:36:38 -0400 |
|---|---|---|
| committer | Teddy Wing | 2014-06-08 11:36:38 -0400 |
| commit | 8806e3a676d2fbe1397b0079318ca279851e476e (patch) | |
| tree | a4ccb15be6c1f6026cd30ad422abc6599857000c /fancy_bear | |
| parent | 9f033f1558c67484c545ff3610b2c866603a6eef (diff) | |
| download | sellevate-8806e3a676d2fbe1397b0079318ca279851e476e.tar.bz2 | |
Get label creation working by shelling out to python
Dammit Context.IO Ruby SDK
Diffstat (limited to 'fancy_bear')
| -rw-r--r-- | fancy_bear/contextio.rb | 1 | ||||
| -rw-r--r-- | fancy_bear/contextio/label.rb | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/fancy_bear/contextio.rb b/fancy_bear/contextio.rb index dc3f9ff..a7198e1 100644 --- a/fancy_bear/contextio.rb +++ b/fancy_bear/contextio.rb @@ -1,6 +1,7 @@ require_relative 'contextio/config' require_relative 'contextio/base' require_relative 'contextio/auth' +require_relative 'contextio/label' module FancyBear module ContextIO diff --git a/fancy_bear/contextio/label.rb b/fancy_bear/contextio/label.rb new file mode 100644 index 0000000..fb5a33a --- /dev/null +++ b/fancy_bear/contextio/label.rb @@ -0,0 +1,37 @@ +require 'contextio' + +module FancyBear + module ContextIO + + class Label < Base + def initialize(email) + super() + + @account = @contextio.accounts.where(:email => email).first + @labels = [] + @defaults = ['[FancyBear]/Low', '[FancyBear]/Medium', '[FancyBear]/High'] + end + + def all + return if not @labels.empty? + + @account.sources.first.folders.each do |f| + @labels << f.name + end + @labels + end + + def create_defaults + all() + @labels.each do |l| + return if @defaults.include?(l) + end + + @defaults.each do |l| + system "contextio-put-folder.py '#{@account.id}' '#{l}'" + end + end + end + + end +end |
