class Supportal::JIRA

Public Class Methods

new(user, pass, instance) click to toggle source
# File lib/supportal/jira.rb, line 5
def initialize(user, pass, instance)
  @host = instance
  @user = user
  @pass = pass
  @search = '/rest/api/2/search'
end

Public Instance Methods

fetch_changelogs(query, changelog_field_id) click to toggle source
# File lib/supportal/jira.rb, line 25
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) click to toggle source
# 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'],
      instance: @host
    }
  end
end