Sha256: aace58802f6d7e23aed58cfda553399d77dda0a5f615bdfb5ca106b02d9e3c9d

Contents?: true

Size: 1018 Bytes

Versions: 5

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'awesome_print'
require 'archivesspace/client'

# official sandbox
config = ArchivesSpace::Configuration.new(
  {
    base_uri: 'http://test.archivesspace.org/staff/api',
    base_repo: '',
    username: 'admin',
    password: 'admin',
    page_size: 50,
    throttle: 0,
    verify_ssl: false
  }
)

client = ArchivesSpace::Client.new(config).login
client.config.throttle = 0.5
client.config.base_repo = 'repositories/2'

begin
  # date -d '2021-02-01 00:00:00' +'%s' # 1612166400
  client.resources(query: { modified_since: '1612166400' }).each do |resource|
    # for now we are just printing ...
    # but you would actually write to a zip file or whatever
    id   = resource['uri'].split('/')[-1]
    opts = { include_unpublished: false }
    response = client.get("resource_descriptions/#{id}.xml", opts)
    puts Nokogiri::XML(response.body).to_xml
  end
rescue ArchivesSpace::RequestError => e
  puts e.message
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
archivesspace-client-0.1.12 examples/export.rb
archivesspace-client-0.1.11 examples/export.rb
archivesspace-client-0.1.10 examples/export.rb
archivesspace-client-0.1.8 examples/export.rb
archivesspace-client-0.1.7 examples/export.rb