Class: CTodo::GoogleCodeProjectHosting
- Inherits:
-
Object
- Object
- CTodo::GoogleCodeProjectHosting
- Includes:
- HTTParty
- Defined in:
- lib/ctodo/gcode.rb
Instance Method Summary collapse
- #get_issues(issues) ⇒ Object
-
#initialize(conf) ⇒ GoogleCodeProjectHosting
constructor
A new instance of GoogleCodeProjectHosting.
Constructor Details
#initialize(conf) ⇒ GoogleCodeProjectHosting
Returns a new instance of GoogleCodeProjectHosting.
7 8 9 10 11 12 13 14 15 |
# File 'lib/ctodo/gcode.rb', line 7 def initialize(conf) @enabled = true if @enabled dir = [:git_repo_dir, :hg_repo_dir, :cur_dir].map {|k| conf[k]}.select {|v| not v.nil?}.first @repo_name = File.basename(dir) # HACK: 1000 should really be enough @limit = (conf[:all] ? 1000 : 25) end end |
Instance Method Details
#get_issues(issues) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ctodo/gcode.rb', line 17 def get_issues(issues) return if not @enabled r = self.class.get "/#{@repo_name}/issues/full", :query => {:can => 'open', :"max-results" => @limit} #puts r.code return unless r.code == 200 #puts r.inspect feed = HTTParty::Parser.call(r.body, :xml) return if feed['feed'].nil? feed = feed['feed'] return if feed['entry'].nil? #puts feed['entry'].first.inspect feed['entry'].each do |e| loc = e['link'].select {|link| link['type'] == 'text/html'}.first loc = loc['href'] unless loc.nil? assig = e['owner'].nil? ? nil : e['owner']['username'] = e['label'].map {|lab| Tag.new(lab, ColorUtils.rgb4string(lab))} issues << Issue.new(e['title'], loc, assig, ) end end |