Class: JIRA::Resource::Agileboard

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/resource/agileboard.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, #delete, endpoint_name, #fetch, find, #has_errors?, has_many, has_one, #id, #initialize, key_attribute, #key_value, #method_missing, nested_collections, #new_record?, parse_json, #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

.collection_path(client, prefix = '/') ⇒ Object

override collection path for different API endpoint



21
22
23
# File 'lib/jira/resource/agileboard.rb', line 21

def self.collection_path(client, prefix = '/')
   '/rest/greenhopper/1.0/rapidviews/list'
end

.populate(client, options, json) ⇒ Object

override population for different responses from jira



12
13
14
15
16
17
18
# File 'lib/jira/resource/agileboard.rb', line 12

def self.populate(client, options, json)
  if json['views']
    json = json['views']
  end

  super
end

Instance Method Details

#issuesObject

get all issues of agile board



26
27
28
29
30
31
32
33
34
35
# File 'lib/jira/resource/agileboard.rb', line 26

def issues
  search_url = client.options[:site] + 
               '/rest/greenhopper/1.0/xboard/work/allData/?rapidViewId=' + attrs['id'].to_s

  response = client.get(search_url)
  json = self.class.parse_json(response.body)
  json['issues'].map do |issue|
    client.Issue.build(issue)
  end
end

#sprintsObject

get all sprints of agile board



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

def sprints
  search_url = client.options[:site] + '/rest/greenhopper/1.0/sprintquery/' + attrs['id'].to_s
  response = client.get(search_url)
  json = self.class.parse_json(response.body)

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