Module: AtlasRb

Defined in:
lib/atlas_rb.rb,
lib/atlas_rb/blob.rb,
lib/atlas_rb/mash.rb,
lib/atlas_rb/work.rb,
lib/atlas_rb/admin.rb,
lib/atlas_rb/version.rb,
lib/atlas_rb/delegate.rb,
lib/atlas_rb/file_set.rb,
lib/atlas_rb/resource.rb,
lib/atlas_rb/community.rb,
lib/atlas_rb/admin/work.rb,
lib/atlas_rb/collection.rb,
lib/atlas_rb/system/user.rb,
lib/atlas_rb/configuration.rb,
lib/atlas_rb/authentication.rb,
lib/atlas_rb/faraday_helper.rb,
lib/atlas_rb/admin/community.rb,
lib/atlas_rb/admin/collection.rb

Overview

Ruby client for the Atlas API — Northeastern University's institutional digital repository.

Configuration

Two environment variables drive every request:

  • ATLAS_URL — base URL of the Atlas API (e.g. https://atlas.example.edu).
  • ATLAS_TOKEN — bearer token sent in the Authorization header.

Authentication additionally accepts an NUID (Northeastern University ID) which is forwarded in a User: NUID <nuid> header so the server can resolve the acting user.

Resource hierarchy

{AtlasRb::Community}  →  {AtlasRb::Collection}  →  {AtlasRb::Work}
                                                     ↓
                                                  {AtlasRb::FileSet}
                                                     ↓
                                                  {AtlasRb::Blob}
  • Community — top-level org unit; may nest sub-Communities.
  • Collection — holds Works; lives directly under a Community.
  • Work — the bibliographic unit (article, thesis, dataset…); MODS metadata is attached here.
  • FileSet — classified slot under a Work that owns one Blob.
  • Blob — the binary bytes themselves; supports streaming downloads via Blob.content.

Quick start

Examples:

End-to-end: create a Work and attach a file

ENV["ATLAS_URL"]   = "https://atlas.example.edu"
ENV["ATLAS_TOKEN"] = "..."

community  = AtlasRb::Community.create(nil, "/tmp/community-mods.xml")
collection = AtlasRb::Collection.create(community["id"], "/tmp/coll-mods.xml")
work       = AtlasRb::Work.create(collection["id"], "/tmp/work-mods.xml")
blob       = AtlasRb::Blob.create(work["id"],
                                  "/tmp/upload.tmp",
                                  "thesis.pdf")

Streaming a download

File.open("out.pdf", "wb") do |f|
  AtlasRb::Blob.content(blob["id"]) { |chunk| f.write(chunk) }
end

Defined Under Namespace

Modules: Admin, FaradayHelper, System Classes: Authentication, Blob, Collection, Community, Configuration, Delegate, Error, FileSet, Mash, Reset, Resource, Work

Constant Summary collapse

VERSION =

Current gem version, read from the .version file at the repo root at load time.

File.read(".version").strip

Class Method Summary collapse

Class Method Details

.configAtlasRb::Configuration

The gem-wide configuration instance. Lazily initialized — host applications register defaults via configure.

Returns:



81
82
83
# File 'lib/atlas_rb.rb', line 81

def self.config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ AtlasRb::Configuration

Yield the configuration for registration.

When default_nuid or default_on_behalf_of are set, resource methods that take nuid: / on_behalf_of: kwargs will fall through to the registered callables whenever the caller omits the kwarg (or passes nil). Caller-passed values always win.

Examples:

Registering an ambient NUID source in a Rails initializer

AtlasRb.configure do |config|
  config.default_nuid         = -> { Current.nuid }
  config.default_on_behalf_of = -> { Current.on_behalf_of }
end

Yield Parameters:

Returns:



100
101
102
103
# File 'lib/atlas_rb.rb', line 100

def self.configure
  yield config
  config
end