aboutsummaryrefslogtreecommitdiffstats
path: root/fancy_bear/contextio/label.rb
diff options
context:
space:
mode:
Diffstat (limited to 'fancy_bear/contextio/label.rb')
-rw-r--r--fancy_bear/contextio/label.rb37
1 files changed, 37 insertions, 0 deletions
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