cocina-models 0.66.0 → 0.68.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -0
  3. data/README.md +5 -0
  4. data/cocina-models.gemspec +3 -1
  5. data/lib/cocina/generator/generator.rb +1 -6
  6. data/lib/cocina/generator/vocab.rb +36 -39
  7. data/lib/cocina/models/access.rb +3 -3
  8. data/lib/cocina/models/admin_policy.rb +1 -1
  9. data/lib/cocina/models/{admin_policy_default_access.rb → admin_policy_access_template.rb} +4 -4
  10. data/lib/cocina/models/admin_policy_administrative.rb +1 -1
  11. data/lib/cocina/models/administrative.rb +0 -3
  12. data/lib/cocina/models/citation_only_access.rb +3 -3
  13. data/lib/cocina/models/collection.rb +6 -6
  14. data/lib/cocina/models/collection_access.rb +1 -1
  15. data/lib/cocina/models/controlled_digital_lending_access.rb +3 -3
  16. data/lib/cocina/models/dark_access.rb +3 -3
  17. data/lib/cocina/models/dro.rb +16 -16
  18. data/lib/cocina/models/dro_access.rb +4 -4
  19. data/lib/cocina/models/embargo.rb +3 -3
  20. data/lib/cocina/models/file.rb +1 -1
  21. data/lib/cocina/models/file_access.rb +3 -3
  22. data/lib/cocina/models/file_set.rb +16 -16
  23. data/lib/cocina/models/file_set_type.rb +72 -0
  24. data/lib/cocina/models/location_based_access.rb +3 -3
  25. data/lib/cocina/models/location_based_download_access.rb +3 -3
  26. data/lib/cocina/models/object_type.rb +96 -0
  27. data/lib/cocina/models/request_admin_policy.rb +2 -2
  28. data/lib/cocina/models/request_administrative.rb +14 -0
  29. data/lib/cocina/models/request_collection.rb +7 -7
  30. data/lib/cocina/models/request_dro.rb +17 -17
  31. data/lib/cocina/models/request_file.rb +1 -1
  32. data/lib/cocina/models/request_file_set.rb +16 -16
  33. data/lib/cocina/models/stanford_access.rb +3 -3
  34. data/lib/cocina/models/validator.rb +1 -1
  35. data/lib/cocina/models/version.rb +1 -1
  36. data/lib/cocina/models/world_access.rb +3 -3
  37. data/lib/cocina/models.rb +14 -7
  38. data/openapi.yml +143 -122
  39. metadata +14 -6
  40. data/lib/cocina/models/vocab.rb +0 -162
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: def07c3b758899fb7dafda2ab26d7376318137895cb1335ab22404ab939e6e15
4
- data.tar.gz: cb8f57478510d3f40a9241e944484437889dbf4b0b09e992696da7b9d1e595c1
3
+ metadata.gz: d958e46bc006eefe8d06d8d1d82e877ba59b16efb805668fb3f269c04bfb200b
4
+ data.tar.gz: f5bdcce64f7471c944e39ddd9406f4ca93d87279cf95a1d0539943ce9481edf5
5
5
  SHA512:
6
- metadata.gz: 1de2f3d0703139311d8f58f1ec24b5b579b330c0461c645ebe76d153930ab91850d694a2b7a138a8ee6c63ee8ba5562f6c24ff044a7dd0bf40355eb1007afd51
7
- data.tar.gz: ecdfd2b784a0e42c30e348d08dbe7a6f092c369d7830dd86b11c2ff8185fef4238068fdc4b5e7fe8af90d1d9477e17436d03fde5058855d97819a7270ebc304e
6
+ metadata.gz: 40c18189082759e6611b18164ab793e26a8add49fdb8bc74b9e333e59d7be73a3268e3d98bc11e066a924206dc8501c52e56bcde64f1ef38d8b40d943ff3ef75
7
+ data.tar.gz: 0660a591a00e07846274f123f2a6f3e1715244e24c9a5998a5ed7e36753c6d6ab302365b1a09bf5368c61aeb7a15ad32b9656bd136cc4e194883345abf6e6dbd
data/.rubocop.yml CHANGED
@@ -83,9 +83,16 @@ Metrics/MethodLength:
83
83
  Max: 14
84
84
  Exclude:
85
85
  - 'spec/cocina/models/file_access_spec.rb'
86
+ - 'spec/cocina/models/dro_access_spec.rb'
86
87
 
87
88
  # ----- RSpec ------
88
89
 
90
+ RSpec/BeEq: # new in 2.9.0
91
+ Enabled: true
92
+
93
+ RSpec/BeNil: # new in 2.9.0
94
+ Enabled: true
95
+
89
96
  RSpec/ExampleLength:
90
97
  Max: 18
91
98
  Exclude:
data/README.md CHANGED
@@ -26,6 +26,11 @@ exe/generator generate
26
26
  exe/generator generate_schema DRO
27
27
  ```
28
28
 
29
+ ### Controlled vocabularies
30
+ ```
31
+ exe/generator generate_vocab
32
+ ```
33
+
29
34
  ## Testing
30
35
 
31
36
  The generator is tested via its output when run against `openapi.yml`, viz., the Cocina model classes. Thus, `generate` should be run after any changes to `openapi.yml`.
@@ -28,7 +28,9 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency 'dry-struct', '~> 1.0'
29
29
  spec.add_dependency 'dry-types', '~> 1.1'
30
30
  spec.add_dependency 'openapi3_parser' # Parsing openapi doc
31
- spec.add_dependency 'openapi_parser' # Validating openapi requests
31
+ # Match these version requirements to what committee wants,
32
+ # so that our client (non-committee) users have the same dependencies.
33
+ spec.add_dependency 'openapi_parser', '>= 0.11.1', '< 1.0'
32
34
  spec.add_dependency 'thor'
33
35
  spec.add_dependency 'zeitwerk', '~> 2.1'
34
36
 
@@ -42,12 +42,7 @@ module Cocina
42
42
 
43
43
  desc 'generate_vocab', 'generate vocab'
44
44
  def generate_vocab
45
- vocab = Vocab.new(schemas)
46
- filepath = "#{options[:output]}/#{vocab.filename}"
47
- FileUtils.rm_f(filepath)
48
-
49
- create_file filepath, vocab.generate
50
- run("rubocop -a #{filepath} > /dev/null")
45
+ Vocab.generate(schemas, output_dir: options[:output])
51
46
  end
52
47
 
53
48
  private
@@ -4,36 +4,47 @@ module Cocina
4
4
  module Generator
5
5
  # Class for generating a vocab
6
6
  class Vocab
7
- def initialize(schemas)
8
- @schemas = schemas
7
+ CLASS_COMMENT = {
8
+ 'ObjectType' => 'This vocabulary defines the top level object type',
9
+ 'FileSetType' => 'This vocabulary defines the types of file sets'
10
+ }.freeze
11
+
12
+ def self.generate(schemas, output_dir:)
13
+ new(schemas, output_dir: output_dir).generate
9
14
  end
10
15
 
11
- def filename
12
- 'vocab.rb'
16
+ def initialize(schemas, output_dir:)
17
+ @schemas = schemas
18
+ @output_dir = output_dir
13
19
  end
14
20
 
15
21
  def generate
16
- <<~RUBY
17
- # frozen_string_literal: true
18
-
19
- module Cocina
20
- module Models
21
- # A digital repository object. See http://sul-dlss.github.io/cocina-models/maps/DRO.json
22
- class Vocab
22
+ names.each do |namespace, v|
23
+ filepath = File.join(output_dir, "#{namespace.underscore}.rb")
24
+ File.write(filepath, contents(namespace, v))
25
+ end
26
+ end
23
27
 
24
- #{vocab_methods}
28
+ def contents(namespace, methods)
29
+ <<~RUBY
30
+ # frozen_string_literal: true
25
31
 
26
- end
27
- end
32
+ module Cocina
33
+ module Models
34
+ # #{CLASS_COMMENT.fetch(namespace)}
35
+ class #{namespace}
36
+ #{draw_ruby_methods(methods, 6)}
37
+ end
38
+ end
28
39
  end
29
40
  RUBY
30
41
  end
31
42
 
32
43
  private
33
44
 
34
- attr_reader :schemas
45
+ attr_reader :schemas, :output_dir
35
46
 
36
- BASE = 'http://cocina.sul.stanford.edu/models/'
47
+ BASE = 'https://cocina.sul.stanford.edu/models/'
37
48
 
38
49
  def vocabs
39
50
  type_properties = schemas.values.map { |schema| schema.properties['type'] }.compact
@@ -43,37 +54,23 @@ module Cocina
43
54
  .sort
44
55
  end
45
56
 
46
- def vocab_methods
47
- names = vocabs.each_with_object({}) do |vocab, object|
57
+ def names
58
+ @names ||= vocabs.each_with_object({}) do |vocab, object|
48
59
  # Note special handling of 3d
49
- namespaced = vocab.delete_prefix(BASE).delete_suffix('.jsonld')
60
+ namespaced = vocab.delete_prefix(BASE)
50
61
  .gsub('-', '_').gsub('3d', 'three_dimensional')
51
- namespace, name = namespaced.include?('/') ? namespaced.split('/') : [:root, namespaced]
62
+ namespace, name = namespaced.include?('/') ? namespaced.split('/') : ['ObjectType', namespaced]
63
+ namespace = 'FileSetType' if namespace == 'resources'
52
64
  object[namespace] ||= {}
53
65
  object[namespace][name] = vocab
54
66
  end
55
- draw_namespaced_methods(names)
56
67
  end
57
68
 
58
- def draw_namespaced_methods(names)
59
- names.flat_map do |namespace, methods|
60
- [].tap do |items|
61
- items << "class #{namespace.capitalize}" unless namespace == :root
62
- items << draw_ruby_methods(methods)
63
- items << 'end' unless namespace == :root
64
- end
65
- end.join("\n")
66
- end
67
-
68
- def draw_ruby_methods(methods)
69
+ def draw_ruby_methods(methods, indent)
70
+ spaces = ' ' * indent
69
71
  methods.map do |name, vocab|
70
- <<~RUBY
71
- def self.#{name}
72
- "#{vocab}"
73
- end
74
-
75
- RUBY
76
- end.join("\n")
72
+ "#{spaces}def self.#{name}\n#{spaces} '#{vocab}'\n#{spaces}end"
73
+ end.join("\n\n")
77
74
  end
78
75
  end
79
76
  end
@@ -5,13 +5,13 @@ module Cocina
5
5
  class Access < Struct
6
6
  # Access level.
7
7
  # Validation of this property is relaxed. See the openapi for full validation.
8
- attribute :access, Types::Strict::String.optional.default('dark').meta(omittable: true)
8
+ attribute :view, Types::Strict::String.optional.default('dark').meta(omittable: true)
9
9
  # Download access level.
10
10
  # Validation of this property is relaxed. See the openapi for full validation.
11
11
  attribute :download, Types::Strict::String.optional.default('none').meta(omittable: true)
12
- # If access is "location-based", which location should have access.
12
+ # Not used for this access type, must be null.
13
13
  # Validation of this property is relaxed. See the openapi for full validation.
14
- attribute :readLocation, Types::Strict::String.optional.meta(omittable: true)
14
+ attribute :location, Types::Strict::String.optional.meta(omittable: true)
15
15
  # Validation of this property is relaxed. See the openapi for full validation.
16
16
  attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
17
17
  end
@@ -7,7 +7,7 @@ module Cocina
7
7
 
8
8
  include Checkable
9
9
 
10
- TYPES = ['http://cocina.sul.stanford.edu/models/admin_policy.jsonld'].freeze
10
+ TYPES = ['https://cocina.sul.stanford.edu/models/admin_policy'].freeze
11
11
 
12
12
  # The version of Cocina with which this object conforms.
13
13
  # example: 1.2.3
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- class AdminPolicyDefaultAccess < Struct
6
- attribute :access, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
5
+ class AdminPolicyAccessTemplate < Struct
6
+ attribute :view, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
7
7
  # Available for controlled digital lending.
8
8
  attribute :controlledDigitalLending, Types::Strict::Bool.meta(omittable: true)
9
9
  # The human readable copyright statement that applies
@@ -12,9 +12,9 @@ module Cocina
12
12
  # Download access level. This is used in the transition from Fedora as a way to set a default download level at registration that is copied down to all the files.
13
13
 
14
14
  attribute :download, Types::Strict::String.enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
15
- # If access is "location-based", which location should have access. This is used in the transition from Fedora as a way to set a default readLocation at registration that is copied down to all the files.
15
+ # If access or download is "location-based", this indicates which location should have access. This is used in the transition from Fedora as a way to set a default location at registration that is copied down to all the files.
16
16
 
17
- attribute :readLocation, Types::Strict::String.optional.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
17
+ attribute :location, Types::Strict::String.optional.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
18
18
  # The human readable use and reproduction statement that applies
19
19
  # example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
20
20
  attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
@@ -3,7 +3,7 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class AdminPolicyAdministrative < Struct
6
- attribute :defaultAccess, AdminPolicyDefaultAccess.optional.meta(omittable: true)
6
+ attribute(:accessTemplate, AdminPolicyAccessTemplate.default { AdminPolicyAccessTemplate.new })
7
7
  attribute :registrationWorkflow, Types::Strict::Array.of(Types::Strict::String).default([].freeze)
8
8
  # An additional workflow to start for objects managed by this admin policy once the end-accession workflow step is complete
9
9
  # example: wasCrawlPreassemblyWF
@@ -6,9 +6,6 @@ module Cocina
6
6
  # example: druid:bc123df4567
7
7
  attribute :hasAdminPolicy, Types::Strict::String
8
8
  attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).default([].freeze)
9
- # Administrative or Internal project this resource is a part of
10
- # example: Google Books
11
- attribute :partOfProject, Types::Strict::String.meta(omittable: true)
12
9
  end
13
10
  end
14
11
  end
@@ -4,11 +4,11 @@ module Cocina
4
4
  module Models
5
5
  class CitationOnlyAccess < Struct
6
6
  # Access level.
7
- attribute :access, Types::Strict::String.enum('citation-only')
7
+ attribute :view, Types::Strict::String.enum('citation-only')
8
8
  # Download access level.
9
9
  attribute :download, Types::Strict::String.enum('none')
10
- # If access is "location-based", which location should have access.
11
- attribute :readLocation, Types::Strict::String.optional.enum('').meta(omittable: true)
10
+ # Not used for this access type, must be null.
11
+ attribute :location, Types::Strict::String.optional.enum('').meta(omittable: true)
12
12
  attribute :controlledDigitalLending, Types::Strict::Bool.enum(false).meta(omittable: true)
13
13
  end
14
14
  end
@@ -7,11 +7,11 @@ module Cocina
7
7
 
8
8
  include Checkable
9
9
 
10
- TYPES = ['http://cocina.sul.stanford.edu/models/collection.jsonld',
11
- 'http://cocina.sul.stanford.edu/models/curated-collection.jsonld',
12
- 'http://cocina.sul.stanford.edu/models/user-collection.jsonld',
13
- 'http://cocina.sul.stanford.edu/models/exhibit.jsonld',
14
- 'http://cocina.sul.stanford.edu/models/series.jsonld'].freeze
10
+ TYPES = ['https://cocina.sul.stanford.edu/models/collection',
11
+ 'https://cocina.sul.stanford.edu/models/curated-collection',
12
+ 'https://cocina.sul.stanford.edu/models/user-collection',
13
+ 'https://cocina.sul.stanford.edu/models/exhibit',
14
+ 'https://cocina.sul.stanford.edu/models/series'].freeze
15
15
 
16
16
  # The version of Cocina with which this object conforms.
17
17
  # example: 1.2.3
@@ -26,7 +26,7 @@ module Cocina
26
26
  attribute :version, Types::Strict::Integer
27
27
  attribute(:access, CollectionAccess.default { CollectionAccess.new })
28
28
  attribute :administrative, Administrative.optional.meta(omittable: true)
29
- attribute :description, Description.optional.meta(omittable: true)
29
+ attribute(:description, Description.default { Description.new })
30
30
  attribute :identification, CollectionIdentification.optional.meta(omittable: true)
31
31
  end
32
32
  end
@@ -4,7 +4,7 @@ module Cocina
4
4
  module Models
5
5
  class CollectionAccess < Struct
6
6
  # Access level
7
- attribute :access, Types::Strict::String.default('dark').enum('world', 'dark').meta(omittable: true)
7
+ attribute :view, Types::Strict::String.default('dark').enum('world', 'dark').meta(omittable: true)
8
8
  # The human readable copyright statement that applies
9
9
  # example: Copyright World Trade Organization
10
10
  attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
@@ -4,11 +4,11 @@ module Cocina
4
4
  module Models
5
5
  class ControlledDigitalLendingAccess < Struct
6
6
  # Access level.
7
- attribute :access, Types::Strict::String.enum('stanford')
7
+ attribute :view, Types::Strict::String.enum('stanford')
8
8
  # Download access level.
9
9
  attribute :download, Types::Strict::String.enum('none')
10
- # If access is "location-based", which location should have access.
11
- attribute :readLocation, Types::Strict::String.optional.enum('').meta(omittable: true)
10
+ # Not used for this access type, must be null.
11
+ attribute :location, Types::Strict::String.optional.enum('').meta(omittable: true)
12
12
  # Available for controlled digital lending.
13
13
  attribute :controlledDigitalLending, Types::Strict::Bool.default(false)
14
14
  end
@@ -4,11 +4,11 @@ module Cocina
4
4
  module Models
5
5
  class DarkAccess < Struct
6
6
  # Access level.
7
- attribute :access, Types::Strict::String.default('dark').enum('dark').meta(omittable: true)
7
+ attribute :view, Types::Strict::String.default('dark').enum('dark').meta(omittable: true)
8
8
  # Download access level.
9
9
  attribute :download, Types::Strict::String.default('none').enum('none').meta(omittable: true)
10
- # If access is "location-based", which location should have access.
11
- attribute :readLocation, Types::Strict::String.optional.enum('').meta(omittable: true)
10
+ # Not used for this access type, must be null.
11
+ attribute :location, Types::Strict::String.optional.enum('').meta(omittable: true)
12
12
  attribute :controlledDigitalLending, Types::Strict::Bool.enum(false).meta(omittable: true)
13
13
  end
14
14
  end
@@ -7,21 +7,21 @@ module Cocina
7
7
 
8
8
  include Checkable
9
9
 
10
- TYPES = ['http://cocina.sul.stanford.edu/models/object.jsonld',
11
- 'http://cocina.sul.stanford.edu/models/3d.jsonld',
12
- 'http://cocina.sul.stanford.edu/models/agreement.jsonld',
13
- 'http://cocina.sul.stanford.edu/models/book.jsonld',
14
- 'http://cocina.sul.stanford.edu/models/document.jsonld',
15
- 'http://cocina.sul.stanford.edu/models/geo.jsonld',
16
- 'http://cocina.sul.stanford.edu/models/image.jsonld',
17
- 'http://cocina.sul.stanford.edu/models/page.jsonld',
18
- 'http://cocina.sul.stanford.edu/models/photograph.jsonld',
19
- 'http://cocina.sul.stanford.edu/models/manuscript.jsonld',
20
- 'http://cocina.sul.stanford.edu/models/map.jsonld',
21
- 'http://cocina.sul.stanford.edu/models/media.jsonld',
22
- 'http://cocina.sul.stanford.edu/models/track.jsonld',
23
- 'http://cocina.sul.stanford.edu/models/webarchive-binary.jsonld',
24
- 'http://cocina.sul.stanford.edu/models/webarchive-seed.jsonld'].freeze
10
+ TYPES = ['https://cocina.sul.stanford.edu/models/object',
11
+ 'https://cocina.sul.stanford.edu/models/3d',
12
+ 'https://cocina.sul.stanford.edu/models/agreement',
13
+ 'https://cocina.sul.stanford.edu/models/book',
14
+ 'https://cocina.sul.stanford.edu/models/document',
15
+ 'https://cocina.sul.stanford.edu/models/geo',
16
+ 'https://cocina.sul.stanford.edu/models/image',
17
+ 'https://cocina.sul.stanford.edu/models/page',
18
+ 'https://cocina.sul.stanford.edu/models/photograph',
19
+ 'https://cocina.sul.stanford.edu/models/manuscript',
20
+ 'https://cocina.sul.stanford.edu/models/map',
21
+ 'https://cocina.sul.stanford.edu/models/media',
22
+ 'https://cocina.sul.stanford.edu/models/track',
23
+ 'https://cocina.sul.stanford.edu/models/webarchive-binary',
24
+ 'https://cocina.sul.stanford.edu/models/webarchive-seed'].freeze
25
25
 
26
26
  # The version of Cocina with which this object conforms.
27
27
  # example: 1.2.3
@@ -36,7 +36,7 @@ module Cocina
36
36
  attribute :version, Types::Strict::Integer
37
37
  attribute(:access, DROAccess.default { DROAccess.new })
38
38
  attribute(:administrative, Administrative.default { Administrative.new })
39
- attribute :description, Description.optional.meta(omittable: true)
39
+ attribute(:description, Description.default { Description.new })
40
40
  attribute :identification, Identification.optional.meta(omittable: true)
41
41
  attribute :structural, DROStructural.optional.meta(omittable: true)
42
42
  attribute :geographic, Geographic.optional.meta(omittable: true)
@@ -5,13 +5,13 @@ module Cocina
5
5
  class DROAccess < Struct
6
6
  # Access level.
7
7
  # Validation of this property is relaxed. See the openapi for full validation.
8
- attribute :access, Types::Strict::String.optional.default('dark').meta(omittable: true)
8
+ attribute :view, Types::Strict::String.optional.default('dark').meta(omittable: true)
9
9
  # Download access level.
10
10
  # Validation of this property is relaxed. See the openapi for full validation.
11
11
  attribute :download, Types::Strict::String.optional.default('none').meta(omittable: true)
12
- # If access is "location-based", which location should have access.
12
+ # Not used for this access type, must be null.
13
13
  # Validation of this property is relaxed. See the openapi for full validation.
14
- attribute :readLocation, Types::Strict::String.optional.meta(omittable: true)
14
+ attribute :location, Types::Strict::String.optional.meta(omittable: true)
15
15
  # Validation of this property is relaxed. See the openapi for full validation.
16
16
  attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
17
17
  # The human readable copyright statement that applies
@@ -22,7 +22,7 @@ module Cocina
22
22
  # example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
23
23
  attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
24
24
  # The license governing reuse of the DRO. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
25
- attribute :license, Types::Strict::String.optional.enum('https://www.gnu.org/licenses/agpl.txt', 'https://www.apache.org/licenses/LICENSE-2.0', 'https://opensource.org/licenses/BSD-2-Clause', 'https://opensource.org/licenses/BSD-3-Clause', 'https://creativecommons.org/licenses/by/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode', 'https://creativecommons.org/licenses/by-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-sa/4.0/legalcode', 'https://creativecommons.org/publicdomain/zero/1.0/legalcode', 'https://opensource.org/licenses/cddl1', 'https://www.eclipse.org/legal/epl-2.0', 'https://www.gnu.org/licenses/gpl-3.0-standalone.html', 'https://www.isc.org/downloads/software-support-policy/isc-license/', 'https://www.gnu.org/licenses/lgpl-3.0-standalone.html', 'https://opensource.org/licenses/MIT', 'https://www.mozilla.org/MPL/2.0/', 'https://opendatacommons.org/licenses/by/1-0/', 'http://opendatacommons.org/licenses/odbl/1.0/', 'https://opendatacommons.org/licenses/odbl/1-0/', 'https://creativecommons.org/publicdomain/mark/1.0/', 'https://opendatacommons.org/licenses/pddl/1-0/', 'https://creativecommons.org/licenses/by/3.0/legalcode', 'https://creativecommons.org/licenses/by-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nd/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode', 'http://cocina.sul.stanford.edu/licenses/none').meta(omittable: true)
25
+ attribute :license, Types::Strict::String.optional.enum('https://www.gnu.org/licenses/agpl.txt', 'https://www.apache.org/licenses/LICENSE-2.0', 'https://opensource.org/licenses/BSD-2-Clause', 'https://opensource.org/licenses/BSD-3-Clause', 'https://creativecommons.org/licenses/by/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode', 'https://creativecommons.org/licenses/by-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-sa/4.0/legalcode', 'https://creativecommons.org/publicdomain/zero/1.0/legalcode', 'https://opensource.org/licenses/cddl1', 'https://www.eclipse.org/legal/epl-2.0', 'https://www.gnu.org/licenses/gpl-3.0-standalone.html', 'https://www.isc.org/downloads/software-support-policy/isc-license/', 'https://www.gnu.org/licenses/lgpl-3.0-standalone.html', 'https://opensource.org/licenses/MIT', 'https://www.mozilla.org/MPL/2.0/', 'https://opendatacommons.org/licenses/by/1-0/', 'http://opendatacommons.org/licenses/odbl/1.0/', 'https://opendatacommons.org/licenses/odbl/1-0/', 'https://creativecommons.org/publicdomain/mark/1.0/', 'https://opendatacommons.org/licenses/pddl/1-0/', 'https://creativecommons.org/licenses/by/3.0/legalcode', 'https://creativecommons.org/licenses/by-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nd/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode', 'https://cocina.sul.stanford.edu/licenses/none').meta(omittable: true)
26
26
  end
27
27
  end
28
28
  end
@@ -5,13 +5,13 @@ module Cocina
5
5
  class Embargo < Struct
6
6
  # Access level.
7
7
  # Validation of this property is relaxed. See the openapi for full validation.
8
- attribute :access, Types::Strict::String.optional.default('dark').meta(omittable: true)
8
+ attribute :view, Types::Strict::String.optional.default('dark').meta(omittable: true)
9
9
  # Download access level.
10
10
  # Validation of this property is relaxed. See the openapi for full validation.
11
11
  attribute :download, Types::Strict::String.optional.default('none').meta(omittable: true)
12
- # If access is "location-based", which location should have access.
12
+ # Not used for this access type, must be null.
13
13
  # Validation of this property is relaxed. See the openapi for full validation.
14
- attribute :readLocation, Types::Strict::String.optional.meta(omittable: true)
14
+ attribute :location, Types::Strict::String.optional.meta(omittable: true)
15
15
  # Validation of this property is relaxed. See the openapi for full validation.
16
16
  attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
17
17
  # Date when the Collection is released from an embargo.
@@ -5,7 +5,7 @@ module Cocina
5
5
  class File < Struct
6
6
  include Checkable
7
7
 
8
- TYPES = ['http://cocina.sul.stanford.edu/models/file.jsonld'].freeze
8
+ TYPES = ['https://cocina.sul.stanford.edu/models/file'].freeze
9
9
 
10
10
  # The content type of the File.
11
11
  attribute :type, Types::Strict::String.enum(*File::TYPES)
@@ -5,13 +5,13 @@ module Cocina
5
5
  class FileAccess < Struct
6
6
  # Access level.
7
7
  # Validation of this property is relaxed. See the openapi for full validation.
8
- attribute :access, Types::Strict::String.optional.default('dark').meta(omittable: true)
8
+ attribute :view, Types::Strict::String.optional.default('dark').meta(omittable: true)
9
9
  # Download access level.
10
10
  # Validation of this property is relaxed. See the openapi for full validation.
11
11
  attribute :download, Types::Strict::String.optional.default('none').meta(omittable: true)
12
- # If access is "location-based", which location should have access.
12
+ # Not used for this access type, must be null.
13
13
  # Validation of this property is relaxed. See the openapi for full validation.
14
- attribute :readLocation, Types::Strict::String.optional.meta(omittable: true)
14
+ attribute :location, Types::Strict::String.optional.meta(omittable: true)
15
15
  # Validation of this property is relaxed. See the openapi for full validation.
16
16
  attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
17
17
  end
@@ -5,22 +5,22 @@ module Cocina
5
5
  class FileSet < Struct
6
6
  include Checkable
7
7
 
8
- TYPES = ['http://cocina.sul.stanford.edu/models/resources/audio.jsonld',
9
- 'http://cocina.sul.stanford.edu/models/resources/attachment.jsonld',
10
- 'http://cocina.sul.stanford.edu/models/resources/document.jsonld',
11
- 'http://cocina.sul.stanford.edu/models/resources/file.jsonld',
12
- 'http://cocina.sul.stanford.edu/models/resources/image.jsonld',
13
- 'http://cocina.sul.stanford.edu/models/resources/main-augmented.jsonld',
14
- 'http://cocina.sul.stanford.edu/models/resources/main-original.jsonld',
15
- 'http://cocina.sul.stanford.edu/models/resources/media.jsonld',
16
- 'http://cocina.sul.stanford.edu/models/resources/object.jsonld',
17
- 'http://cocina.sul.stanford.edu/models/resources/page.jsonld',
18
- 'http://cocina.sul.stanford.edu/models/resources/permissions.jsonld',
19
- 'http://cocina.sul.stanford.edu/models/resources/preview.jsonld',
20
- 'http://cocina.sul.stanford.edu/models/resources/supplement.jsonld',
21
- 'http://cocina.sul.stanford.edu/models/resources/3d.jsonld',
22
- 'http://cocina.sul.stanford.edu/models/resources/thumb.jsonld',
23
- 'http://cocina.sul.stanford.edu/models/resources/video.jsonld'].freeze
8
+ TYPES = ['https://cocina.sul.stanford.edu/models/resources/audio',
9
+ 'https://cocina.sul.stanford.edu/models/resources/attachment',
10
+ 'https://cocina.sul.stanford.edu/models/resources/document',
11
+ 'https://cocina.sul.stanford.edu/models/resources/file',
12
+ 'https://cocina.sul.stanford.edu/models/resources/image',
13
+ 'https://cocina.sul.stanford.edu/models/resources/main-augmented',
14
+ 'https://cocina.sul.stanford.edu/models/resources/main-original',
15
+ 'https://cocina.sul.stanford.edu/models/resources/media',
16
+ 'https://cocina.sul.stanford.edu/models/resources/object',
17
+ 'https://cocina.sul.stanford.edu/models/resources/page',
18
+ 'https://cocina.sul.stanford.edu/models/resources/permissions',
19
+ 'https://cocina.sul.stanford.edu/models/resources/preview',
20
+ 'https://cocina.sul.stanford.edu/models/resources/supplement',
21
+ 'https://cocina.sul.stanford.edu/models/resources/3d',
22
+ 'https://cocina.sul.stanford.edu/models/resources/thumb',
23
+ 'https://cocina.sul.stanford.edu/models/resources/video'].freeze
24
24
 
25
25
  # The content type of the Fileset.
26
26
  attribute :type, Types::Strict::String.enum(*FileSet::TYPES)
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ # This vocabulary defines the types of file sets
6
+ class FileSetType
7
+ def self.three_dimensional
8
+ 'https://cocina.sul.stanford.edu/models/resources/3d'
9
+ end
10
+
11
+ def self.attachment
12
+ 'https://cocina.sul.stanford.edu/models/resources/attachment'
13
+ end
14
+
15
+ def self.audio
16
+ 'https://cocina.sul.stanford.edu/models/resources/audio'
17
+ end
18
+
19
+ def self.document
20
+ 'https://cocina.sul.stanford.edu/models/resources/document'
21
+ end
22
+
23
+ def self.file
24
+ 'https://cocina.sul.stanford.edu/models/resources/file'
25
+ end
26
+
27
+ def self.image
28
+ 'https://cocina.sul.stanford.edu/models/resources/image'
29
+ end
30
+
31
+ def self.main_augmented
32
+ 'https://cocina.sul.stanford.edu/models/resources/main-augmented'
33
+ end
34
+
35
+ def self.main_original
36
+ 'https://cocina.sul.stanford.edu/models/resources/main-original'
37
+ end
38
+
39
+ def self.media
40
+ 'https://cocina.sul.stanford.edu/models/resources/media'
41
+ end
42
+
43
+ def self.object
44
+ 'https://cocina.sul.stanford.edu/models/resources/object'
45
+ end
46
+
47
+ def self.page
48
+ 'https://cocina.sul.stanford.edu/models/resources/page'
49
+ end
50
+
51
+ def self.permissions
52
+ 'https://cocina.sul.stanford.edu/models/resources/permissions'
53
+ end
54
+
55
+ def self.preview
56
+ 'https://cocina.sul.stanford.edu/models/resources/preview'
57
+ end
58
+
59
+ def self.supplement
60
+ 'https://cocina.sul.stanford.edu/models/resources/supplement'
61
+ end
62
+
63
+ def self.thumb
64
+ 'https://cocina.sul.stanford.edu/models/resources/thumb'
65
+ end
66
+
67
+ def self.video
68
+ 'https://cocina.sul.stanford.edu/models/resources/video'
69
+ end
70
+ end
71
+ end
72
+ end
@@ -4,11 +4,11 @@ module Cocina
4
4
  module Models
5
5
  class LocationBasedAccess < Struct
6
6
  # Access level.
7
- attribute :access, Types::Strict::String.enum('location-based')
7
+ attribute :view, Types::Strict::String.enum('location-based')
8
8
  # Download access level.
9
9
  attribute :download, Types::Strict::String.enum('location-based', 'none')
10
- # If access is "location-based", which location should have access.
11
- attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m')
10
+ # If access or download is "location-based", which location should have access.
11
+ attribute :location, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m')
12
12
  attribute :controlledDigitalLending, Types::Strict::Bool.enum(false).meta(omittable: true)
13
13
  end
14
14
  end
@@ -4,11 +4,11 @@ module Cocina
4
4
  module Models
5
5
  class LocationBasedDownloadAccess < Struct
6
6
  # Access level.
7
- attribute :access, Types::Strict::String.enum('stanford', 'world')
7
+ attribute :view, Types::Strict::String.enum('stanford', 'world')
8
8
  # Download access level.
9
9
  attribute :download, Types::Strict::String.enum('location-based')
10
- # If access is "location-based", which location should have access.
11
- attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m')
10
+ # Which location should have download access.
11
+ attribute :location, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m')
12
12
  attribute :controlledDigitalLending, Types::Strict::Bool.enum(false).meta(omittable: true)
13
13
  end
14
14
  end