214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
# File 'lib/opsask/helpers.rb', line 214
def current_sprint keys=[ 'sprintsData', 'sprints', 0 ]
url = "#{settings.config[:jira_url]}/rest/greenhopper/1.0/xboard/work/allData.json?rapidViewId=#{settings.config[:agile_board]}"
curl_request = Curl::Easy.http_get(url) do |curl|
curl.['Accept'] = 'application/json'
curl.['Content-Type'] = 'application/json'
curl.http_auth_types = :basic
curl.username = settings.config[:jira_user]
curl.password = settings.config[:jira_pass]
curl.verbose = true
end
raw_response = curl_request.body_str
begin
data = JSON::parse(raw_response)
keys.each { |k| data = data[k] }
return data unless data.nil?
rescue
$stderr.puts "Failed to parse response from JIRA: #{raw_response}"
end
get_sprint(nil, sprints.last['id'])
end
|