class Focus::PostWorkLogToJira
Public Instance Methods
perform()
click to toggle source
# File lib/focus/actions/log_work_for_jira.rb, line 3 def perform return unless jira_ticket && seconds_focused >= 60 Utils::WebClient.post(issue_url, options) end
Private Instance Methods
auth()
click to toggle source
# File lib/focus/actions/log_work_for_jira.rb, line 26 def auth { username: config.jira_username, password: config.jira_password } end
body()
click to toggle source
# File lib/focus/actions/log_work_for_jira.rb, line 22 def body { timeSpentSeconds: seconds_focused, comment: context.comment.to_s } end
headers()
click to toggle source
# File lib/focus/actions/log_work_for_jira.rb, line 30 def headers { "Content-Type" => "application/json" } end
issue_url()
click to toggle source
# File lib/focus/actions/log_work_for_jira.rb, line 10 def issue_url "#{config.jira_url}/issue/#{jira_ticket}/worklog" end
jira_ticket()
click to toggle source
# File lib/focus/actions/log_work_for_jira.rb, line 34 def jira_ticket context.jira_ticket ||= Utils::ParseJiraTicketFromGitBranch.call.jira_ticket end
options()
click to toggle source
# File lib/focus/actions/log_work_for_jira.rb, line 14 def options { body: body.to_json, basic_auth: auth, headers: headers } end