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
-
#components ⇒ Object
Retrieves the components associated with the project.
-
#issues ⇒ Object
Issues loads the issue list into the current Project.
-
#versions(expand = {}) ⇒ Object
Retrieves the versions associated with the project.
Attributes inherited from Base
Class Method Summary collapse
-
.components(key) ⇒ Object
Retrieves the components associated with the project.
-
.issue_list(key) ⇒ Object
Returns a list of issues within the project.
-
.versions(key, expand = {}) ⇒ Object
Retrieves the versions associated with 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
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jiralicious/project.rb', line 20 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
#components ⇒ Object
Retrieves the components associated with the project
10 11 12 |
# File 'lib/jiralicious/project.rb', line 10 def components @components end |
#issues ⇒ Object
Issues loads the issue list into the current Project. It also acts as a reference for lazy loading of issues.
85 86 87 |
# File 'lib/jiralicious/project.rb', line 85 def issues @issues end |
#versions(expand = {}) ⇒ Object
Retrieves the versions associated with the project
- Arguments
-
:expand (optional) expansion options.
12 13 14 |
# File 'lib/jiralicious/project.rb', line 12 def versions @versions end |
Class Method Details
.components(key) ⇒ Object
Retrieves the components associated with the project
- Arguments
-
:key (required) project key to generate components
62 63 64 65 |
# File 'lib/jiralicious/project.rb', line 62 def components(key) response = fetch({:key => "#{key}/components"}) Field.new(response.parsed_response) end |
.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
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/jiralicious/project.rb', line 44 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 |
.versions(key, expand = {}) ⇒ Object
Retrieves the versions associated with the project
- Arguments
-
:key (required) project key to generate versions
:expand (optional) expansion options.
75 76 77 78 |
# File 'lib/jiralicious/project.rb', line 75 def versions(key, = {}) response = fetch({:key => "#{key}/versions", :body => }) Field.new(response.parsed_response) end |