summaryrefslogtreecommitdiff
blob: 82e07663616e79c72f2d1dcee6dd6f69ad426fd0 (plain)
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
#!/usr/bin/ruby -w

require 'rss/2.0'
require 'open-uri'

class Developer
    attr_reader :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi
    attr_writer :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi

    def initialize()
    end

    def ciaRss()
        return "http://cia.navi.cx/stats/author/#{self.handle}/.rss"
    end

    def myBugsRss()
        "http://bugs.gentoo.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboard_type=allwordssubstr&status_whiteboard=&keywords_type=allwords&keywords=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailreporter1=1&emailtype1=exact&email1=#{self.handle}%40gentoo.org&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfieldfrom=&chfieldto=Now&chfieldvalue=&query_based_on=My%20Open%20Bugs&field0-0-0=noop&type0-0-0=noop&value0-0-0=&ctype=rss"
    end

    def parseRssForItems(feed)
        items = nil
        open(feed) do |http|
            rss_source = http.read
            rss = RSS::Parser.parse(rss_source, true)
            if rss.nil?
                rss = RSS::Parser.parse(rss_source, true, false)
            end
            items = rss.items
        end
        return items
    end
    def commitItems()
        parseRssForItems(self.ciaRss)
    end
    def blogItems()
        parseRssForItems(self.blogRss)
    end
end