stash-wrapper 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/stash/wrapper/embargo.rb +1 -1
- data/lib/stash/wrapper/identifier.rb +1 -1
- data/lib/stash/wrapper/inventory.rb +1 -1
- data/lib/stash/wrapper/module_info.rb +1 -1
- data/lib/stash/wrapper/size.rb +1 -1
- data/lib/stash/wrapper/stash_administrative.rb +4 -4
- data/lib/stash/wrapper/stash_wrapper.rb +3 -3
- data/spec/unit/stash/wrapper/stash_wrapper_spec.rb +50 -50
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccb2fa67c22b5f93e649abdb1afbd22508e26fb2
|
4
|
+
data.tar.gz: 722e4a497c0349dfdf2dfbe3796245fc25270ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95e668d3de0cedb2c5477a11600051bbd7967add8d93a979f851e4bd3cc62a7336714eb243c1e4c8391ea82b8257bc323fbff40008292e2a74ba032bbb24b4bf
|
7
|
+
data.tar.gz: 367152e12ed2bdba9577cd6f4734ed524102bd16fe601134eb8f89378f43afbf15df8311d412115b677933ba440cefd81fd3a9277253cc4eafe76480f47c77d0
|
data/CHANGES.md
CHANGED
data/lib/stash/wrapper/size.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'xml/mapping'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
require 'stash/wrapper/version'
|
3
|
+
require 'stash/wrapper/license'
|
4
|
+
require 'stash/wrapper/embargo'
|
5
|
+
require 'stash/wrapper/inventory'
|
6
6
|
|
7
7
|
module Stash
|
8
8
|
module Wrapper
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'xml/mapping'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
require 'stash/wrapper/descriptive_node'
|
4
|
+
require 'stash/wrapper/identifier'
|
5
|
+
require 'stash/wrapper/stash_administrative'
|
6
6
|
|
7
7
|
module Stash
|
8
8
|
module Wrapper
|
@@ -137,26 +137,26 @@ module Stash
|
|
137
137
|
wrapper = StashWrapper.parse_xml(data)
|
138
138
|
|
139
139
|
expected = %w(
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
140
|
+
HSRC_MasterSampleII.dat
|
141
|
+
HSRC_MasterSampleII.csv
|
142
|
+
HSRC_MasterSampleII.sas7bdat
|
143
|
+
formats.sas7bcat
|
144
|
+
HSRC_MasterSampleII.sas
|
145
|
+
HSRC_MasterSampleII.sav
|
146
|
+
HSRC_MasterSampleII.sps
|
147
|
+
HSRC_MasterSampleII.dta
|
148
|
+
HSRC_MasterSampleII.dct
|
149
|
+
HSRC_MasterSampleII.do
|
150
150
|
)
|
151
151
|
expect(wrapper.file_names).to eq(expected)
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'returns an empty array for an empty inventory' do
|
155
155
|
wrapper = StashWrapper.new(
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
156
|
+
identifier: Identifier.new(type: IdentifierType::DOI, value: '10.14749/1407399498'),
|
157
|
+
version: Version.new(number: 1, date: Date.new(2013, 8, 18), note: 'Sample wrapped Datacite document'),
|
158
|
+
license: License::CC_BY,
|
159
|
+
descriptive_elements: []
|
160
160
|
)
|
161
161
|
expect(wrapper.file_names).to eq([])
|
162
162
|
end
|
@@ -166,14 +166,14 @@ module Stash
|
|
166
166
|
describe '#initialize' do
|
167
167
|
it 'defaults to no embargo' do
|
168
168
|
wrapper = StashWrapper.new(
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
169
|
+
identifier: Identifier.new(type: IdentifierType::DOI, value: '10.14749/1407399498'),
|
170
|
+
version: Version.new(number: 1, date: Date.new(2013, 8, 18), note: 'Sample wrapped Datacite document'),
|
171
|
+
license: License::CC_BY,
|
172
|
+
inventory: Inventory.new(
|
173
|
+
files: [
|
174
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.dat', size_bytes: 12_345, mime_type: 'text/plain')
|
175
|
+
]),
|
176
|
+
descriptive_elements: []
|
177
177
|
)
|
178
178
|
embargo = wrapper.embargo
|
179
179
|
expect(embargo).to be_an(Embargo)
|
@@ -190,16 +190,16 @@ module Stash
|
|
190
190
|
describe 'namespace handling' do
|
191
191
|
before :each do
|
192
192
|
wrapper = StashWrapper.new(
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
193
|
+
identifier: Identifier.new(type: IdentifierType::DOI, value: '10.14749/1407399498'),
|
194
|
+
version: Version.new(number: 1, date: Date.new(2013, 8, 18), note: 'Sample wrapped Datacite document'),
|
195
|
+
license: License::CC_BY,
|
196
|
+
embargo: Embargo.new(type: EmbargoType::DOWNLOAD, period: '1 year', start_date: Date.new(2014, 8, 18), end_date: Date.new(2013, 8, 18)),
|
197
|
+
inventory: Inventory.new(
|
198
|
+
files: [
|
199
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.dat', size_bytes: 12_345, mime_type: 'text/plain')
|
200
|
+
]),
|
201
|
+
# Note: the recursive asserts only work because descriptive_elements is empty
|
202
|
+
descriptive_elements: []
|
203
203
|
)
|
204
204
|
@wrapper_xml = wrapper.save_to_xml
|
205
205
|
end
|
@@ -249,24 +249,24 @@ module Stash
|
|
249
249
|
payload_xml = REXML::Document.new(payload).root
|
250
250
|
|
251
251
|
wrapper = StashWrapper.new(
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
252
|
+
identifier: Identifier.new(type: IdentifierType::DOI, value: '10.14749/1407399498'),
|
253
|
+
version: Version.new(number: 1, date: Date.new(2013, 8, 18), note: 'Sample wrapped Datacite document'),
|
254
|
+
license: License::CC_BY,
|
255
|
+
embargo: Embargo.new(type: EmbargoType::DOWNLOAD, period: '1 year', start_date: Date.new(2014, 8, 18), end_date: Date.new(2013, 8, 18)),
|
256
|
+
inventory: Inventory.new(
|
257
|
+
files: [
|
258
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.dat', size_bytes: 12_345, mime_type: 'text/plain'),
|
259
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.csv', size_bytes: 67_890, mime_type: 'text/csv'),
|
260
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.sas7bdat', size_bytes: 123_456, mime_type: 'application/x-sas-data'),
|
261
|
+
StashFile.new(pathname: 'formats.sas7bcat', size_bytes: 78_910, mime_type: 'application/x-sas-catalog'),
|
262
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.sas', size_bytes: 11_121, mime_type: 'application/x-sas'),
|
263
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.sav', size_bytes: 31_415, mime_type: 'application/x-sav'),
|
264
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.sps', size_bytes: 16_171, mime_type: 'application/x-spss'),
|
265
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.dta', size_bytes: 81_920, mime_type: 'application/x-dta'),
|
266
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.dct', size_bytes: 212_223, mime_type: 'application/x-dct'),
|
267
|
+
StashFile.new(pathname: 'HSRC_MasterSampleII.do', size_bytes: 242_526, mime_type: 'application/x-do')
|
268
|
+
]),
|
269
|
+
descriptive_elements: [payload_xml]
|
270
270
|
)
|
271
271
|
|
272
272
|
wrapper_xml = wrapper.save_to_xml
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stash-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typesafe_enum
|
@@ -209,7 +209,7 @@ files:
|
|
209
209
|
- spec/unit/stash/wrapper/stash_administrative_spec.rb
|
210
210
|
- spec/unit/stash/wrapper/stash_wrapper_spec.rb
|
211
211
|
- stash-wrapper.gemspec
|
212
|
-
homepage: http://github.com/
|
212
|
+
homepage: http://github.com/CDLUC3/stash-wrapper
|
213
213
|
licenses:
|
214
214
|
- MIT
|
215
215
|
metadata: {}
|