Module: AtlasRb

Defined in:
lib/atlas_rb.rb,
lib/atlas_rb/blob.rb,
lib/atlas_rb/work.rb,
lib/atlas_rb/version.rb,
lib/atlas_rb/file_set.rb,
lib/atlas_rb/resource.rb,
lib/atlas_rb/community.rb,
lib/atlas_rb/collection.rb,
lib/atlas_rb/authentication.rb,
lib/atlas_rb/faraday_helper.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: FaradayHelper Classes: Authentication, Blob, Collection, Community, Error, FileSet, 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