Class: JIRA::Resource::Project

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/resource/project.rb

Constant Summary

Constants inherited from Base

Base::QUERY_PARAMS_FOR_SEARCH, Base::QUERY_PARAMS_FOR_SINGLE_FETCH

Instance Attribute Summary

Attributes inherited from Base

#attrs, #client, #deleted, #expanded

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, belongs_to, belongs_to_relationships, build, collection_attributes_are_nested, collection_path, #collection_path, #delete, endpoint_name, #fetch, find, #has_errors?, has_many, has_one, #id, #initialize, #key_value, #method_missing, nested_collections, #new_record?, parse_json, #path_component, populate, #respond_to?, #save, #save!, #set_attrs, #set_attrs_from_response, singular_path, #to_json, #to_s, #to_sym, #url

Constructor Details

This class inherits a constructor from JIRA::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JIRA::Base

Class Method Details

.key_attributeObject



14
15
16
# File 'lib/jira/resource/project.rb', line 14

def self.key_attribute
  :key
end

Instance Method Details

#issues(options = {}) ⇒ Object

Returns all the issues for this project



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jira/resource/project.rb', line 19

def issues(options={})
  options[:maxResults] = 9999999 unless options[:maxResults]
  options[:startAt] = 0 unless options[:startAt]
  result_issues = []
  result_count = 0

  while options[:maxResults] > 0 and result_count % 1000 == 0
    new_issues = get_issues(options)
    result_issues += new_issues
    result_count = new_issues.length
    options[:maxResults] -= result_count
    options[:startAt] += result_count
  end

  result_issues
end

#sprintsObject

Returns all sprints for this project



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/jira/resource/project.rb', line 38

def sprints
  search_url = client.options[:site] + 
               '/rest/greenhopper/1.0/integration/teamcalendars/sprint/list?jql=project=' + key

  response = client.get(search_url)
  json = self.class.parse_json(response.body)

  json["sprints"].map do |sprint|
    client.Sprint.build(sprint)
  end
end