-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.js.sample2
63 lines (43 loc) · 2.15 KB
/
config.js.sample2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// This is a real-world sample that fetches real-estate properties from Trulia.com
// and applies some additional filtering criteria before creating new Trello cards.
var config = {}
// This is the URL of your RSS feed.
// You can build your own custom URLS from http://www.trulia.com/tools/rss/
config.feed_url = 'http://www.trulia.com/rss2/for_sale/Houston,TX/MULTI-FAMILY_type/100000-250000_price/';
// Helper callback to arbitrarily ignore articles you don't want Trello cards for.
// This might need to be customized based on your RSS feed format.
config.feed_filter = function (article) {
var rejected = false;
// We want to further refine the RSS feed by ignoring ZIP codes not in our set.
var re = new RegExp("Houston, TX ([0-9]{5})");
var matches = re.exec(article.title);
if (matches != null) {
var goodzips = ["77027", "77019", "77098", "77006", "77005", "77004"];
if (goodzips.indexOf(matches[1]) < 0) {
rejected = true;
}
}
return rejected;
}
// Helper callback used see if a Trello card already exists for this article.
// This might need to be customized based on your RSS feed format.
// You can compare card.{name|desc} with article.{title|link|description}
config.card_article_comparator = function (card, article) {
// This just checks to see if the RSS item link is present anywhere in the card description.
return (card.desc.indexOf(article.link) >= 0);
}
// Helper callback used to create the final contents of a Trello card.
// This might need to be customized based on your RSS feed format.
config.article_formatter = function (article) {
var finalName = article.title.split(',', 1);
var finalDesc = article.title + "\n" + article.link + "\n" + article.description;
return { 'name': finalName, 'desc': finalDesc };
}
// Your Trello API authentication values.
config.trello_key = "................................";
config.trello_token = "................................................................";
// Identifier of the Trello board.
config.board_id = '........................';
// Name of the Trello list that will receive new cards.
config.target_list_name = 'Incoming';
module.exports = config;