Class: Jiralicious::Project
- Defined in:
- lib/jiralicious/project.rb,
lib/jiralicious/project/avatar.rb
Overview
The Project class rolls up the basic functionality for managing Projects within Jira through the Rest API.
Defined Under Namespace
Classes: Avatar
Instance Attribute Summary collapse
-
#issues ⇒ Object
Issues loads the issue list into the current Project.
Attributes inherited from Base
Class Method Summary collapse
-
.issue_list(key) ⇒ Object
Returns a list of issues within the project.
Instance Method Summary collapse
-
#initialize(decoded_json) ⇒ Project
constructor
Initialization Method.
Methods inherited from Base
#all, #endpoint_name, endpoint_name, fetch, find, find_all, handler, issueKey_test, #loaded?, #method_missing, #numeric?, parent_name, #parent_name, #properties_from_hash, #reload
Methods included from Jiralicious::Parsers::FieldParser
Constructor Details
#initialize(decoded_json) ⇒ Project
Initialization Method
- Arguments
-
:decoded_json (optional) rubyized json object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jiralicious/project.rb', line 15 def initialize(decoded_json) @loaded = false if decoded_json.is_a? Hash properties_from_hash(decoded_json) super(decoded_json) parse!(decoded_json) @loaded = true else decoded_json.each do |list| self.class.property :"#{list['key']}" self.merge!({list['key'] => self.class.find(list['key'])}) end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Jiralicious::Base
Instance Attribute Details
#issues ⇒ Object
Issues loads the issue list into the current Project. It also acts as a reference for lazy loading of issues.
56 57 58 |
# File 'lib/jiralicious/project.rb', line 56 def issues @issues end |
Class Method Details
.issue_list(key) ⇒ Object
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.
- Arguments
-
:key (required) project key
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jiralicious/project.rb', line 39 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("-", "_")}" t = Issue.new t.load(issue, true) i_out[issue["key"].gsub("-", "_")] = t end i_out end |