Class: DownloaderForDataCenter
- Inherits:
-
Downloader
- Object
- Downloader
- DownloaderForDataCenter
- Defined in:
- lib/jirametrics/downloader_for_data_center.rb
Constant Summary
Constants inherited from Downloader
Downloader::CURRENT_METADATA_VERSION
Instance Attribute Summary
Attributes inherited from Downloader
#board_id_to_filter_id, #file_system, #metadata, #start_date_in_query
Instance Method Summary collapse
- #issue_bulk_fetch_api ⇒ Object
- #jira_instance_type ⇒ Object
- #search_for_issues(jql:, board_id:, path:) ⇒ Object
Methods inherited from Downloader
#bulk_fetch_issues, create, #delete_issues_from_cache_that_are_not_in_server, #download_board_configuration, #download_issues, #download_sprints, #download_statuses, #download_users, #file_prefix, #find_board_ids, #identify_other_issues_to_be_downloaded, #initialize, #last_modified, #load_metadata, #log, #make_jql, #metadata_pathname, #remove_old_files, #run, #save_metadata, #update_status_history_file
Constructor Details
This class inherits a constructor from Downloader
Instance Method Details
#issue_bulk_fetch_api ⇒ Object
43 44 45 |
# File 'lib/jirametrics/downloader_for_data_center.rb', line 43 def issue_bulk_fetch_api '/rest/api/2/issue/bulkfetch' end |
#jira_instance_type ⇒ Object
4 5 6 |
# File 'lib/jirametrics/downloader_for_data_center.rb', line 4 def jira_instance_type 'Jira DataCenter' end |
#search_for_issues(jql:, board_id:, path:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jirametrics/downloader_for_data_center.rb', line 8 def search_for_issues jql:, board_id:, path: log " JQL: #{jql}" escaped_jql = CGI.escape jql hash = {} max_results = 100 start_at = 0 total = 1 while start_at < total json = @jira_gateway.call_url relative_url: '/rest/api/2/search' \ "?jql=#{escaped_jql}&maxResults=#{max_results}&startAt=#{start_at}&fields=updated" json['issues'].each do |i| key = i['key'] cache_path = File.join(path, "#{key}-#{board_id}.json") last_modified = Time.parse(i['fields']['updated']) data = DownloadIssueData.new( key: key, last_modified: last_modified, found_in_primary_query: true, cache_path: cache_path, up_to_date: last_modified(filename: cache_path) == last_modified ) hash[key] = data end total = json['total'].to_i max_results = json['maxResults'] = " Found #{json['issues'].count} issues" log , both: true start_at += json['issues'].size end hash end |