lib/salus/report.rb
def export_report
      @report_uris.each do |directive|
        # First create the string for the report.
        uri = directive['uri']
        verbose = directive['verbose'] || false
        report_string = case directive['format']
                        when 'txt' then to_s(verbose: verbose)
                        when 'json' then to_json
                        when 'yaml' then to_yaml
                        else
                          raise ExportReportError, "unknown report format #{directive['format']}"
                        end

        # Now send this string to its destination.
        if Salus::Config::REMOTE_URI_SCHEME_REGEX.match?(URI(uri).scheme)
          send_report(uri, report_string, directive['format'])
        else
          # must remove the file:// schema portion of the uri.
          uri_object = URI(uri)
          file_path = "#{uri_object.host}#{uri_object.path}"
          write_report_to_file(file_path, report_string)
        end
      end
    end
# Send the report to given URIs (which could be remove or local).
Send the report to given URIs (which could be remove or local).
Send the report to given URIs ( which could be remove or local ) .
def export_report
      @report_uris.each do |directive|
        uri = directive['uri']
        verbose = directive['verbose'] || false
        report_string = case directive['format']
                        when 'txt' then to_s(verbose: verbose)
                        when 'json' then to_json
                        when 'yaml' then to_yaml
                        else
                          raise ExportReportError, "unknown report format #{directive['format']}"
                        end
        if Salus::Config::REMOTE_URI_SCHEME_REGEX.match?(URI(uri).scheme)
          send_report(uri, report_string, directive['format'])
        else
          uri_object = URI(uri)
          file_path = "#{uri_object.host}#{uri_object.path}"
          write_report_to_file(file_path, report_string)
        end
      end
    end
def export_report @report_uris . each do | directive | uri = directive [ 'uri' ] verbose = directive [ 'verbose' ] || false report_string = case directive [ 'format' ] when 'txt' then to_s ( verbose : verbose ) when 'json' then to_json when 'yaml' then to_yaml else raise ExportReportError , "unknown report format #{directive['format']}" end if Salus :: Config :: REMOTE_URI_SCHEME_REGEX . match? ( URI ( uri ) . scheme ) send_report ( uri , report_string , directive [ 'format' ] ) else uri_object = URI ( uri ) file_path = "#{uri_object.host}#{uri_object.path}" write_report_to_file ( file_path , report_string ) end end end
Send the report to given URIs (which could be remove or local).
Send the report to given URIs ( which could be remove or local ) .
# First create the string for the report. # Now send this string to its destination. # must remove the file:// schema portion of the uri.