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, #patched_url, #path_component, #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


12
13
14
# File 'lib/jira/resource/project.rb', line 12

def self.key_attribute
  :key
end

Instance Method Details

#issues(options = {}) ⇒ Object

Returns all the issues for this project


17
18
19
20
21
22
23
24
25
26
# File 'lib/jira/resource/project.rb', line 17

def issues(options = {})
  search_url = client.options[:rest_base_path] + '/search'
  query_params = { jql: "project=\"#{key}\"" }
  query_params.update Base.query_params_for_search(options)
  response = client.get(url_with_query_params(search_url, query_params))
  json = self.class.parse_json(response.body)
  json['issues'].map do |issue|
    client.Issue.build(issue)
  end
end

#users(start_at: nil, max_results: nil) ⇒ Object


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/jira/resource/project.rb', line 28

def users(start_at: nil, max_results: nil)
  users_url = client.options[:rest_base_path] + '/user/assignable/search'
  query_params = { project: key_value }
  query_params['startAt'] = start_at if start_at
  query_params['maxResults'] = max_results if max_results
  response = client.get(url_with_query_params(users_url, query_params))
  json = self.class.parse_json(response.body)
  json.map do |jira_user|
    client.User.build(jira_user)
  end
end