lib/geet/github/abstract_issue.rb in geet-0.3.6 vs lib/geet/github/abstract_issue.rb in geet-0.3.7

- old
+ new

@@ -20,28 +20,24 @@ @link = link end # See https://developer.github.com/v3/issues/#list-issues-for-a-repository # - def self.list(api_interface, only_issues: false, milestone: nil, assignee: nil) + def self.list(api_interface, milestone: nil, assignee: nil, &type_filter) api_path = 'issues' request_params = {} - request_params[:milestone] = milestone if milestone - request_params[:assignee] = assignee if assignee + request_params[:milestone] = milestone.number if milestone + request_params[:assignee] = assignee.username if assignee response = api_interface.send_request(api_path, params: request_params, multipage: true) abstract_issues_list = response.map do |issue_data| number = issue_data.fetch('number') title = issue_data.fetch('title') link = issue_data.fetch('html_url') - klazz = issue_data.key?('pull_request') ? PR : Issue - - if !only_issues || klazz == Issue - klazz.new(number, api_interface, title, link) - end + new(number, api_interface, title, link) if type_filter.nil? || type_filter.call(issue_data) end abstract_issues_list.compact end