• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_describe / 9091a1ae-29be-458c-984a-339d213919c4

12 Dec 2024 07:41PM UTC coverage: 26.434% (-69.7%) from 96.113%
9091a1ae-29be-458c-984a-339d213919c4

Pull #2000

circleci

jrgriffiniii
Removing integration with ActiveStorage
Pull Request #2000: Bump actionpack from 7.2.1.1 to 7.2.2.1

945 of 3575 relevant lines covered (26.43%)

0.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.17
/app/services/pul_dspace_aws_connector.rb
1
# frozen_string_literal: true
2
class PULDspaceAwsConnector
1✔
3
  attr_reader :work, :ark, :dspace_doi, :migration_snapshot
1✔
4

5
  def initialize(work, dspace_doi)
1✔
6
    @work = work
×
7
    @ark = work.ark&.gsub("ark:/", "")
×
8
    @dspace_doi = dspace_doi
×
9
  end
10

11
  def upload_to_s3(dspace_files)
1✔
12
    dspace_files.map do |dspace_file|
×
13
      filename = dspace_file.filename
×
14
      match_dspace_file = dspace_file.clone
×
15
      basename = File.basename(dspace_file.filename_display)
×
16
      match_dspace_file.filename = dspace_file.filename_display
×
17
      io = File.open(filename)
×
18
      size = File.size(filename)
×
19
      key = work.s3_query_service.upload_file(io:, filename: basename, md5_digest: dspace_file.checksum, size:)
×
20
      if key
×
21
        { key:, file: match_dspace_file, error: nil }
×
22
      else
23
        { key: nil, file: match_dspace_file, error: "An error uploading #{filename}.  Please try again." }
×
24
      end
25
    end
26
  end
27

28
  def aws_files
1✔
29
    return [] if ark.nil? || dspace_doi.nil?
×
30
    @aws_files ||= work.s3_query_service.client_s3_files(reload: true, bucket_name: dspace_bucket_name, prefix: dspace_doi.tr(".", "-"))
×
31
  end
32

33
  private
1✔
34

35
    def dspace_bucket_name
1✔
36
      @dspace_bucket_name ||= Rails.configuration.s3.dspace[:bucket]
×
37
    end
38
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc