atlas_rb 1.8.10 → 1.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a1ca62f7d0e0d49e63754618a22967d8a89a4496c05c894bbbff7f13903e94d
4
- data.tar.gz: 5645596297711e7cc464645d249b91b4b62108eaf71978f9d07ffed9590043cd
3
+ metadata.gz: f6edbe1b05256eaab4d296a11f358bb7c7c3f9eaf439be4d48c41e75cfea4951
4
+ data.tar.gz: 8e042786b3c7636f7ad3676b9086a7db4ecfa8efed7ed1e91ac8ec4153dbb320
5
5
  SHA512:
6
- metadata.gz: acd99d449e3dd94bb23cfdeabfc1190d2a074e5bfe07a2a4a8e54723fad47680f525d52e761f5ccee50ac1b464a39b889331e6468fe63bb9a0b06f8d17526262
7
- data.tar.gz: c2d0db210a2a66cb41bc68baec3b6158916a86866c9a20182efc1bc2240f26e0c00357e340d08b4313312e239fabc9338bbca3f6face3c9d0576ef13d9f1f74d
6
+ metadata.gz: 44832489abc704196a42b92d85304e886cc3951e711ea33980c9357cb515a4f3e674d7c75db989b7de5c7fbdc9ed36dcfc51a5eceb1d697371d3971227a7e5fa
7
+ data.tar.gz: 45d0ed33989b889a4a2f3ae3c9932b73f85daa3bc7f5ce9e859f7ea304bf97c71195694322e4e78cdcb537e8f50f37cd1b1d1fe6f7c76bc8458f780688e5c143
data/.version CHANGED
@@ -1 +1 @@
1
- 1.8.10
1
+ 1.8.11
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (1.8.10)
4
+ atlas_rb (1.8.11)
5
5
  faraday (~> 2.7)
6
6
  faraday-follow_redirects (~> 0.3.0)
7
7
  faraday-multipart (~> 1)
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AtlasRb
4
- # A grouping of {Work}s within a {Community}.
4
+ # A grouping of {Work}s and nested {Collection}s, parented by a {Community}
5
+ # or another Collection.
5
6
  #
6
- # Collections are the leaf containers in the organizational tree they hold
7
- # Works directly. Every Collection has
8
- # exactly one parent Community.
7
+ # Collections nest, exactly as they did in DRS v1: a Collection holds Works
8
+ # and/or child Collections, and its own parent may be a Community or a
9
+ # Collection (Community Community|Collection, Collection → Collection|Work,
10
+ # Work → leaf). A consumer that flattens a subtree must recurse into
11
+ # descendant Collections rather than stopping at direct children.
9
12
  #
10
13
  # See also: {Community}, {Work}.
11
14
  class Collection < Resource
@@ -35,13 +38,13 @@ module AtlasRb
35
38
  body && AtlasRb::Mash.new(body)["collection"]
36
39
  end
37
40
 
38
- # Create a new Collection under an existing Community.
41
+ # Create a new Collection under an existing Community or parent Collection.
39
42
  #
40
- # **Note**: unlike {Community.create}, the `id` parameter here is the
41
- # parent **Community** ID (not a parent Collection ID Collections do
42
- # not nest).
43
+ # The `id` parameter is the parent's ID — a **Community or a Collection**,
44
+ # since Collections nest (a Collection may hold child Collections as well as
45
+ # Works).
43
46
  #
44
- # @param id [String] the parent Community ID.
47
+ # @param id [String] the parent Community or Collection ID.
45
48
  # @param xml_path [String, nil] optional path to a MODS XML file used to
46
49
  # seed metadata. When given, the Collection is created and immediately
47
50
  # patched with the metadata in the file.
@@ -63,7 +66,7 @@ module AtlasRb
63
66
  result = AtlasRb::Mash.new(JSON.parse(
64
67
  connection({ parent_id: id, featured: featured }, nuid, on_behalf_of: on_behalf_of).post(ROUTE)&.body
65
68
  ))["collection"]
66
- return result unless xml_path.present?
69
+ return result if xml_path.to_s.empty?
67
70
 
68
71
  update(result["id"], xml_path, nuid: nuid, on_behalf_of: on_behalf_of)
69
72
  find(result["id"], nuid: nuid, on_behalf_of: on_behalf_of)
@@ -90,10 +93,10 @@ module AtlasRb
90
93
  ))["collection"]
91
94
  end
92
95
 
93
- # Move a Collection to a different parent Community.
96
+ # Move a Collection to a different parent (Community or Collection).
94
97
  #
95
98
  # Wraps `PATCH /collections/<id>/parent` with a `parent_id` of the new
96
- # Community. Atlas re-parents the Collection and synchronously cascades
99
+ # parent. Atlas re-parents the Collection and synchronously cascades
97
100
  # the ancestry index over its Works; the structural rules (type, cycle,
98
101
  # tombstone guards) are enforced server-side and surface as a `422`.
99
102
  #
@@ -101,7 +104,7 @@ module AtlasRb
101
104
  # the only difference is the verb and that the Collection already exists.
102
105
  #
103
106
  # @param id [String] the Collection ID to move.
104
- # @param new_parent_id [String] the destination Community ID.
107
+ # @param new_parent_id [String] the destination Community or Collection ID.
105
108
  # @param nuid [String, nil] optional acting user's NUID. On the relay-signing
106
109
  # path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
107
110
  # path it is ignored (identity lives in the token).
@@ -274,7 +277,7 @@ module AtlasRb
274
277
  def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
275
278
  # json default, html, xml
276
279
  connection({}, nuid, on_behalf_of: on_behalf_of).get(
277
- ROUTE + id + '/mods' + (kind.present? ? ".#{kind}" : '')
280
+ ROUTE + id + '/mods' + (kind.to_s.empty? ? '' : ".#{kind}")
278
281
  )&.body
279
282
  end
280
283
  end
@@ -64,7 +64,7 @@ module AtlasRb
64
64
  result = AtlasRb::Mash.new(JSON.parse(
65
65
  connection({ parent_id: id }, nuid, on_behalf_of: on_behalf_of).post(ROUTE)&.body
66
66
  ))["community"]
67
- return result unless xml_path.present?
67
+ return result if xml_path.to_s.empty?
68
68
 
69
69
  update(result["id"], xml_path, nuid: nuid, on_behalf_of: on_behalf_of)
70
70
  find(result["id"], nuid: nuid, on_behalf_of: on_behalf_of)
@@ -263,7 +263,7 @@ module AtlasRb
263
263
  def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
264
264
  # json default, html, xml
265
265
  connection({}, nuid, on_behalf_of: on_behalf_of).get(
266
- ROUTE + id + '/mods' + (kind.present? ? ".#{kind}" : '')
266
+ ROUTE + id + '/mods' + (kind.to_s.empty? ? '' : ".#{kind}")
267
267
  )&.body
268
268
  end
269
269
  end
@@ -244,7 +244,7 @@ module AtlasRb
244
244
  # end
245
245
  def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
246
246
  connection({}, nuid, on_behalf_of: on_behalf_of).get(
247
- '/resources/' + id + '/mods' + (kind.present? ? ".#{kind}" : '')
247
+ '/resources/' + id + '/mods' + (kind.to_s.empty? ? '' : ".#{kind}")
248
248
  )&.body
249
249
  end
250
250
 
@@ -320,7 +320,7 @@ module AtlasRb
320
320
  def self.mods_version(id, version_id, kind: nil, nuid: nil, on_behalf_of: nil)
321
321
  connection({}, nuid, on_behalf_of: on_behalf_of).get(
322
322
  '/resources/' + id + '/mods/versions/' + version_id +
323
- (kind.present? ? ".#{kind}" : '')
323
+ (kind.to_s.empty? ? '' : ".#{kind}")
324
324
  )&.body
325
325
  end
326
326
 
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AtlasRb
4
- # Current gem version, read from the `.version` file at the repo root at load time.
5
- VERSION = File.read(".version").strip
4
+ # Current gem version, read from the `.version` file at the gem root at load
5
+ # time. Resolved relative to this file (not the process CWD) so a standalone
6
+ # consumer — a headless BYO-JWT script run from anywhere — loads the gem's own
7
+ # version rather than raising ENOENT (or reading some unrelated `.version`).
8
+ VERSION = File.read(File.expand_path("../../.version", __dir__)).strip
6
9
  end
data/lib/atlas_rb/work.rb CHANGED
@@ -124,7 +124,7 @@ module AtlasRb
124
124
  connection(params, nuid,
125
125
  on_behalf_of: on_behalf_of, idempotency_key: idempotency_key).post(ROUTE)&.body
126
126
  ))["work"]
127
- return result unless xml_path.present?
127
+ return result if xml_path.to_s.empty?
128
128
 
129
129
  update(result["id"], xml_path, nuid: nuid, on_behalf_of: on_behalf_of)
130
130
  find(result["id"], nuid: nuid, on_behalf_of: on_behalf_of)
@@ -559,7 +559,7 @@ module AtlasRb
559
559
  def self.mods(id, kind = nil, nuid: nil, on_behalf_of: nil)
560
560
  # json default, html, xml
561
561
  connection({}, nuid, on_behalf_of: on_behalf_of).get(
562
- ROUTE + id + '/mods' + (kind.present? ? ".#{kind}" : '')
562
+ ROUTE + id + '/mods' + (kind.to_s.empty? ? '' : ".#{kind}")
563
563
  )&.body
564
564
  end
565
565
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atlas_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.10
4
+ version: 1.8.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cliff