lib/jiralicious/project.rb in jiralicious-0.2.0 vs lib/jiralicious/project.rb in jiralicious-0.2.1

- old
+ new

@@ -1,13 +1,16 @@ -# To change this template, choose Tools | Templates -# and open the template in the editor. +# encoding: utf-8 module Jiralicious + ## + # The Project class rolls up the basic functionality for + # managing Projects within Jira through the Rest API. + # class Project < Jiralicious::Base - - attr_accessor :issues - ### Initialization ### + ## + # Initialization Method + # def initialize(decoded_json, default = nil, &blk) @loaded = false if decoded_json.is_a? Hash properties_from_hash(decoded_json) super(decoded_json) @@ -20,10 +23,15 @@ end end end class << self + ## + # Returns a list of issues within the project. The issue list is limited + # to only return the issue ID and KEY values to minimize the amount of + # data being returned This is used in lazy loading methodology. + # def issue_list(key) response = Jiralicious.search("project=#{key}", {:fields => ["id", "key"]}) i_out = Issue.new response.issues_raw.each do |issue| i_out.class.property :"#{issue["key"].gsub("-", "_")}" @@ -32,9 +40,14 @@ end i_out end end + ## + # Issues loads the issue list into the current Project. + # It also acts as a reference for lazy loading of issues. + # + attr_accessor :issues def issues if @issues == nil @issues = self.class.issue_list(self.key) end return @issues