Class: Jiralicious::Project

Inherits:
Base
  • Object
show all
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

Attributes inherited from Base

#loaded

Class Method Summary collapse

Instance Method Summary collapse

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

#parse!

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

#issuesObject

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