hydra-pcdm 0.1.0 → 0.2.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +38 -0
  3. data/Gemfile +6 -3
  4. data/README.md +31 -38
  5. data/Rakefile +14 -4
  6. data/hydra-pcdm.gemspec +10 -10
  7. data/lib/hydra/pcdm.rb +13 -12
  8. data/lib/hydra/pcdm/collection_indexer.rb +2 -4
  9. data/lib/hydra/pcdm/deep_member_iterator.rb +1 -1
  10. data/lib/hydra/pcdm/models/collection.rb +0 -1
  11. data/lib/hydra/pcdm/models/concerns/collection_behavior.rb +18 -5
  12. data/lib/hydra/pcdm/models/concerns/object_behavior.rb +13 -17
  13. data/lib/hydra/pcdm/models/concerns/pcdm_behavior.rb +50 -9
  14. data/lib/hydra/pcdm/models/file.rb +7 -7
  15. data/lib/hydra/pcdm/models/object.rb +0 -1
  16. data/lib/hydra/pcdm/object_indexer.rb +1 -2
  17. data/lib/hydra/pcdm/services/file/add_type.rb +1 -3
  18. data/lib/hydra/pcdm/services/file/get_mime_type.rb +2 -4
  19. data/lib/hydra/pcdm/validators/ancestor_validator.rb +3 -11
  20. data/lib/hydra/pcdm/validators/pcdm_object_validator.rb +2 -2
  21. data/lib/hydra/pcdm/validators/pcdm_validator.rb +2 -2
  22. data/lib/hydra/pcdm/version.rb +1 -1
  23. data/lib/hydra/pcdm/vocab/pcdm_terms.rb +81 -80
  24. data/lib/hydra/pcdm/vocab/sweet_jpl_terms.rb +12 -0
  25. data/spec/hydra/pcdm/ancestor_checker_spec.rb +7 -7
  26. data/spec/hydra/pcdm/collection_indexer_spec.rb +12 -13
  27. data/spec/hydra/pcdm/deep_member_iterator_spec.rb +16 -16
  28. data/spec/hydra/pcdm/models/collection_spec.rb +375 -313
  29. data/spec/hydra/pcdm/models/file_spec.rb +38 -38
  30. data/spec/hydra/pcdm/models/object_spec.rb +270 -256
  31. data/spec/hydra/pcdm/object_indexer_spec.rb +4 -4
  32. data/spec/hydra/pcdm/services/file/get_mime_type_spec.rb +10 -12
  33. data/spec/hydra/pcdm_spec.rb +21 -26
  34. metadata +19 -5
  35. data/lib/hydra/pcdm/vocab/ebucore_terms.rb +0 -33
  36. data/lib/hydra/pcdm/vocab/sweetjpl_terms.rb +0 -10
@@ -7,14 +7,14 @@ describe Hydra::PCDM::ObjectIndexer do
7
7
  let(:indexer) { described_class.new(object) }
8
8
 
9
9
  before do
10
- allow(object).to receive(:child_object_ids).and_return([child_object1.id, child_object2.id])
10
+ allow(object).to receive(:object_ids).and_return([child_object1.id, child_object2.id])
11
11
  end
12
12
 
13
- describe "#generate_solr_document" do
13
+ describe '#generate_solr_document' do
14
14
  subject { indexer.generate_solr_document }
15
15
 
16
- it "has fields" do
17
- expect(subject['child_object_ids_ssim']).to eq ['123', '456']
16
+ it 'has fields' do
17
+ expect(subject['object_ids_ssim']).to eq %w(123 456)
18
18
  end
19
19
  end
20
20
  end
@@ -1,24 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Hydra::PCDM::GetMimeTypeForFile do
4
-
5
- context "with faulty input" do
6
- let(:error_message) { "supplied argument should be a path to a file" }
7
- it "raises and error" do
8
- expect( lambda{described_class.call(["bad input"])}).to raise_error(ArgumentError, error_message)
4
+ context 'with faulty input' do
5
+ let(:error_message) { 'supplied argument should be a path to a file' }
6
+ it 'raises and error' do
7
+ expect(-> { described_class.call(['bad input']) }).to raise_error(ArgumentError, error_message)
9
8
  end
10
9
  end
11
10
 
12
- context "with a standard file type" do
13
- let(:path) { "/path/file.jpg" }
11
+ context 'with a standard file type' do
12
+ let(:path) { '/path/file.jpg' }
14
13
  subject { described_class.call(path) }
15
- it { is_expected.to eql "image/jpeg" }
14
+ it { is_expected.to eql 'image/jpeg' }
16
15
  end
17
16
 
18
- context "with an unknown file type" do
19
- let(:path) { "/path/file.jkl" }
17
+ context 'with an unknown file type' do
18
+ let(:path) { '/path/file.jkl' }
20
19
  subject { described_class.call(path) }
21
- it { is_expected.to eql "application/octet-stream" }
20
+ it { is_expected.to eql 'application/octet-stream' }
22
21
  end
23
-
24
22
  end
@@ -1,56 +1,51 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Hydra::PCDM do
4
-
5
4
  let(:coll1) { Hydra::PCDM::Collection.create }
6
5
  let(:obj1) { Hydra::PCDM::Object.create }
7
6
  let(:file1) { Hydra::PCDM::File.new }
8
7
 
9
8
  describe 'Validations' do
10
-
11
- describe "#collection?" do
12
- it "should return true for a pcdm collection" do
13
- expect( Hydra::PCDM.collection? coll1 ).to be true
9
+ describe '#collection?' do
10
+ it 'return true for a pcdm collection' do
11
+ expect(described_class.collection? coll1).to be true
14
12
  end
15
13
 
16
- it "should return false for a pcdm object" do
17
- expect( Hydra::PCDM.collection? obj1 ).to be false
14
+ it 'return false for a pcdm object' do
15
+ expect(described_class.collection? obj1).to be false
18
16
  end
19
17
 
20
- it "should return false for a pcdm file" do
21
- expect( Hydra::PCDM.collection? file1 ).to be false
18
+ it 'return false for a pcdm file' do
19
+ expect(described_class.collection? file1).to be false
22
20
  end
23
21
  end
24
22
 
25
- describe "#object?" do
26
- it "should return false for a pcdm collection" do
27
- expect( Hydra::PCDM.object? coll1 ).to be false
23
+ describe '#object?' do
24
+ it 'return false for a pcdm collection' do
25
+ expect(described_class.object? coll1).to be false
28
26
  end
29
27
 
30
- it "should return true for a pcdm object" do
31
- expect( Hydra::PCDM.object? obj1 ).to be true
28
+ it 'return true for a pcdm object' do
29
+ expect(described_class.object? obj1).to be true
32
30
  end
33
31
 
34
- it "should return false for a pcdm file" do
35
- expect( Hydra::PCDM.object? file1 ).to be false
32
+ it 'return false for a pcdm file' do
33
+ expect(described_class.object? file1).to be false
36
34
  end
37
35
  end
38
36
 
39
- describe "#file?" do
40
- it "should return false for a pcdm collection" do
41
- expect( Hydra::PCDM.file? coll1 ).to be false
37
+ describe '#file?' do
38
+ it 'return false for a pcdm collection' do
39
+ expect(described_class.file? coll1).to be false
42
40
  end
43
41
 
44
- it "should return false for a pcdm object" do
45
- expect( Hydra::PCDM.file? obj1 ).to be false
42
+ it 'return false for a pcdm object' do
43
+ expect(described_class.file? obj1).to be false
46
44
  end
47
45
 
48
- it "should return true for a pcdm file" do
49
- expect( Hydra::PCDM.file? file1 ).to be true
46
+ it 'return true for a pcdm file' do
47
+ expect(described_class.file? file1).to be true
50
48
  end
51
49
  end
52
-
53
50
  end
54
-
55
51
  end
56
-
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-pcdm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - E. Lynette Rayle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: active-fedora
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 9.4.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 9.4.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: activefedora-aggregation
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -117,6 +131,7 @@ extra_rdoc_files: []
117
131
  files:
118
132
  - ".coveralls.yml"
119
133
  - ".gitignore"
134
+ - ".rubocop.yml"
120
135
  - ".travis.yml"
121
136
  - CONTRIBUTING.md
122
137
  - Gemfile
@@ -144,9 +159,8 @@ files:
144
159
  - lib/hydra/pcdm/validators/pcdm_object_validator.rb
145
160
  - lib/hydra/pcdm/validators/pcdm_validator.rb
146
161
  - lib/hydra/pcdm/version.rb
147
- - lib/hydra/pcdm/vocab/ebucore_terms.rb
148
162
  - lib/hydra/pcdm/vocab/pcdm_terms.rb
149
- - lib/hydra/pcdm/vocab/sweetjpl_terms.rb
163
+ - lib/hydra/pcdm/vocab/sweet_jpl_terms.rb
150
164
  - spec/hydra/pcdm/ancestor_checker_spec.rb
151
165
  - spec/hydra/pcdm/collection_indexer_spec.rb
152
166
  - spec/hydra/pcdm/deep_member_iterator_spec.rb
@@ -177,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
191
  version: '0'
178
192
  requirements: []
179
193
  rubyforge_project:
180
- rubygems_version: 2.4.5
194
+ rubygems_version: 2.2.2
181
195
  signing_key:
182
196
  specification_version: 4
183
197
  summary: Portland Common Data Model (PCDM)
@@ -1,33 +0,0 @@
1
- require 'rdf'
2
- module EBUCoreVocabularies
3
- class EBUCoreTerms < RDF::StrictVocabulary("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#")
4
- # Property definitions
5
- property :filename,
6
- comment: ["The name of the file containing the Resource.".freeze],
7
- domain: "ebucore:Resource".freeze,
8
- range: "xsd:string".freeze,
9
- label: "File Name".freeze
10
-
11
- property :fileSize,
12
- comment: ["Size of a MediaResource in bytes.".freeze],
13
- domain: "ebucore:Resource".freeze,
14
- range: "xsd:integer".freeze,
15
- label: "File Size".freeze
16
-
17
- property :dateCreated,
18
- comment: ["The date of creation of the media resource.".freeze],
19
- domain: "ebucore:Resource".freeze,
20
- range: "xsd:dateTime".freeze,
21
- label: "Date Created".freeze
22
-
23
- property :hasMimeType,
24
- comment: ["Has Mime Type.".freeze],
25
- range: "xsd:string".freeze,
26
- label: "Has Mime Type".freeze
27
-
28
- property :dateModified,
29
- comment: ["To indicate the date at which the media resource has been modified.".freeze],
30
- range: "xsd:dateTime".freeze,
31
- label: "Date Modified".freeze
32
- end
33
- end
@@ -1,10 +0,0 @@
1
- require 'rdf'
2
- module SweetjplVocabularies
3
- class SweetjplTerms < RDF::StrictVocabulary("http://sweet.jpl.nasa.gov/2.2/reprDataFormat.owl#")
4
- # Property definitions
5
- property :byteOrder,
6
- comment: ["Byte Order.".freeze],
7
- range: "xsd:string".freeze,
8
- label: "Byte Order".freeze
9
- end
10
- end