samvera-nesting_indexer 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db20ed764f7dd33ef371314bb52ed8e06500dc1f
4
- data.tar.gz: 6cf90e59b6819286d325c2ec82497bf550d42b83
3
+ metadata.gz: 0be21dd61b9f5f3d6b6ccad2c1b1ed80716eae2d
4
+ data.tar.gz: 892250b2ba5c0928c1ff2dc2f70e8ccce4e66540
5
5
  SHA512:
6
- metadata.gz: 5e348afe845977f56580ae7e7d2acd480863191b954eec16d5d9386ddb8aadedb91e21c596e2fc6aa09596f1aa29cefa8bae7a298651cb3658ea37758606e4f8
7
- data.tar.gz: 86f1f58a48b2b16f27f0f1879009fd9fb705c210aa5a2090dddbd798d553f1566e05d0bb0c25f58a8a50511ebebc7b3722fffdfa27267cce72a12ba32a1b50d6
6
+ metadata.gz: f8bb638efe4d51cedc36e480512d7cbd7745deae8391a9eee6a08edc948c2e2894abd6669fba9015ad1e2bbebb3389d34784966fa5c7b9829f7e1bf2fc84fbf1
7
+ data.tar.gz: 7880f1c9bff81f31f6fe1d503cb1786c533e6cb1be06878de92a9930695f5d2d77bc8dcc39dfdbf1d0d8b371df36b2c27096e12ea07590899075cbdf3d1e6be4
@@ -48,6 +48,10 @@ module Samvera
48
48
  @configuration ||= Configuration.new
49
49
  end
50
50
 
51
+ class << self
52
+ alias config configuration
53
+ end
54
+
51
55
  # @api public
52
56
  #
53
57
  # Exposes the data adapter to use for the reindexing process.
@@ -33,9 +33,13 @@ module Samvera
33
33
  end
34
34
 
35
35
  # @api public
36
- # @param attributes [Hash]
36
+ # @see README.md
37
+ # @param id [String]
38
+ # @param parent_ids [Array<String>]
39
+ # @param ancestors [Array<String>]
40
+ # @param pathnames [Array<String>]
37
41
  # @return Hash - the attributes written to the indexing layer
38
- def self.write_document_attributes_to_index_layer(attributes:)
42
+ def self.write_document_attributes_to_index_layer(id:, parent_ids:, ancestors:, pathnames:)
39
43
  raise NotImplementedError
40
44
  end
41
45
  end
@@ -47,10 +47,14 @@ module Samvera
47
47
  end
48
48
 
49
49
  # @api public
50
- # @param attributes [Hash]
50
+ # @see README.md
51
+ # @param id [String]
52
+ # @param parent_ids [Array<String>]
53
+ # @param ancestors [Array<String>]
54
+ # @param pathnames [Array<String>]
51
55
  # @return Hash - the attributes written to the indexing layer
52
- def self.write_document_attributes_to_index_layer(attributes:)
53
- Index.write_document(attributes)
56
+ def self.write_document_attributes_to_index_layer(id:, parent_ids:, ancestors:, pathnames:)
57
+ Index.write_document(id: id, parent_ids: parent_ids, ancestors: ancestors, pathnames: pathnames)
54
58
  end
55
59
 
56
60
  # @api private
@@ -108,8 +112,8 @@ module Samvera
108
112
  MemoryStorage.clear_cache!
109
113
  end
110
114
 
111
- def self.write_document(attributes = {})
112
- Documents::PreservationDocument.new(attributes).tap do |doc|
115
+ def self.write_document(**kargs)
116
+ Documents::PreservationDocument.new(**kargs).tap do |doc|
113
117
  MemoryStorage.write(doc)
114
118
  end
115
119
  end
@@ -1,8 +1,8 @@
1
1
  if defined?(RSpec)
2
2
  RSpec.shared_examples 'a Samvera::NestingIndexer::Adapter' do
3
- let(:required_keyword_parameters) { ->(method) { method.parameters.select { |type, _kwarg| type == :keyreq }.map(&:last) } }
4
- let(:required_parameters) { ->(method) { method.parameters.select { |type, _kwarg| type == :keyreq || type == :req }.map(&:last) } }
5
- let(:block_parameter_extracter) { ->(method) { method.parameters.select { |type, _kwarg| type == :block }.map(&:last) } }
3
+ let(:required_keyword_parameters) { ->(method) { method.parameters.select { |type, _kwarg| type == :keyreq }.map(&:last).sort } }
4
+ let(:required_parameters) { ->(method) { method.parameters.select { |type, _kwarg| type == :keyreq || type == :req }.map(&:last).sort } }
5
+ let(:block_parameter_extracter) { ->(method) { method.parameters.select { |type, _kwarg| type == :block }.map(&:last).sort } }
6
6
 
7
7
  describe '.find_preservation_document_by' do
8
8
  subject { described_class.method(:find_preservation_document_by) }
@@ -68,7 +68,7 @@ if defined?(RSpec)
68
68
  subject { described_class.method(:write_document_attributes_to_index_layer) }
69
69
 
70
70
  it 'requires the :attributes keyword (and does not require any others)' do
71
- expect(required_keyword_parameters.call(subject)).to eq([:attributes])
71
+ expect(required_keyword_parameters.call(subject)).to eq(%i(ancestors id parent_ids pathnames))
72
72
  end
73
73
 
74
74
  it 'does not require any other parameters (besides :attributes)' do
@@ -72,7 +72,7 @@ module Samvera
72
72
  raise Exceptions::CycleDetectionError, id if index_document.maximum_nesting_depth <= 0
73
73
  preservation_document = adapter.find_preservation_document_by(id: index_document.id)
74
74
  parent_ids_and_path_and_ancestors = parent_ids_and_path_and_ancestors_for(preservation_document)
75
- adapter.write_document_attributes_to_index_layer(attributes: parent_ids_and_path_and_ancestors)
75
+ adapter.write_document_attributes_to_index_layer(**parent_ids_and_path_and_ancestors)
76
76
  end
77
77
 
78
78
  def parent_ids_and_path_and_ancestors_for(preservation_document)
@@ -1,5 +1,5 @@
1
1
  module Samvera
2
2
  module NestingIndexer
3
- VERSION = "0.4.1".freeze
3
+ VERSION = "0.5.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samvera-nesting_indexer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-24 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler