cocina-models 0.3.0 → 0.4.0
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 +4 -4
- data/.rubocop.yml +21 -0
- data/.rubocop_todo.yml +0 -0
- data/.travis.yml +4 -0
- data/cocina-models.gemspec +2 -0
- data/lib/cocina/models/dro.rb +38 -9
- data/lib/cocina/models/version.rb +1 -1
- data/lib/cocina/models.rb +1 -0
- metadata +31 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc8ddb0dfd77463068313414c399d9329c69a1ea93904123a84834443a874c01
|
4
|
+
data.tar.gz: f372df6bd7648df6d5f331335538eb7d27ece1a2acd1ddc824954cf0df941451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfe212d14d1b84929028c272b7a94518ac31d3924d640e72d683da70565283043c884396f3612210622de473b1dc7b4dbde8cb8f2f23df229e2490658efc9b5e
|
7
|
+
data.tar.gz: bb584811cf3ea4ffaf4ef8babce832dae1f5f623214554e735b56965214c76e539ce4bebb65001f0b2c3ca0f3f2ddfab330a6def4c1e64c078d7fe181d8b66dc
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# This is the configuration used to check the rubocop source code.
|
2
|
+
|
3
|
+
inherit_from: .rubocop_todo.yml
|
4
|
+
require:
|
5
|
+
- rubocop-rspec
|
6
|
+
|
7
|
+
Metrics/BlockLength:
|
8
|
+
Exclude:
|
9
|
+
- spec/cocina/**/*
|
10
|
+
|
11
|
+
Metrics/LineLength:
|
12
|
+
Max: 100
|
13
|
+
|
14
|
+
Metrics/MethodLength:
|
15
|
+
Max: 13
|
16
|
+
|
17
|
+
RSpec/MultipleExpectations:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
RSpec/ExampleLength:
|
21
|
+
Max: 9
|
data/.rubocop_todo.yml
ADDED
File without changes
|
data/.travis.yml
CHANGED
data/cocina-models.gemspec
CHANGED
@@ -30,4 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
31
|
spec.add_development_dependency 'rake', '~> 12.0'
|
32
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
|
+
spec.add_development_dependency 'rubocop', '~> 0.74.0'
|
34
|
+
spec.add_development_dependency 'rubocop-rspec'
|
33
35
|
end
|
data/lib/cocina/models/dro.rb
CHANGED
@@ -6,22 +6,51 @@ module Cocina
|
|
6
6
|
module Models
|
7
7
|
# A digital repository object. See https://github.com/sul-dlss-labs/taco/blob/master/maps/DRO.json
|
8
8
|
class DRO < Dry::Struct
|
9
|
+
# Subschema for release tags
|
10
|
+
class ReleaseTag < Dry::Struct
|
11
|
+
attribute :to, Types::Strict::String
|
12
|
+
attribute :what, Types::Strict::String.enum('self', 'collection')
|
13
|
+
# we use 'when' other places, but that's reserved word, so 'date' it is!
|
14
|
+
attribute :date, Types::Params::DateTime
|
15
|
+
attribute :who, Types::Strict::String
|
16
|
+
attribute :release, Types::Params::Bool
|
17
|
+
end
|
18
|
+
|
19
|
+
# Subschema for access concerns
|
20
|
+
class Access < Dry::Struct
|
21
|
+
attribute :embargoReleaseDate, Types::Params::DateTime.meta(omittable: true)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Subschema for administrative concerns
|
25
|
+
class Administrative < Dry::Struct
|
26
|
+
attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).meta(omittable: true)
|
27
|
+
end
|
28
|
+
|
29
|
+
class Identification < Dry::Struct
|
30
|
+
end
|
31
|
+
|
32
|
+
class Structural < Dry::Struct
|
33
|
+
end
|
34
|
+
|
9
35
|
attribute :externalIdentifier, Types::Strict::String
|
10
36
|
attribute :type, Types::Strict::String
|
11
37
|
attribute :label, Types::Strict::String
|
12
|
-
attribute :
|
13
|
-
|
14
|
-
|
38
|
+
attribute :version, Types::Strict::Integer
|
39
|
+
attribute(:access, Access.default { Access.new })
|
40
|
+
attribute(:administrative, Administrative.default { Administrative.new })
|
41
|
+
attribute(:identification, Identification.default { Identification.new })
|
42
|
+
attribute(:structural, Structural.default { Structural.new })
|
15
43
|
|
16
|
-
def self.from_dynamic(
|
44
|
+
def self.from_dynamic(dyn)
|
17
45
|
params = {
|
18
|
-
externalIdentifier:
|
19
|
-
type:
|
20
|
-
label:
|
46
|
+
externalIdentifier: dyn['externalIdentifier'],
|
47
|
+
type: dyn['type'],
|
48
|
+
label: dyn['label'],
|
49
|
+
version: dyn['version']
|
21
50
|
}
|
22
|
-
if
|
51
|
+
if dyn['access']
|
23
52
|
access = {
|
24
|
-
embargoReleaseDate:
|
53
|
+
embargoReleaseDate: dyn['access']['embargoReleaseDate']
|
25
54
|
}
|
26
55
|
params[:access] = access
|
27
56
|
end
|
data/lib/cocina/models.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocina-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -94,6 +94,34 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.74.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.74.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
description: SDR data models that can be validated
|
98
126
|
email:
|
99
127
|
- jcoyne@justincoyne.com
|
@@ -103,6 +131,8 @@ extra_rdoc_files: []
|
|
103
131
|
files:
|
104
132
|
- ".gitignore"
|
105
133
|
- ".rspec"
|
134
|
+
- ".rubocop.yml"
|
135
|
+
- ".rubocop_todo.yml"
|
106
136
|
- ".travis.yml"
|
107
137
|
- Gemfile
|
108
138
|
- README.md
|