class Harvest::IssueTracker

Attributes

config[R]
task_details[R]
task_identifier[R]

Public Class Methods

new(config: , task_identifier:) click to toggle source
# File lib/harvest/issue_tracker.rb, line 7
def initialize(config: , task_identifier:)
  @config = config
  @task_identifier = task_identifier
end

Public Instance Methods

fetch_issue() click to toggle source
# File lib/harvest/issue_tracker.rb, line 12
def fetch_issue
  response = RestClient::Request.new(
    method: :get,
    url: rest_api_url,
    user: config['username'],
    password: config['access_token'],
    headers: { accept: :json, content_type: :json }
  ).execute
  
  @task_details = JSON.parse(response.body)
end
task_id() click to toggle source
# File lib/harvest/issue_tracker.rb, line 28
def task_id
  "#{project_code}-#{task_identifier}"
end
task_title() click to toggle source
# File lib/harvest/issue_tracker.rb, line 24
def task_title
  task_details['fields']['summary']
end
task_url() click to toggle source
# File lib/harvest/issue_tracker.rb, line 32
def task_url
  "#{project_url}/browse/#{task_id}"
end

Private Instance Methods

project_code() click to toggle source
# File lib/harvest/issue_tracker.rb, line 42
def project_code
  config['project_code']
end
project_url() click to toggle source
# File lib/harvest/issue_tracker.rb, line 46
def project_url
  config['project_url']
end
rest_api_url() click to toggle source
# File lib/harvest/issue_tracker.rb, line 38
def rest_api_url
  "#{project_url}/rest/api/latest/issue/#{task_id}"
end