cocina-models 0.26.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +0 -8
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +7 -3
- data/docs/maps/DRO.json +4 -0
- data/docs/schema.json +6 -0
- data/docs/schema.md +3 -4
- data/lib/cocina/models/admin_policy.rb +3 -20
- data/lib/cocina/models/admin_policy_attributes.rb +21 -0
- data/lib/cocina/models/collection.rb +8 -24
- data/lib/cocina/models/collection_attributes.rb +22 -0
- data/lib/cocina/models/dro.rb +14 -29
- data/lib/cocina/models/dro_attributes.rb +22 -0
- data/lib/cocina/models/file.rb +13 -32
- data/lib/cocina/models/file_attributes.rb +25 -0
- data/lib/cocina/models/file_set.rb +4 -14
- data/lib/cocina/models/file_set_attributes.rb +16 -0
- data/lib/cocina/models/release_tag.rb +1 -5
- data/lib/cocina/models/request_admin_policy.rb +3 -20
- data/lib/cocina/models/request_collection.rb +2 -19
- data/lib/cocina/models/request_dro.rb +3 -20
- data/lib/cocina/models/request_file.rb +3 -23
- data/lib/cocina/models/request_file_set.rb +5 -7
- data/lib/cocina/models/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d9bac2712adeb43b42781a4ed699864956854a015932bfb831da7b3d843f4d
|
4
|
+
data.tar.gz: 1da967ea94f5cf122b64e729b1d196c0a5d0d97236c7f95b826c4b1ca76ddc0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 982b9aee25afc9e9161a6ca747c156a77fb2bb1b5cd9eb70a2b6c777b70936eb40cf9f6ffbef322edd07ede4b3153fa5661fb3272e400b9f8c0c275fa57a3306
|
7
|
+
data.tar.gz: acbc4799a654401d44b46cbd477d66b4f8fc4937a884c34df13368bbb2250c6c7f4beecbb1d3c20aa4cb5c46f8b2f3857de993a733bed8f00ec99b7a6d6f0e49
|
@@ -3,11 +3,3 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
## Was the documentation (README, wiki) updated?
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
## Does this change affect how this gem integrates with other services?
|
10
|
-
|
11
|
-
If so, please confirm:
|
12
|
-
- [ ] change was tested on stage and/or
|
13
|
-
- [ ] test added to sul-dlss/infrastructure-integration-test
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-
|
3
|
+
# on 2020-03-06 16:50:50 -0800 using RuboCop version 0.74.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 4
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 37
|
12
|
+
|
9
13
|
# Offense count: 3
|
10
14
|
# Configuration parameters: Max.
|
11
15
|
RSpec/ExampleLength:
|
12
16
|
Exclude:
|
13
|
-
- 'spec/cocina/models/
|
14
|
-
- 'spec/cocina/models/
|
17
|
+
- 'spec/cocina/models/dro_shared_examples.rb'
|
18
|
+
- 'spec/cocina/models/file_set_shared_examples.rb'
|
data/docs/maps/DRO.json
CHANGED
@@ -100,6 +100,10 @@
|
|
100
100
|
"description": "Access level for the DRO when released from embargo.",
|
101
101
|
"type": "string",
|
102
102
|
"enum": ["world", "stanford", "location-based", "citation-only", "dark"]
|
103
|
+
},
|
104
|
+
"useAndReproductionStatement": {
|
105
|
+
"description": "The human readable reuse and reproduction statement that applies to the DRO when released from embargo.",
|
106
|
+
"type": "string"
|
103
107
|
}
|
104
108
|
}
|
105
109
|
},
|
data/docs/schema.json
CHANGED
@@ -586,6 +586,12 @@
|
|
586
586
|
"citation-only",
|
587
587
|
"dark"
|
588
588
|
]
|
589
|
+
},
|
590
|
+
"useAndReproductionStatement": {
|
591
|
+
"description": "The human readable reuse and reproduction statement that applies to the DRO when released from embargo.",
|
592
|
+
"type": [
|
593
|
+
"string"
|
594
|
+
]
|
589
595
|
}
|
590
596
|
}
|
591
597
|
},
|
data/docs/schema.md
CHANGED
@@ -28,8 +28,8 @@ A group of Digital Repository Objects that indicate some type of conceptual grou
|
|
28
28
|
| **access:download** | *string* | Download level for the Collection metadata.<br/> **one of:**`"world"` or `"stanford"` or `"location-based"` or `"citation-only"` or `"dark"` | `"world"` |
|
29
29
|
| **access:embargoReleaseDate** | *date-time* | Date when the Collection is released from an embargo, if an embargo exists. | `"2015-01-01T12:00:00Z"` |
|
30
30
|
| **access:license** | *string* | The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.). | `"example"` |
|
31
|
-
| **access:useAndReproductionStatement** | *string* | The human readable reuse and reproduction statement that applies to the Collection. | `"example"` |
|
32
31
|
| **access:termsOfUse** | *string* | License or terms of use governing reuse of the Collection. Should be a text statement. | `"example"` |
|
32
|
+
| **access:useAndReproductionStatement** | *string* | The human readable reuse and reproduction statement that applies to the Collection. | `"example"` |
|
33
33
|
| **administrative:created** | *date-time* | When the resource in SDR was created. | `"2015-01-01T12:00:00Z"` |
|
34
34
|
| **administrative:deleted** | *boolean* | If the resource has been deleted (but not purged). | `true` |
|
35
35
|
| **administrative:gravestoneMessage** | *string* | Message describing why the object was deleted. | `"example"` |
|
@@ -83,9 +83,10 @@ Domain-defined abstraction of a 'work'. Digital Repository Objects' abstraction
|
|
83
83
|
| **access:download** | *string* | Download level for the DRO metadata.<br/> **one of:**`"world"` or `"stanford"` or `"location-based"` or `"citation-only"` or `"dark"` | `"world"` |
|
84
84
|
| **access:embargo:access** | *string* | Access level for the DRO when released from embargo.<br/> **one of:**`"world"` or `"stanford"` or `"location-based"` or `"citation-only"` or `"dark"` | `"world"` |
|
85
85
|
| **access:embargo:releaseDate** | *date-time* | Date when the DRO is released from an embargo. | `"2015-01-01T12:00:00Z"` |
|
86
|
+
| **access:embargo:useAndReproductionStatement** | *string* | The human readable reuse and reproduction statement that applies to the DRO when released from embargo. | `"example"` |
|
86
87
|
| **access:license** | *string* | The license governing reuse of the DRO. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.). | `"example"` |
|
87
|
-
| **access:useAndReproductionStatement** | *string* | The human readable reuse and reproduction statement that applies to the DRO. | `"example"` |
|
88
88
|
| **access:termsOfUse** | *string* | License or terms of use governing reuse of the DRO. Should be a text statement. | `"example"` |
|
89
|
+
| **access:useAndReproductionStatement** | *string* | The human readable reuse and reproduction statement that applies to the DRO. | `"example"` |
|
89
90
|
| **access:visibility** | *integer* | Percentage of the DRO that is visibility during an embargo period | `42` |
|
90
91
|
| **administrative:created** | *date-time* | When the resource in SDR was created. | `"2015-01-01T12:00:00Z"` |
|
91
92
|
| **administrative:deleted** | *boolean* | If the resource has been deleted (but not purged). | `true` |
|
@@ -265,5 +266,3 @@ A title of a work
|
|
265
266
|
| ------- | ------- | ------- | ------- |
|
266
267
|
| **primary** | *boolean* | Is this the primary title for the object | `true` |
|
267
268
|
| **titleFull** | *string* | The full title for the object | `"example"` |
|
268
|
-
|
269
|
-
|
@@ -50,9 +50,9 @@ module Cocina
|
|
50
50
|
# which workflow to start when registering (used by Web Archive apos to start wasCrawlPreassemblyWF)
|
51
51
|
attribute :registration_workflow, Types::String.optional.default(nil)
|
52
52
|
|
53
|
-
# Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
|
53
|
+
# TODO: Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
|
54
54
|
# but I think it's actually required for every Admin Policy
|
55
|
-
attribute :hasAdminPolicy, Types::
|
55
|
+
attribute :hasAdminPolicy, Types::Strict::String.optional.default(nil)
|
56
56
|
end
|
57
57
|
|
58
58
|
class Identification < Struct
|
@@ -61,25 +61,8 @@ module Cocina
|
|
61
61
|
class Structural < Struct
|
62
62
|
end
|
63
63
|
|
64
|
+
include AdminPolicyAttributes
|
64
65
|
attribute :externalIdentifier, Types::Strict::String
|
65
|
-
attribute :type, Types::String.enum(*TYPES)
|
66
|
-
attribute :label, Types::Strict::String
|
67
|
-
attribute :version, Types::Coercible::Integer
|
68
|
-
attribute(:access, Access.default { Access.new })
|
69
|
-
attribute(:administrative, Administrative.default { Administrative.new })
|
70
|
-
# Allowing description to be omittable for now (until rolled out to consumers),
|
71
|
-
# but I think it's actually required for every DRO
|
72
|
-
attribute :description, Description.optional.meta(omittable: true)
|
73
|
-
attribute(:identification, Identification.default { Identification.new })
|
74
|
-
attribute(:structural, Structural.default { Structural.new })
|
75
|
-
|
76
|
-
def self.from_dynamic(dyn)
|
77
|
-
AdminPolicy.new(dyn)
|
78
|
-
end
|
79
|
-
|
80
|
-
def self.from_json(json)
|
81
|
-
from_dynamic(JSON.parse(json))
|
82
|
-
end
|
83
66
|
end
|
84
67
|
end
|
85
68
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
# attributes common to both AdminPolicy and RequestAdminPolicy
|
6
|
+
module AdminPolicyAttributes
|
7
|
+
def self.included(obj)
|
8
|
+
obj.attribute(:access, AdminPolicy::Access.default { AdminPolicy::Access.new })
|
9
|
+
obj.attribute(:administrative, AdminPolicy::Administrative.default { AdminPolicy::Administrative.new })
|
10
|
+
# TODO: Allowing description to be omittable for now (until rolled out to consumers),
|
11
|
+
# but I think it's actually required for every admin policy
|
12
|
+
obj.attribute :description, Description.optional.meta(omittable: true)
|
13
|
+
obj.attribute(:identification, AdminPolicy::Identification.default { AdminPolicy::Identification.new })
|
14
|
+
obj.attribute :label, Types::Strict::String
|
15
|
+
obj.attribute(:structural, AdminPolicy::Structural.default { AdminPolicy::Structural.new })
|
16
|
+
obj.attribute :type, Types::String.enum(*AdminPolicy::TYPES)
|
17
|
+
obj.attribute :version, Types::Strict::Integer
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -2,16 +2,17 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# A digital repository collection.
|
5
|
+
# A digital repository collection.
|
6
|
+
# See http://sul-dlss.github.io/cocina-models/maps/Collection.json
|
6
7
|
class Collection < Struct
|
7
8
|
include Checkable
|
8
9
|
|
9
10
|
TYPES = [
|
10
11
|
Vocab.collection,
|
11
12
|
Vocab.curated_collection,
|
12
|
-
Vocab.user_collection,
|
13
13
|
Vocab.exhibit,
|
14
|
-
Vocab.series
|
14
|
+
Vocab.series,
|
15
|
+
Vocab.user_collection
|
15
16
|
].freeze
|
16
17
|
|
17
18
|
# Subschema for access concerns
|
@@ -23,9 +24,9 @@ module Cocina
|
|
23
24
|
# Subschema for administrative concerns
|
24
25
|
class Administrative < Struct
|
25
26
|
attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).default([].freeze)
|
26
|
-
# Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
|
27
|
-
# but I think it's actually required for every
|
28
|
-
attribute :hasAdminPolicy, Types::
|
27
|
+
# TODO: Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
|
28
|
+
# but I think it's actually required for every Collection
|
29
|
+
attribute :hasAdminPolicy, Types::Strict::String.optional.default(nil)
|
29
30
|
end
|
30
31
|
|
31
32
|
# Identification sub-schema for the Collection
|
@@ -36,25 +37,8 @@ module Cocina
|
|
36
37
|
class Structural < Struct
|
37
38
|
end
|
38
39
|
|
40
|
+
include CollectionAttributes
|
39
41
|
attribute :externalIdentifier, Types::Strict::String
|
40
|
-
attribute :type, Types::String.enum(*TYPES)
|
41
|
-
attribute :label, Types::Strict::String
|
42
|
-
attribute :version, Types::Coercible::Integer
|
43
|
-
attribute(:access, Access.default { Access.new })
|
44
|
-
attribute(:administrative, Administrative.default { Administrative.new })
|
45
|
-
# Allowing description to be omittable for now (until rolled out to consumers),
|
46
|
-
# but I think it's actually required for every DRO
|
47
|
-
attribute :description, Description.optional.meta(omittable: true)
|
48
|
-
attribute(:identification, Identification.default { Identification.new })
|
49
|
-
attribute(:structural, Structural.default { Structural.new })
|
50
|
-
|
51
|
-
def self.from_dynamic(dyn)
|
52
|
-
Collection.new(dyn)
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.from_json(json)
|
56
|
-
from_dynamic(JSON.parse(json))
|
57
|
-
end
|
58
42
|
end
|
59
43
|
end
|
60
44
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
# attributes common to both Collection and RequestCollection
|
6
|
+
# See http://sul-dlss.github.io/cocina-models/maps/Collection.json
|
7
|
+
module CollectionAttributes
|
8
|
+
def self.included(obj)
|
9
|
+
obj.attribute(:access, Collection::Access.default { Collection::Access.new })
|
10
|
+
obj.attribute(:administrative, Collection::Administrative.default { Collection::Administrative.new })
|
11
|
+
# TODO: Allowing description to be omittable for now (until rolled out to consumers),
|
12
|
+
# but I think it's actually required for every Collection
|
13
|
+
obj.attribute :description, Description.optional.meta(omittable: true)
|
14
|
+
obj.attribute(:identification, Collection::Identification.default { Collection::Identification.new })
|
15
|
+
obj.attribute :label, Types::Strict::String
|
16
|
+
obj.attribute(:structural, Collection::Structural.default { Collection::Structural.new })
|
17
|
+
obj.attribute :type, Types::String.enum(*Collection::TYPES)
|
18
|
+
obj.attribute :version, Types::Strict::Integer
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/cocina/models/dro.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# A digital repository object.
|
5
|
+
# A digital repository object.
|
6
|
+
# See http://sul-dlss.github.io/cocina-models/maps/DRO.json
|
6
7
|
class DRO < Struct
|
7
8
|
include Checkable
|
8
9
|
|
@@ -31,21 +32,22 @@ module Cocina
|
|
31
32
|
attribute :releaseDate, Types::Params::DateTime
|
32
33
|
attribute :access, Types::String.default('dark')
|
33
34
|
.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
|
35
|
+
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
34
36
|
end
|
35
37
|
|
36
|
-
attribute :embargo, Embargo.optional.meta(omittable: true)
|
37
38
|
attribute :access, Types::String.default('dark')
|
38
39
|
.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
|
39
40
|
attribute :copyright, Types::Strict::String.meta(omittable: true)
|
41
|
+
attribute :embargo, Embargo.optional.meta(omittable: true)
|
40
42
|
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
41
43
|
end
|
42
44
|
|
43
45
|
# Subschema for administrative concerns
|
44
46
|
class Administrative < Struct
|
45
|
-
|
46
|
-
# Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
|
47
|
+
# TODO: Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
|
47
48
|
# but I think it's actually required for every DRO
|
48
|
-
attribute :hasAdminPolicy, Types::
|
49
|
+
attribute :hasAdminPolicy, Types::Strict::String.optional.default(nil)
|
50
|
+
attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).meta(omittable: true).default([].freeze)
|
49
51
|
end
|
50
52
|
|
51
53
|
# Identification sub-schema for the DRO
|
@@ -54,7 +56,12 @@ module Cocina
|
|
54
56
|
attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
|
55
57
|
end
|
56
58
|
|
57
|
-
#
|
59
|
+
# Geographic sub-schema for the DRO
|
60
|
+
class Geographic < Struct
|
61
|
+
attribute :iso19139, Types::Strict::String
|
62
|
+
end
|
63
|
+
|
64
|
+
# Structural sub-schema for the DRO (uses FileSet, unlike RequestDRO which uses RequestFileSet)
|
58
65
|
class Structural < Struct
|
59
66
|
attribute :contains, Types::Strict::Array.of(FileSet).meta(omittable: true)
|
60
67
|
attribute :hasAgreement, Types::Strict::String.meta(omittable: true)
|
@@ -62,32 +69,10 @@ module Cocina
|
|
62
69
|
attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
|
63
70
|
end
|
64
71
|
|
65
|
-
|
66
|
-
class Geographic < Struct
|
67
|
-
attribute :iso19139, Types::Strict::String
|
68
|
-
end
|
69
|
-
|
72
|
+
include DroAttributes
|
70
73
|
attribute :externalIdentifier, Types::Strict::String
|
71
|
-
attribute :type, Types::String.enum(*TYPES)
|
72
|
-
attribute :label, Types::Strict::String
|
73
|
-
attribute :version, Types::Coercible::Integer
|
74
|
-
attribute(:access, Access.default { Access.new })
|
75
|
-
attribute(:administrative, Administrative.default { Administrative.new })
|
76
|
-
# Allowing description to be omittable for now (until rolled out to consumers),
|
77
|
-
# but I think it's actually required for every DRO
|
78
|
-
attribute :description, Description.optional.meta(omittable: true)
|
79
|
-
attribute :geographic, Geographic.optional.meta(omittable: true)
|
80
|
-
attribute(:identification, Identification.default { Identification.new })
|
81
74
|
attribute(:structural, Structural.default { Structural.new })
|
82
75
|
|
83
|
-
def self.from_dynamic(dyn)
|
84
|
-
DRO.new(dyn)
|
85
|
-
end
|
86
|
-
|
87
|
-
def self.from_json(json)
|
88
|
-
from_dynamic(JSON.parse(json))
|
89
|
-
end
|
90
|
-
|
91
76
|
def image?
|
92
77
|
type == Vocab.image
|
93
78
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
# attributes common to both DRO and RequestDRO
|
6
|
+
# See http://sul-dlss.github.io/cocina-models/maps/DRO.json
|
7
|
+
module DroAttributes
|
8
|
+
def self.included(obj)
|
9
|
+
obj.attribute(:access, DRO::Access.default { DRO::Access.new })
|
10
|
+
obj.attribute(:administrative, DRO::Administrative.default { DRO::Administrative.new })
|
11
|
+
# TODO: Allowing description to be omittable for now (until rolled out to consumers),
|
12
|
+
# but I think it's actually required for every DRO
|
13
|
+
obj.attribute :description, Description.optional.meta(omittable: true)
|
14
|
+
obj.attribute :geographic, DRO::Geographic.optional.meta(omittable: true)
|
15
|
+
obj.attribute(:identification, DRO::Identification.default { DRO::Identification.new })
|
16
|
+
obj.attribute :label, Types::Strict::String
|
17
|
+
obj.attribute :type, Types::String.enum(*DRO::TYPES)
|
18
|
+
obj.attribute :version, Types::Strict::Integer
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/cocina/models/file.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# Metadata for a file.
|
5
|
+
# Metadata for a file.
|
6
|
+
# See http://sul-dlss.github.io/cocina-models/maps/File.json
|
6
7
|
class File < Struct
|
7
8
|
include Checkable
|
8
9
|
|
@@ -18,50 +19,30 @@ module Cocina
|
|
18
19
|
|
19
20
|
# Represents the administration of the file
|
20
21
|
class Administrative < Struct
|
21
|
-
attribute :sdrPreserve, Types::
|
22
|
-
attribute :shelve, Types::
|
22
|
+
attribute :sdrPreserve, Types::Strict::Bool.optional.default(false)
|
23
|
+
attribute :shelve, Types::Strict::Bool.optional.default(false)
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
class Structural < Struct
|
29
|
-
end
|
30
|
-
|
31
|
-
# Represents a digest value for a file
|
26
|
+
# Represents a digest (checksum) value for a file
|
32
27
|
class Fixity < Struct
|
33
28
|
attribute :type, Types::String.enum('md5', 'sha1')
|
34
29
|
attribute :digest, Types::Strict::String
|
35
30
|
end
|
36
31
|
|
32
|
+
class Identification < Struct
|
33
|
+
end
|
34
|
+
|
37
35
|
# Represents some technical aspect of the file
|
38
36
|
class Presentation < Struct
|
39
|
-
attribute :height, Types::
|
40
|
-
attribute :width, Types::
|
37
|
+
attribute :height, Types::Strict::Integer.optional.default(nil)
|
38
|
+
attribute :width, Types::Strict::Integer.optional.default(nil)
|
41
39
|
end
|
42
40
|
|
43
|
-
|
44
|
-
attribute(:administrative, Administrative.default { Administrative.new })
|
45
|
-
attribute :externalIdentifier, Types::Strict::String
|
46
|
-
attribute :type, Types::String.enum(*TYPES)
|
47
|
-
attribute :label, Types::Strict::String
|
48
|
-
attribute :filename, Types::String.optional.default(nil)
|
49
|
-
attribute :use, Types::String.enum('transcription').optional.meta(omittable: true)
|
50
|
-
attribute :size, Types::Coercible::Integer.optional.default(nil)
|
51
|
-
attribute :hasMessageDigests, Types::Strict::Array.of(Fixity).default([].freeze)
|
52
|
-
attribute :hasMimeType, Types::String.optional.meta(omittable: true)
|
53
|
-
attribute :presentation, Presentation.optional.meta(omittable: true)
|
54
|
-
attribute :version, Types::Coercible::Integer
|
55
|
-
attribute :identification, Identification.optional.meta(omittable: true)
|
56
|
-
attribute :structural, Structural.optional.meta(omittable: true)
|
57
|
-
|
58
|
-
def self.from_dynamic(dyn)
|
59
|
-
File.new(dyn)
|
41
|
+
class Structural < Struct
|
60
42
|
end
|
61
43
|
|
62
|
-
|
63
|
-
|
64
|
-
end
|
44
|
+
include FileAttributes
|
45
|
+
attribute :externalIdentifier, Types::Strict::String
|
65
46
|
end
|
66
47
|
end
|
67
48
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
# attributes common to both File and RequestFile
|
6
|
+
# See http://sul-dlss.github.io/cocina-models/maps/File.json
|
7
|
+
module FileAttributes
|
8
|
+
def self.included(obj)
|
9
|
+
obj.attribute(:access, File::Access.optional.default { File::Access.new })
|
10
|
+
obj.attribute(:administrative, File::Administrative.default { File::Administrative.new })
|
11
|
+
obj.attribute :label, Types::Strict::String
|
12
|
+
obj.attribute :filename, Types::String.optional.default(nil)
|
13
|
+
obj.attribute :identification, File::Identification.optional.meta(omittable: true)
|
14
|
+
obj.attribute :hasMessageDigests, Types::Strict::Array.of(File::Fixity).default([].freeze)
|
15
|
+
obj.attribute :hasMimeType, Types::String.optional.meta(omittable: true)
|
16
|
+
obj.attribute :presentation, File::Presentation.optional.meta(omittable: true)
|
17
|
+
obj.attribute :size, Types::Strict::Integer.optional.default(nil)
|
18
|
+
obj.attribute :structural, File::Structural.optional.meta(omittable: true)
|
19
|
+
obj.attribute :type, Types::String.enum(*File::TYPES)
|
20
|
+
obj.attribute :use, Types::String.enum('transcription').optional.meta(omittable: true)
|
21
|
+
obj.attribute :version, Types::Strict::Integer
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# Metadata for a
|
5
|
+
# Metadata for a file set.
|
6
|
+
# See http://sul-dlss.github.io/cocina-models/maps/Fileset.json
|
6
7
|
class FileSet < Struct
|
7
8
|
include Checkable
|
8
9
|
|
@@ -13,25 +14,14 @@ module Cocina
|
|
13
14
|
class Identification < Struct
|
14
15
|
end
|
15
16
|
|
16
|
-
# Structural sub-schema
|
17
|
+
# Structural sub-schema that contains File (unlike the one in RequestFileSet which contains RequestFile)
|
17
18
|
class Structural < Struct
|
18
19
|
attribute :contains, Types::Strict::Array.of(Cocina::Models::File).meta(omittable: true)
|
19
20
|
end
|
20
21
|
|
22
|
+
include FileSetAttributes
|
21
23
|
attribute :externalIdentifier, Types::Strict::String
|
22
|
-
attribute :type, Types::String.enum(*TYPES)
|
23
|
-
attribute :label, Types::Strict::String
|
24
|
-
attribute :version, Types::Coercible::Integer
|
25
|
-
attribute(:identification, Identification.default { Identification.new })
|
26
24
|
attribute(:structural, Structural.default { Structural.new })
|
27
|
-
|
28
|
-
def self.from_dynamic(dyn)
|
29
|
-
FileSet.new(dyn)
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.from_json(json)
|
33
|
-
from_dynamic(JSON.parse(json))
|
34
|
-
end
|
35
25
|
end
|
36
26
|
end
|
37
27
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
# attributes common to both FileSet and RequestFileSet
|
6
|
+
# See http://sul-dlss.github.io/cocina-models/maps/Fileset.json
|
7
|
+
module FileSetAttributes
|
8
|
+
def self.included(obj)
|
9
|
+
obj.attribute(:identification, FileSet::Identification.default { FileSet::Identification.new })
|
10
|
+
obj.attribute :label, Types::Strict::String
|
11
|
+
obj.attribute :type, Types::String.enum(*FileSet::TYPES)
|
12
|
+
obj.attribute :version, Types::Strict::Integer
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -9,11 +9,7 @@ module Cocina
|
|
9
9
|
# we use 'when' other places, but that's reserved word, so 'date' it is!
|
10
10
|
attribute :date, Types::Params::DateTime
|
11
11
|
attribute :who, Types::Strict::String
|
12
|
-
attribute :release, Types::
|
13
|
-
|
14
|
-
def self.from_dynamic(dyn)
|
15
|
-
ReleaseTag.new(dyn)
|
16
|
-
end
|
12
|
+
attribute :release, Types::Strict::Bool
|
17
13
|
end
|
18
14
|
end
|
19
15
|
end
|
@@ -2,27 +2,10 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
#
|
6
|
-
# This is the same as AdminPolicy,
|
5
|
+
# A request to create an AdminPolicy object.
|
6
|
+
# This is the same as an AdminPolicy, but without externalIdentifier (as that wouldn't have been created yet).
|
7
7
|
class RequestAdminPolicy < Struct
|
8
|
-
|
9
|
-
attribute :label, Types::Strict::String
|
10
|
-
attribute :version, Types::Coercible::Integer
|
11
|
-
attribute(:access, AdminPolicy::Access.default { AdminPolicy::Access.new })
|
12
|
-
attribute(:administrative, AdminPolicy::Administrative.default { AdminPolicy::Administrative.new })
|
13
|
-
# Allowing description to be omittable for now (until rolled out to consumers),
|
14
|
-
# but I think it's actually required for every DRO
|
15
|
-
attribute :description, Description.optional.meta(omittable: true)
|
16
|
-
attribute(:identification, AdminPolicy::Identification.default { AdminPolicy::Identification.new })
|
17
|
-
attribute(:structural, AdminPolicy::Structural.default { AdminPolicy::Structural.new })
|
18
|
-
|
19
|
-
def self.from_dynamic(dyn)
|
20
|
-
RequestAdminPolicy.new(dyn)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.from_json(json)
|
24
|
-
from_dynamic(JSON.parse(json))
|
25
|
-
end
|
8
|
+
include AdminPolicyAttributes
|
26
9
|
end
|
27
10
|
end
|
28
11
|
end
|
@@ -3,27 +3,10 @@
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
5
|
# A request to create a digital repository collection.
|
6
|
-
# This is the same as Collection,
|
6
|
+
# This is the same as a Collection, but without externalIdentifier (as that wouldn't have been created yet).
|
7
7
|
# See http://sul-dlss.github.io/cocina-models/maps/Collection.json
|
8
8
|
class RequestCollection < Struct
|
9
|
-
|
10
|
-
attribute :label, Types::Strict::String
|
11
|
-
attribute :version, Types::Coercible::Integer
|
12
|
-
attribute(:access, Collection::Access.default { Collection::Access.new })
|
13
|
-
attribute(:administrative, Collection::Administrative.default { Collection::Administrative.new })
|
14
|
-
# Allowing description to be omittable for now (until rolled out to consumers),
|
15
|
-
# but I think it's actually required for every DRO
|
16
|
-
attribute :description, Description.optional.meta(omittable: true)
|
17
|
-
attribute(:identification, Collection::Identification.default { Collection::Identification.new })
|
18
|
-
attribute(:structural, Collection::Structural.default { Collection::Structural.new })
|
19
|
-
|
20
|
-
def self.from_dynamic(dyn)
|
21
|
-
RequestCollection.new(dyn)
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.from_json(json)
|
25
|
-
from_dynamic(JSON.parse(json))
|
26
|
-
end
|
9
|
+
include CollectionAttributes
|
27
10
|
end
|
28
11
|
end
|
29
12
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# A
|
6
|
-
# This is same as a DRO, but without externalIdentifier (as that wouldn't have been created yet)
|
5
|
+
# A request to create a digital repository object.
|
6
|
+
# This is the same as a DRO, but without externalIdentifier (as that wouldn't have been created yet)
|
7
7
|
# See http://sul-dlss.github.io/cocina-models/maps/DRO.json
|
8
8
|
class RequestDRO < Struct
|
9
9
|
# Structural sub-schema that contains RequestFileSet (unlike the DRO which contains FileSet)
|
@@ -13,25 +13,8 @@ module Cocina
|
|
13
13
|
attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
attribute :label, Types::Strict::String
|
18
|
-
attribute :version, Types::Coercible::Integer
|
19
|
-
attribute(:access, DRO::Access.default { DRO::Access.new })
|
20
|
-
attribute(:administrative, DRO::Administrative.default { DRO::Administrative.new })
|
21
|
-
# Allowing description to be omittable for now (until rolled out to consumers),
|
22
|
-
# but I think it's actually required for every DRO
|
23
|
-
attribute :description, Description.optional.meta(omittable: true)
|
24
|
-
attribute :geographic, DRO::Geographic.optional.meta(omittable: true)
|
25
|
-
attribute(:identification, DRO::Identification.default { DRO::Identification.new })
|
16
|
+
include DroAttributes
|
26
17
|
attribute(:structural, Structural.default { Structural.new })
|
27
|
-
|
28
|
-
def self.from_dynamic(dyn)
|
29
|
-
RequestDRO.new(dyn)
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.from_json(json)
|
33
|
-
from_dynamic(JSON.parse(json))
|
34
|
-
end
|
35
18
|
end
|
36
19
|
end
|
37
20
|
end
|
@@ -2,31 +2,11 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
#
|
6
|
-
# This is same as a File, but without externalIdentifier (as that wouldn't have been created yet)
|
5
|
+
# a request to create a File object.
|
6
|
+
# This is the same as a File, but without externalIdentifier (as that wouldn't have been created yet)
|
7
7
|
# See http://sul-dlss.github.io/cocina-models/maps/File.json
|
8
8
|
class RequestFile < Struct
|
9
|
-
|
10
|
-
attribute(:administrative, File::Administrative.default { File::Administrative.new })
|
11
|
-
attribute :type, Types::String.enum(*File::TYPES)
|
12
|
-
attribute :label, Types::Strict::String
|
13
|
-
attribute :filename, Types::String.optional.default(nil)
|
14
|
-
attribute :use, Types::String.enum('transcription').optional.meta(omittable: true)
|
15
|
-
attribute :size, Types::Coercible::Integer.optional.default(nil)
|
16
|
-
attribute :hasMessageDigests, Types::Strict::Array.of(File::Fixity).default([].freeze)
|
17
|
-
attribute :hasMimeType, Types::String.optional.meta(omittable: true)
|
18
|
-
attribute :presentation, File::Presentation.optional.meta(omittable: true)
|
19
|
-
attribute :version, Types::Coercible::Integer
|
20
|
-
attribute :identification, File::Identification.optional.meta(omittable: true)
|
21
|
-
attribute :structural, File::Structural.optional.meta(omittable: true)
|
22
|
-
|
23
|
-
def self.from_dynamic(dyn)
|
24
|
-
new(dyn)
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.from_json(json)
|
28
|
-
from_dynamic(JSON.parse(json))
|
29
|
-
end
|
9
|
+
include FileAttributes
|
30
10
|
end
|
31
11
|
end
|
32
12
|
end
|
@@ -2,18 +2,16 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# A
|
6
|
-
# This is same as a FileSet, but without externalIdentifier (as that wouldn't have been created yet)
|
5
|
+
# A request to create a FileSet object.
|
6
|
+
# This is the same as a FileSet, but without externalIdentifier (as that wouldn't have been created yet)
|
7
7
|
# See http://sul-dlss.github.io/cocina-models/maps/FileSet.json
|
8
8
|
class RequestFileSet < Struct
|
9
|
-
# Structural sub-schema that contains RequestFile (unlike the FileSet which contains File)
|
9
|
+
# Structural sub-schema that contains RequestFile (unlike the one in FileSet which contains File)
|
10
10
|
class Structural < Struct
|
11
11
|
attribute :contains, Types::Strict::Array.of(RequestFile).meta(omittable: true)
|
12
12
|
end
|
13
|
-
|
14
|
-
|
15
|
-
attribute :version, Types::Coercible::Integer
|
16
|
-
attribute(:identification, FileSet::Identification.default { FileSet::Identification.new })
|
13
|
+
|
14
|
+
include FileSetAttributes
|
17
15
|
attribute(:structural, Structural.default { Structural.new })
|
18
16
|
end
|
19
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocina-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|
@@ -177,13 +177,18 @@ files:
|
|
177
177
|
- docs/schema.md
|
178
178
|
- lib/cocina/models.rb
|
179
179
|
- lib/cocina/models/admin_policy.rb
|
180
|
+
- lib/cocina/models/admin_policy_attributes.rb
|
180
181
|
- lib/cocina/models/catalog_link.rb
|
181
182
|
- lib/cocina/models/checkable.rb
|
182
183
|
- lib/cocina/models/collection.rb
|
184
|
+
- lib/cocina/models/collection_attributes.rb
|
183
185
|
- lib/cocina/models/description.rb
|
184
186
|
- lib/cocina/models/dro.rb
|
187
|
+
- lib/cocina/models/dro_attributes.rb
|
185
188
|
- lib/cocina/models/file.rb
|
189
|
+
- lib/cocina/models/file_attributes.rb
|
186
190
|
- lib/cocina/models/file_set.rb
|
191
|
+
- lib/cocina/models/file_set_attributes.rb
|
187
192
|
- lib/cocina/models/release_tag.rb
|
188
193
|
- lib/cocina/models/request_admin_policy.rb
|
189
194
|
- lib/cocina/models/request_collection.rb
|