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

pulibrary / lib_jobs / f4fe27a0-c504-4761-b344-cc4dbee9f472

06 Oct 2025 03:39PM UTC coverage: 94.601% (-1.8%) from 96.354%
f4fe27a0-c504-4761-b344-cc4dbee9f472

push

circleci

christinach
Add a job to get family, person and corporate entities agents

related to [#964]

0 of 62 new or added lines in 1 file covered. (0.0%)

3224 of 3408 relevant lines covered (94.6%)

1246.04 hits per line

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

0.0
/app/models/aspace_version_control/get_agents_job.rb
1
# frozen_string_literal: true
NEW
2
require 'archivesspace/client'
×
3

NEW
4
module AspaceVersionControl
×
NEW
5
  class GetAgentsJob < LibJob
×
NEW
6
    def initialize
×
NEW
7
      super(category: "Agents_export")
×
NEW
8
      @errors = []
×
NEW
9
    end
×
10

NEW
11
    def aspace_login
×
NEW
12
      aspace_client(aspace_config)
×
NEW
13
    end
×
14

NEW
15
    def aspace_config
×
NEW
16
      @config ||= ArchivesSpace::Configuration.new({
×
NEW
17
                                                     base_uri: ENV['ASPACE_URL'],
×
NEW
18
                                                     username: ENV['ASPACE_USER'],
×
NEW
19
                                                     password: ENV['ASPACE_PASSWORD'],
×
NEW
20
                                                     throttle: 0,
×
NEW
21
                                                     verify_ssl: false
×
NEW
22
                                                   })
×
NEW
23
    end
×
24

NEW
25
    def aspace_client(config)
×
NEW
26
      @client ||= ArchivesSpace::Client.new(config).login
×
NEW
27
    end
×
28

NEW
29
    def handle(data_set:)
×
NEW
30
      aspace_login
×
31
      # TODO:  agent logic
NEW
32
      data_set.data = report
×
NEW
33
      data_set.report_time = Time.zone.now
×
NEW
34
      data_set
×
NEW
35
    end
×
36

NEW
37
    def report
×
NEW
38
      if @errors.empty?
×
NEW
39
        "Agents successfully exported."
×
NEW
40
      else
×
NEW
41
        @errors.join(', ')
×
NEW
42
      end
×
NEW
43
    end
×
44

NEW
45
    def list_family_agents
×
NEW
46
      @family_agents ||= aspace_client.get('agents/families')
×
NEW
47
    end
×
48

NEW
49
    def get_family_agent(id)
×
NEW
50
      aspace_client.get("agents/families/#{id}")
×
NEW
51
    end
×
52

NEW
53
    def list_corporate_entities_agents
×
NEW
54
      @corporate_entities_agents ||= aspace_client.get('agents/corporate_entities')
×
NEW
55
    end
×
56

NEW
57
    def get_corporate_entity_agent(id)
×
NEW
58
      aspace_client.get("agents/corporate_entities/#{id}")
×
NEW
59
    end
×
60

NEW
61
    def list_person_agents
×
NEW
62
      @person_agents ||= aspace_client.get('agents/people')
×
NEW
63
    end
×
64

NEW
65
    def get_person_agent(id)
×
NEW
66
      aspace_client.get("agents/people/#{id}")
×
NEW
67
    end
×
68

NEW
69
    private
×
70

NEW
71
    def log_stderr(stderr_str)
×
NEW
72
      @errors << stderr_str unless stderr_str.empty?
×
NEW
73
    end
×
74

NEW
75
    def log_stdout(stdout_str)
×
NEW
76
      Rails.logger.info(stdout_str) unless stdout_str.empty?
×
NEW
77
    end
×
NEW
78
  end
×
NEW
79
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