ddr-core 1.12.0 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/ddr/admin_set.rb +15 -5
- data/app/models/ddr/contact.rb +14 -5
- data/app/models/ddr/language.rb +15 -8
- data/app/models/ddr/rights_statement.rb +16 -7
- data/config/aux/admin_set.yml +26 -0
- data/config/aux/contact.yml +87 -0
- data/config/aux/language.yml +1012 -0
- data/config/aux/rights_statement.yml +107 -0
- data/lib/ddr/auth/ability_definitions/publication_ability_definitions.rb +2 -3
- data/lib/ddr/index/query_result.rb +4 -2
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f1841e5ee3adc06edb3fd81c96df0e290ee3745950a87f444f068dc5c48aff4
|
4
|
+
data.tar.gz: 2f8eae3c291037d51c8053328aa860518252bbff522adc75e928149c971ff585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b595d3c404aae7945c7b7cca2f3bf3a5abfecd0c4bb764d6f80aee27a16a0fad86329e653a9479c8dbd41c58f5e1881b35d9b0a71b351835bb1a4b3c8a6d70fd
|
7
|
+
data.tar.gz: e2a64a032a93c1730db2a5bcbce45bfb970f008d9d74b4ee26e89e5d5c456316cc042b88dd5781f54fc26e46ca49a383b75a5c0c9cb6990766e9235cca4e9727
|
data/app/models/ddr/admin_set.rb
CHANGED
@@ -1,19 +1,29 @@
|
|
1
1
|
module Ddr
|
2
|
-
|
2
|
+
AdminSet = Struct.new(:code, :title, keyword_init: true) do
|
3
|
+
|
4
|
+
def self.config
|
5
|
+
@config ||= YAML.load_file(::File.expand_path('../../../config/aux/admin_set.yml', __dir__))
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.keystore
|
9
|
+
@keystore ||= Hash[config.map { |entry| [entry['code'], new(entry).freeze] }].freeze
|
10
|
+
end
|
3
11
|
|
4
12
|
def self.call(obj)
|
5
13
|
find_by_code(obj.admin_set)
|
6
|
-
rescue ActiveResource::ResourceNotFound => e
|
7
|
-
raise Ddr::NotFoundError, e
|
8
14
|
end
|
9
15
|
|
10
16
|
def self.find_by_code(code)
|
11
17
|
return unless code
|
12
|
-
|
18
|
+
|
19
|
+
keystore.fetch(code)
|
20
|
+
|
21
|
+
rescue KeyError => _
|
22
|
+
raise Ddr::NotFoundError, "AdminSet code '#{code}' not found."
|
13
23
|
end
|
14
24
|
|
15
25
|
def self.keys
|
16
|
-
|
26
|
+
keystore.keys
|
17
27
|
end
|
18
28
|
|
19
29
|
def to_s
|
data/app/models/ddr/contact.rb
CHANGED
@@ -1,14 +1,23 @@
|
|
1
1
|
module Ddr
|
2
|
-
|
2
|
+
Contact = Struct.new(:slug, :name, :short_name, :url, :phone, :email, :ask, keyword_init: true) do
|
3
|
+
|
4
|
+
def self.config
|
5
|
+
@config ||= YAML.load_file(::File.expand_path('../../../config/aux/contact.yml', __dir__))
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.keystore
|
9
|
+
@keystore ||= Hash[config.map { |entry| [entry['slug'], new(entry).freeze] }].freeze
|
10
|
+
end
|
3
11
|
|
4
12
|
def self.call(slug)
|
5
|
-
|
6
|
-
|
7
|
-
|
13
|
+
keystore.fetch(slug)
|
14
|
+
|
15
|
+
rescue KeyError => _
|
16
|
+
raise Ddr::NotFoundError, "Contact slug '#{slug}' not found."
|
8
17
|
end
|
9
18
|
|
10
19
|
def self.keys
|
11
|
-
|
20
|
+
keystore.keys
|
12
21
|
end
|
13
22
|
|
14
23
|
def to_s
|
data/app/models/ddr/language.rb
CHANGED
@@ -1,21 +1,28 @@
|
|
1
1
|
module Ddr
|
2
|
-
|
2
|
+
Language = Struct.new(:code, :label, keyword_init: true) do
|
3
|
+
|
4
|
+
def self.config
|
5
|
+
@config ||= YAML.load_file(::File.expand_path('../../../config/aux/language.yml', __dir__))
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.keystore
|
9
|
+
@keystore ||= Hash[config.map { |entry| [entry['code'], new(entry).freeze] }].freeze
|
10
|
+
end
|
3
11
|
|
4
12
|
def self.call(obj)
|
5
|
-
obj.language.map
|
6
|
-
find_by_code(lang)
|
7
|
-
end
|
8
|
-
rescue ActiveResource::ResourceNotFound => e
|
9
|
-
raise Ddr::NotFoundError, e
|
13
|
+
obj.language.map { |lang| find_by_code(lang) }
|
10
14
|
end
|
11
15
|
|
12
16
|
def self.find_by_code(code)
|
13
17
|
return unless code
|
14
|
-
|
18
|
+
|
19
|
+
keystore.fetch(code)
|
20
|
+
rescue KeyError => _
|
21
|
+
raise Ddr::NotFoundError, "Language code '#{code}' not found."
|
15
22
|
end
|
16
23
|
|
17
24
|
def self.codes
|
18
|
-
|
25
|
+
keystore.keys
|
19
26
|
end
|
20
27
|
|
21
28
|
def to_s
|
@@ -1,16 +1,25 @@
|
|
1
1
|
module Ddr
|
2
|
-
|
2
|
+
RightsStatement = Struct.new(:title, :url, :short_title, :feature, :reuse_text, keyword_init: true) do
|
3
|
+
|
4
|
+
def self.config
|
5
|
+
@config ||= YAML.load_file(::File.expand_path('../../../config/aux/rights_statement.yml', __dir__))
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.keystore
|
9
|
+
@keystore ||= Hash[config.map { |entry| [entry['url'], new(entry).freeze] }].freeze
|
10
|
+
end
|
3
11
|
|
4
12
|
def self.call(obj)
|
5
|
-
if obj.rights.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
13
|
+
return if obj.rights.empty?
|
14
|
+
|
15
|
+
keystore.fetch(obj.rights.first)
|
16
|
+
|
17
|
+
rescue KeyError => _
|
18
|
+
raise Ddr::NotFoundError, "Rights statement '#{obj.rights.first}' not found."
|
10
19
|
end
|
11
20
|
|
12
21
|
def self.keys
|
13
|
-
|
22
|
+
keystore.keys
|
14
23
|
end
|
15
24
|
|
16
25
|
def to_s
|
@@ -0,0 +1,26 @@
|
|
1
|
+
- code: dul_collections
|
2
|
+
title: DUL Collections
|
3
|
+
|
4
|
+
- code: duson
|
5
|
+
title: Duke University School of Nursing Digital Archive
|
6
|
+
|
7
|
+
- code: ebooks
|
8
|
+
title: Electronic Books
|
9
|
+
|
10
|
+
- code: nescent
|
11
|
+
title: 'NESCent: National Evolutionary Synthesis Center'
|
12
|
+
|
13
|
+
- code: dc
|
14
|
+
title: Digital Collections
|
15
|
+
|
16
|
+
- code: dvs
|
17
|
+
title: Data and Visualization Services
|
18
|
+
|
19
|
+
- code: rubenstein
|
20
|
+
title: Rubenstein Library
|
21
|
+
|
22
|
+
- code: duke_scholarship
|
23
|
+
title: Duke Scholarship
|
24
|
+
|
25
|
+
- code: researchdata
|
26
|
+
title: Duke Research Data
|
@@ -0,0 +1,87 @@
|
|
1
|
+
- slug: dvs
|
2
|
+
name: Data and Visualization Services
|
3
|
+
short_name: null
|
4
|
+
url: http://library.duke.edu/data/
|
5
|
+
phone: 919-660-5880
|
6
|
+
email: askdata@duke.edu
|
7
|
+
ask: null
|
8
|
+
|
9
|
+
- slug: libraries
|
10
|
+
name: Duke University Libraries
|
11
|
+
short_name: null
|
12
|
+
url: http://library.duke.edu
|
13
|
+
phone: 919-660-5880
|
14
|
+
email: askref@duke.edu
|
15
|
+
ask: http://library.duke.edu/research/ask
|
16
|
+
|
17
|
+
- slug: divinity
|
18
|
+
name: Divinity School Library
|
19
|
+
short_name: null
|
20
|
+
url: http://library.divinity.duke.edu/
|
21
|
+
phone: 919-660-3453
|
22
|
+
email: divlib@duke.edu
|
23
|
+
ask: http://library.divinity.duke.edu/ask-us
|
24
|
+
|
25
|
+
- slug: uarchives
|
26
|
+
name: Duke University Archives
|
27
|
+
short_name: University Archives
|
28
|
+
url: http://library.duke.edu/rubenstein/uarchives/
|
29
|
+
phone: 919-660-5822
|
30
|
+
email: uarchives@duke.edu
|
31
|
+
ask: http://library.duke.edu/rubenstein/uarchives/ask
|
32
|
+
|
33
|
+
- slug: humanrights
|
34
|
+
name: Human Rights Archive
|
35
|
+
short_name: null
|
36
|
+
url: http://library.duke.edu/rubenstein/human-rights/
|
37
|
+
phone: 919-660-5822
|
38
|
+
email: special-collections@duke.edu
|
39
|
+
ask: http://library.duke.edu/rubenstein/ask
|
40
|
+
|
41
|
+
- slug: hom
|
42
|
+
name: History of Medicine Collections
|
43
|
+
short_name: null
|
44
|
+
url: http://library.duke.edu/rubenstein/history-of-medicine/
|
45
|
+
phone: 919-684-8549
|
46
|
+
email: special-collections@duke.edu
|
47
|
+
ask: http://library.duke.edu/rubenstein/ask
|
48
|
+
|
49
|
+
- slug: franklin
|
50
|
+
name: John Hope Franklin Research Center
|
51
|
+
short_name: Franklin Research Center
|
52
|
+
url: http://library.duke.edu/rubenstein/franklin/
|
53
|
+
phone: 919-660-5922
|
54
|
+
email: franklin-collection@duke.edu
|
55
|
+
ask: http://library.duke.edu/rubenstein/ask
|
56
|
+
|
57
|
+
- slug: docarts
|
58
|
+
name: Archive of Documentary Arts
|
59
|
+
short_name: null
|
60
|
+
url: http://library.duke.edu/rubenstein/documentaryarts/
|
61
|
+
phone: 919-660-5822
|
62
|
+
email: special-collections@duke.edu
|
63
|
+
ask: http://library.duke.edu/rubenstein/ask
|
64
|
+
|
65
|
+
- slug: bingham
|
66
|
+
name: Sallie Bingham Center for Women's History & Culture
|
67
|
+
short_name: Bingham Center
|
68
|
+
url: http://library.duke.edu/rubenstein/bingham/
|
69
|
+
phone: 919-660-5967
|
70
|
+
email: cwhc@duke.edu
|
71
|
+
ask: http://library.duke.edu/rubenstein/ask
|
72
|
+
|
73
|
+
- slug: hartman
|
74
|
+
name: John W. Hartman Center for Sales, Advertising & Marketing History
|
75
|
+
short_name: Hartman Center
|
76
|
+
url: http://library.duke.edu/rubenstein/hartman/
|
77
|
+
phone: 919-660-5827
|
78
|
+
email: hartman-center@duke.edu
|
79
|
+
ask: http://library.duke.edu/rubenstein/hartman/ask
|
80
|
+
|
81
|
+
- slug: rubenstein
|
82
|
+
name: David M. Rubenstein Rare Book & Manuscript Library
|
83
|
+
short_name: Rubenstein Library
|
84
|
+
url: http://library.duke.edu/rubenstein/
|
85
|
+
phone: 919-660-5822
|
86
|
+
email: special-collections@duke.edu
|
87
|
+
ask: http://library.duke.edu/rubenstein/ask
|