services/processing_service.rb
# Scan the NSF Awards API
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
Scan the NSF Awards API
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
Scan the NSF Awards API rubocop : disable Metrics / AbcSize Metrics / MethodLength
def scan_for_awards(item:)
    update_url = item['funding'].fetch('update_url', '')
    funder = item['funding'].fetch('funderId', '')
    return nil if update_url.nil? || funder.nil?
    case funder
    when NSF
      agency = 'NSF'
    when NASA
      agency = 'NASA'
    end
    return nil if agency.nil?
    p "Scanning NSF Awards API for: `#{item['funding']['projectTitle']}`"
    p "  with author(s): #{item['funding']['authors'].map { |a| a.gsub('|', ' from ') }.join(', ')}"
    @nsf.find_award_by_title(agency: agency, funding: item.fetch('funding', {}))
  end
def scan_for_awards ( item : ) update_url = item [ 'funding' ] . fetch ( 'update_url' , '' ) funder = item [ 'funding' ] . fetch ( 'funderId' , '' ) return nil if update_url . nil? || funder . nil? case funder when NSF agency = 'NSF' when NASA agency = 'NASA' end return nil if agency . nil? p "Scanning NSF Awards API for: `#{item['funding']['projectTitle']}`" p "  with author(s): #{item['funding']['authors'].map { |a| a.gsub('|', ' from ') }.join(', ')}" @nsf . find_award_by_title ( agency : agency , funding : item . fetch ( 'funding' , { } ) ) end
Scan the NSF Awards API
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
Scan the NSF Awards API rubocop : disable Metrics / AbcSize Metrics / MethodLength
# Make sure we're working with a funder that the NSF Awards API supports # Search the NSF Awards API
item