Module: JiraClient::API::Worklogs

Included in:
JiraClient
Defined in:
lib/jira_client/api/worklogs.rb

Instance Method Summary collapse

Instance Method Details

#create_worklog(key, time, opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jira_client/api/worklogs.rb', line 7

def create_worklog(key, time, opts={})
  url = "/issue/#{key}/worklog"
  url += "?adjustEstimate=new&newEstimate=#{opts[:remaining_estimate]}" if opts.has_key? :remaining_estimate
  url += "?adjustEstimate=manual&reduceBy=#{opts[:reduce_estimate]}" if opts.has_key? :reduce_estimate
  time_in_seconds = ChronicDuration.parse(time)
  params = {
    :timeSpentSeconds => time_in_seconds
  }
  params[:comment] = opts[:comment] if opts.has_key? :comment
  post(url, params)
end

#find_issue_worklogs(key) ⇒ Object



19
20
21
22
# File 'lib/jira_client/api/worklogs.rb', line 19

def find_issue_worklogs(key)
  response = get("/issue/#{key}/worklog")
  response[:worklogs].map {|w| JiraClient::Worklog.from_response w}
end