Class: DownloaderForCloud
- Inherits:
-
Downloader
- Object
- Downloader
- DownloaderForCloud
- Defined in:
- lib/jirametrics/downloader_for_cloud.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
47 48 49 |
# File 'lib/jirametrics/downloader_for_cloud.rb', line 47 def issue_bulk_fetch_api '/rest/api/3/issue/bulkfetch' end |
#jira_instance_type ⇒ Object
4 5 6 |
# File 'lib/jirametrics/downloader_for_cloud.rb', line 4 def jira_instance_type 'Jira Cloud' 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 42 43 44 45 |
# File 'lib/jirametrics/downloader_for_cloud.rb', line 8 def search_for_issues jql:, board_id:, path: log " JQL: #{jql}" escaped_jql = CGI.escape jql hash = {} max_results = 5_000 # The maximum allowed by Jira next_page_token = nil issue_count = 0 loop do relative_url = +'' relative_url << '/rest/api/3/search/jql' relative_url << "?jql=#{escaped_jql}&maxResults=#{max_results}" relative_url << "&nextPageToken=#{next_page_token}" if next_page_token relative_url << '&fields=updated' json = @jira_gateway.call_url relative_url: relative_url next_page_token = json['nextPageToken'] json['issues'].each do |i| key = i['key'] data = DownloadIssueData.new key: key data.key = key data.last_modified = Time.parse i['fields']['updated'] data.found_in_primary_query = true data.cache_path = File.join(path, "#{key}-#{board_id}.json") data.up_to_date = last_modified(filename: data.cache_path) == data.last_modified hash[key] = data issue_count += 1 end = " Found #{issue_count} issues" log , both: true break unless next_page_token end hash end |