Class: Jira

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

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Jira

Returns a new instance of Jira.



6
7
8
9
10
11
12
13
14
15
# File 'lib/jira.rb', line 6

def initialize(config)
  @jira = Jira4R::JiraTool.new(2, "http://#{config.jira_url}")
  @jira.(config.username, config.password)

  @types = {}
  @custom_fields = {}

  @jira.getIssueTypes().each  {|t| @types[t.id] = t.name }
  @jira.getCustomFields().each { |f| @custom_fields[f.id] = f.name.downcase.gsub(/ /, '_') }
end

Instance Method Details

#query(jql) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/jira.rb', line 17

def query(jql)
  @jira.getIssuesFromJqlSearch(jql, 10000).collect do |issue|
    issue = Issue.new(issue, @custom_fields, @types)
    puts "Found #{issue.key} (#{issue.issue_type})"
    issue
  end
end