omnifocus-trello 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omnifocus/trello.rb +8 -8
- data/lib/omnifocus/trello/version.rb +1 -1
- metadata +1 -1
data/lib/omnifocus/trello.rb
CHANGED
@@ -6,7 +6,7 @@ module OmniFocus::Trello
|
|
6
6
|
PREFIX = "TR"
|
7
7
|
KEY = "3ad9e72a2e2d41a98450ca775a0bafe4"
|
8
8
|
|
9
|
-
def
|
9
|
+
def load_or_create_trello_config
|
10
10
|
path = File.expand_path "~/.omnifocus-trello.yml"
|
11
11
|
config = YAML.load(File.read(path)) rescue nil
|
12
12
|
|
@@ -24,23 +24,23 @@ module OmniFocus::Trello
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def populate_trello_tasks
|
27
|
-
config =
|
27
|
+
config = load_or_create_trello_config
|
28
28
|
token = config[:token]
|
29
29
|
done_lists = config[:done_lists]
|
30
30
|
|
31
|
-
boards =
|
32
|
-
|
33
|
-
|
31
|
+
boards = fetch_trello_boards(token)
|
32
|
+
fetch_trello_cards(token).each do |card|
|
33
|
+
process_trello_card(boards, done_lists, card)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def fetch_trello_cards(token)
|
38
38
|
url = "https://api.trello.com/1/members/my/cards?key=#{KEY}&token=#{token}"
|
39
39
|
|
40
40
|
JSON.parse(open(url).read)
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def process_trello_card(boards, done_lists, card)
|
44
44
|
number = card["idShort"]
|
45
45
|
url = card["shortUrl"]
|
46
46
|
board = boards.find {|board| board["id"] == card["idBoard"] }
|
@@ -62,7 +62,7 @@ module OmniFocus::Trello
|
|
62
62
|
bug_db[project_name][ticket_id] = [title, url]
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
65
|
+
def fetch_trello_boards(token)
|
66
66
|
url = "https://api.trello.com/1/members/my/boards?key=#{KEY}&token=#{token}&lists=open"
|
67
67
|
JSON.parse(open(url).read)
|
68
68
|
end
|