Class: Supportal::JIRA

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

Instance Method Summary collapse

Constructor Details

#initialize(user, pass, instance) ⇒ JIRA

Returns a new instance of JIRA.



5
6
7
8
9
10
# File 'lib/supportal/jira.rb', line 5

def initialize(user, pass, instance)
  @host = instance
  @user = user
  @pass = pass
  @search = '/rest/api/2/search'
end

Instance Method Details

#fetch_changelogs(query, changelog_field_id) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/supportal/jira.rb', line 24

def fetch_changelogs(query, changelog_field_id)
  path = @search + "?fields=key,customfield_#{changelog_field_id}&jql="
  jql = CGI.escape(query)
  issues = Supportal::Request.get_json(@host + path + jql, @user, @pass)
  issues['issues'].map do |issue|
    {
      key: issue['key'],
      changelog: issue['fields']["customfield_#{changelog_field_id}"]
    }
  end
end

#fetch_issues(query) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/supportal/jira.rb', line 12

def fetch_issues(query)
  path = @search + '?fields=key,summary&jql='
  jql = CGI.escape(query)
  issues = Supportal::Request.get_json(@host + path + jql, @user, @pass)
  issues['issues'].map do |issue|
    {
      key: issue['key'],
      summary: issue['fields']['summary']
    }
  end
end