ddr-models 3.0.0.beta.16 → 3.0.0.beta.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e1ca66b83074e8dd2c014ce69a602ae357ac407
4
- data.tar.gz: db35414bf84d7b875cff7968057bc307c8d3f1d7
3
+ metadata.gz: 5ada8e4f7256516690e6fc879f9c7a76ff85d254
4
+ data.tar.gz: f6de430ff6b09be6010d34456a1e5a4e5ee59f86
5
5
  SHA512:
6
- metadata.gz: 0e359eb61c8ebe5622cee6b59029d8ae06d53b8df87316d46ec83ac712227e350158786fde911c44730bcdb4322070ffaabe3a02036558ebc1690046daa6fce1
7
- data.tar.gz: 4696be8707a0ee9a9630691a53482b6ee6e87b3f7805b632c4059b62785bb05155035fe61de247c1a13cdd4bffd8e6666733ffbdc7ba01e2997bec50cabae688
6
+ metadata.gz: 95c1a3beb7903628cfabe5968fa3ac91b1101fbdb3ab0a35ab6a7a67b79bd394e28d91a6758983b4d44fdba83bcf168f6a3a027f3b3a9facc5e299c29b4c99ae
7
+ data.tar.gz: cc7cb67e7e46437ad4d1c7f48dfcd673de6673b3d37bd1edbdb3e6459df0c5d14d29d65bdb481b6f4afb0c43445297ebe6298298327fda9f11f86e9c4acd32fd
@@ -17,7 +17,7 @@ ActiveFedora::Base.class_eval do
17
17
  end
18
18
 
19
19
  def can_have_content?
20
- datastreams.key? "content"
20
+ attached_files.key? "content"
21
21
  end
22
22
 
23
23
  def has_content?
@@ -38,7 +38,7 @@ ActiveFedora::Base.class_eval do
38
38
  end
39
39
 
40
40
  def can_have_struct_metadata?
41
- datastreams.key? Ddr::Models::File::STRUCT_METADATA
41
+ attached_files.key? Ddr::Models::File::STRUCT_METADATA
42
42
  end
43
43
 
44
44
  def has_struct_metadata?
@@ -52,9 +52,9 @@ ActiveFedora::Base.class_eval do
52
52
  def has_multires_image?
53
53
  can_have_multires_image? && multires_image_file_path.present?
54
54
  end
55
-
55
+
56
56
  def can_have_thumbnail?
57
- datastreams.key? "thumbnail"
57
+ attached_files.key? "thumbnail"
58
58
  end
59
59
 
60
60
  def has_thumbnail?
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency "devise", "~> 3.4"
27
27
  s.add_dependency "omniauth-shibboleth", "~> 1.2.0"
28
28
  s.add_dependency "grouper-rest-client"
29
- s.add_dependency "ezid-client", "~> 1.4.1"
29
+ s.add_dependency "ezid-client", "~> 1.4.2"
30
30
  s.add_dependency "resque", "~> 1.25"
31
31
  s.add_dependency "rdf-vocab", "~> 0.8"
32
32
  s.add_dependency "net-ldap", "~> 0.11"
@@ -45,9 +45,9 @@ module Ddr::Models
45
45
  content_digest(algorithm)
46
46
  end
47
47
  if checksum_value == calculated_checksum
48
- "The checksum #{algorithm}:#{checksum_value} is valid for file #{dsid}."
48
+ "The checksum #{algorithm}:#{checksum_value} is valid for file #{::File.basename(id)}."
49
49
  else
50
- raise ChecksumInvalid, "The checksum #{algorithm}:#{checksum_value} is not valid for file #{dsid}."
50
+ raise ChecksumInvalid, "The checksum #{algorithm}:#{checksum_value} is not valid for file #{::File.basename(id)}."
51
51
  end
52
52
  end
53
53
 
@@ -10,8 +10,8 @@ module Ddr
10
10
 
11
11
  def structure
12
12
  unless @structure
13
- if datastreams[Ddr::Models::File::STRUCT_METADATA].content
14
- @structure = Ddr::Models::Structure.new(Nokogiri::XML(datastreams[Ddr::Models::File::STRUCT_METADATA].content))
13
+ if attached_files[Ddr::Models::File::STRUCT_METADATA].content
14
+ @structure = Ddr::Models::Structure.new(Nokogiri::XML(attached_files[Ddr::Models::File::STRUCT_METADATA].content))
15
15
  end
16
16
  end
17
17
  @structure
@@ -53,7 +53,7 @@ module Ddr::Models
53
53
  end
54
54
 
55
55
  def access_roles
56
- get(Ddr::Index::Fields::ACCESS_ROLE)
56
+ fetch(Ddr::Index::Fields::ACCESS_ROLE)
57
57
  end
58
58
 
59
59
  def object_profile
@@ -90,7 +90,7 @@ module Ddr::Models
90
90
  end
91
91
 
92
92
  def has_datastream?(dsID)
93
- datastreams.key?(dsID) && datastreams[dsID]["size"].present?
93
+ attached_files.key?(dsID) && attached_files[dsID]["size"].present?
94
94
  end
95
95
 
96
96
  def has_admin_policy?
@@ -23,7 +23,7 @@ module Ddr
23
23
  end
24
24
 
25
25
  def docs
26
- query = ActiveFedora::SolrService.construct_query_for_pids(pids)
26
+ query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(pids)
27
27
  results = ActiveFedora::SolrService.query(query, rows: 999999)
28
28
  results.each_with_object({}) do |r, memo|
29
29
  memo[r["id"]] = ::SolrDocument.new(r)
@@ -60,4 +60,4 @@ module Ddr
60
60
 
61
61
  end
62
62
  end
63
- end
63
+ end
@@ -25,6 +25,10 @@ module Ddr
25
25
  xpath("//xmlns:structMap[@TYPE='#{type}']").first
26
26
  end
27
27
 
28
+ def fptr_nodes(type='default')
29
+ structMap_node(type).xpath('//xmlns:fptr')
30
+ end
31
+
28
32
  def as_xml_document
29
33
  __getobj__
30
34
  end
@@ -57,4 +61,4 @@ module Ddr
57
61
 
58
62
  end
59
63
  end
60
- end
64
+ end
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Models
3
- VERSION = "3.0.0.beta.16"
3
+ VERSION = "3.0.0.beta.17"
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ module Ddr::Auth
19
19
 
20
20
  DatastreamAbilityDefinitions::DATASTREAM_DOWNLOAD_ABILITIES.each do |dsid, permission|
21
21
  describe "\"#{dsid}\"" do
22
- let(:ds) { obj.datastreams[dsid] }
22
+ let(:ds) { obj.attached_files[dsid] }
23
23
  describe "can #{permission.inspect} object" do
24
24
  before { subject.can permission, obj.id }
25
25
  it { should be_able_to(:download, ds) }
@@ -31,10 +31,10 @@ module Ddr::Auth
31
31
  end
32
32
  end
33
33
 
34
- describe "non-downloadable datastreams" do
34
+ describe "non-downloadable attached_files" do
35
35
  (Component.ds_specs.keys.map(&:to_s) - DatastreamAbilityDefinitions::DATASTREAM_DOWNLOAD_ABILITIES.keys).each do |dsid|
36
36
  describe "\"#{dsid}\"" do
37
- let(:ds) { obj.datastreams[dsid] }
37
+ let(:ds) { obj.attached_files[dsid] }
38
38
  before { subject.can :download, obj.id }
39
39
  it { should_not be_able_to(:download, ds) }
40
40
  end
@@ -93,10 +93,10 @@ module Ddr
93
93
  describe "thumbnail" do
94
94
  let(:object) { ContentBearing.create }
95
95
  it "should create content in the thumbnail datastream" do
96
- expect(object.datastreams[Ddr::Models::File::THUMBNAIL]).to_not be_present
96
+ expect(object.attached_files[Ddr::Models::File::THUMBNAIL]).to_not be_present
97
97
  object.derivatives.generate_derivative Ddr::Derivatives::DERIVATIVES[:thumbnail]
98
- expect(object.datastreams[Ddr::Models::File::THUMBNAIL]).to be_present
99
- expect(object.datastreams[Ddr::Models::File::THUMBNAIL].size).to be > 0
98
+ expect(object.attached_files[Ddr::Models::File::THUMBNAIL]).to be_present
99
+ expect(object.attached_files[Ddr::Models::File::THUMBNAIL].size).to be > 0
100
100
  end
101
101
  end
102
102
  describe "ptif" do
@@ -55,7 +55,7 @@ RSpec.describe ActiveFedora::Base do
55
55
  describe "children", children: true do
56
56
  before do
57
57
  class Childrenable < ActiveFedora::Base
58
- has_many :children, property: :is_member_of, class_name: 'ActiveFedora::Base'
58
+ has_many :children, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOf, class_name: 'ActiveFedora::Base'
59
59
  end
60
60
  end
61
61
  after do
@@ -95,7 +95,7 @@ RSpec.describe ActiveFedora::Base do
95
95
  end
96
96
  describe "#has_thumbnail?" do
97
97
  let(:thumbnailable) { Thumbnailable.new }
98
- before { allow(thumbnailable.datastreams[Ddr::Models::File::THUMBNAIL]).to receive(:has_content?).and_return(true) }
98
+ before { allow(thumbnailable.attached_files[Ddr::Models::File::THUMBNAIL]).to receive(:has_content?).and_return(true) }
99
99
  it "should return true if object has a thumbnail, else false" do
100
100
  expect(thumbnailable).to have_thumbnail
101
101
  expect(Thumbnailable.new).not_to have_thumbnail
@@ -121,7 +121,7 @@ RSpec.describe ActiveFedora::Base do
121
121
  end
122
122
  describe "#has_content?" do
123
123
  let(:contentable) { Contentable.new }
124
- before { allow(contentable.datastreams[Ddr::Models::File::CONTENT]).to receive(:has_content?).and_return(true) }
124
+ before { allow(contentable.attached_files[Ddr::Models::File::CONTENT]).to receive(:has_content?).and_return(true) }
125
125
  it "should return true if object has content, else false" do
126
126
  expect(contentable).to have_content
127
127
  expect(Contentable.new).not_to have_content
@@ -13,7 +13,7 @@ module Ddr
13
13
  end
14
14
  end
15
15
  context "existing structural metadata" do
16
- before { item.datastreams[Ddr::Models::File::STRUCT_METADATA].content = simple_structure }
16
+ before { item.attached_files[Ddr::Models::File::STRUCT_METADATA].content = simple_structure }
17
17
  it "should return the structural metadata" do
18
18
  expect(item.structure.to_xml).to be_equivalent_to(simple_structure)
19
19
  end
@@ -35,7 +35,7 @@ module Ddr
35
35
 
36
36
  describe "indexing" do
37
37
  let(:expected_json) { multiple_struct_maps_structure_to_json }
38
- before { item.datastreams[Ddr::Models::File::STRUCT_METADATA].content = multiple_struct_maps_structure }
38
+ before { item.attached_files[Ddr::Models::File::STRUCT_METADATA].content = multiple_struct_maps_structure }
39
39
  it "should index the JSON representation of the structure" do
40
40
  indexing = item.to_solr
41
41
  expect(indexing.keys).to include(Ddr::Index::Fields::STRUCT_MAPS)
@@ -111,6 +111,16 @@ module Ddr
111
111
  end
112
112
  end
113
113
 
114
+ describe "#fptr_nodes" do
115
+ let(:structure) { FactoryGirl.build(:nested_structure) }
116
+ it "should return all fptr nodes" do
117
+ results = structure.fptr_nodes
118
+ expect(results.size).to eq(3)
119
+ ids = results.map { |entry| entry['CONTENTIDS'] }
120
+ expect(ids).to match_array([ 'test_5', 'test_6', 'test_7' ])
121
+ end
122
+ end
123
+
114
124
  end
115
125
  end
116
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta.16
4
+ version: 3.0.0.beta.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-03 00:00:00.000000000 Z
12
+ date: 2016-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: 1.4.1
132
+ version: 1.4.2
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: 1.4.1
139
+ version: 1.4.2
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: resque
142
142
  requirement: !ruby/object:Gem::Requirement