def download_to(dir, start = 0, stop = -1, opts = { force_download: false })
      start, stop = validate_indeces!(start, stop)
      setup_download_dir!(dir)
      failed = []
      succeeded = []
      skipped = []

      chapters[start..stop].each do |chapter|
        chapter_result = chapter.download_to(to_path, opts)

        if chapter_result[:failed].any?
          failed << [chapter, chapter_result]
        elsif chapter_result[:succeeded].any?
          succeeded << [chapter, chapter_result]
        elsif chapter_result[:skipped].any?
          skipped << [chapter, chapter_result]
        end

        next unless chapter_result[:failed].any?

        logger.error({
          msg: 'Chapter was not fully downloaded',
          uri: chapter.uri,
          chapter: chapter.name
        }.to_s)
      end

      { failed: failed, succeeded: succeeded, skipped: skipped }
    end
def download_to(dir, start = 0, stop = -1, opts = { force_download: false })
      start, stop = validate_indeces!(start, stop)
      setup_download_dir!(dir)
      failed = []
      succeeded = []
      skipped = []

      chapters[start..stop].each do |chapter|
        chapter_result = chapter.download_to(to_path, opts)

        if chapter_result[:failed].any?
          failed << [chapter, chapter_result]
        elsif chapter_result[:succeeded].any?
          succeeded << [chapter, chapter_result]
        elsif chapter_result[:skipped].any?
          skipped << [chapter, chapter_result]
        end

        next unless chapter_result[:failed].any?

        logger.error({
          msg: 'Chapter was not fully downloaded',
          uri: chapter.uri,
          chapter: chapter.name
        }.to_s)
      end

      { failed: failed, succeeded: succeeded, skipped: skipped }
    end
rubocop:disable Metrics/AbcSize
 rubocop:disable Metrics/MethodLength