libis-tools 1.0.16 → 1.0.18

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
  SHA256:
3
- metadata.gz: 8e11e0bac24cf562c5834d59510d7899d61e1295e3128fa66f549f40549d6c3e
4
- data.tar.gz: 834820ad3715e8321c34af9099a7ff01278f15641ef99fb677eea3df0a0bcef4
3
+ metadata.gz: cd9a110b1394d078bf4554d9897029835f3995fa1f0d6bd856797a3f015af769
4
+ data.tar.gz: 10fe0366ebe9595de1a66435b24d66f21f6fcff8c0603db6758748b6964e9ed8
5
5
  SHA512:
6
- metadata.gz: b5c898f23a098f8c592f9cb0a672e8d5248ffc71b4c93062c759daff7341a0cbdd4e95af9dd1017244afd31627c9c4e8d26df8698d433669f919db338eb83a7f
7
- data.tar.gz: 9c90ddab8ff5e79f0c9478eea359baa70117570a5cafad8fc8454050af4b3f7709ba54a1c314b8aa81ea6cbba791cb64e759ccec2e6c5b97360271aa04cbc388
6
+ metadata.gz: 35f2d8b5a9f5c7c6a0f8eae410c65e2ae0cdc7a73f25e44ce859cbe8cb758f58935bedd71fc747b96a2d84b6ea05b3e3b46f337eebf29aabbd435e7d8988e161
7
+ data.tar.gz: 1bb344657de83bda87c22f63a94789f763997493ef25abf2f28a064c6eb0651507601127bc89805308a494c1af668f266569c1fa6b40a3aebe878f1e3bc8d7af
@@ -31,7 +31,9 @@ module Libis
31
31
  # Specialized DNX section.
32
32
  class WebHarvesting < DnxSection; end
33
33
  # Specialized DNX section.
34
- class Collection < DnxSection; end
34
+ class Collection < DnxSection
35
+ def tag; 'Collection'; end
36
+ end
35
37
  # Specialized DNX section.
36
38
  class PreservationLevel < DnxSection; end
37
39
  # Specialized DNX section.
@@ -44,188 +44,6 @@ module Libis
44
44
 
45
45
  end
46
46
 
47
- # Container class for creating a representation in the METS.
48
- class Representation
49
- include MetsObject
50
-
51
- # The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
52
- attr_accessor :label, :preservation_type, :usage_type, :representation_code, :entity_type, :access_right_id,
53
- :user_a, :user_b, :user_c,
54
- :group_id, :priority, :order,
55
- :digital_original, :content, :context, :hardware, :carrier, :original_name,
56
- :preservation_levels, :env_dependencies, :hardware_ids, :software_ids,
57
- :hardware_infos, :software_infos, :relationship_infos, :environments,
58
- :dc_record, :source_metadata
59
-
60
- # The id that will be used in the XML file to reference this representation.
61
- def xml_id
62
- "rep#{@id}"
63
- end
64
-
65
- # This method creates the appropriate {DnxSection}s based on what attributes are filled in.
66
- def amd
67
- dnx = {}
68
- tech_data = []
69
- # General characteristics
70
- data = {
71
- preservationType: preservation_type,
72
- usageType: usage_type,
73
- DigitalOriginal: digital_original,
74
- label: label,
75
- representationEntityType: entity_type,
76
- contentType: content,
77
- contextType: context,
78
- hardwareUsed: hardware,
79
- physicalCarrierMedia: carrier,
80
- deliveryPriority: priority,
81
- orderingSequence: order,
82
- RepresentationCode: representation_code,
83
- RepresentationOriginalName: original_name,
84
- UserDefinedA: user_a,
85
- UserDefinedB: user_b,
86
- UserDefinedC: user_c,
87
- }.cleanup
88
- tech_data << GeneralRepCharacteristics.new(data) unless data.empty?
89
- # Object characteristics
90
- data = {
91
- groupID: group_id
92
- }.cleanup
93
- tech_data << ObjectCharacteristics.new(data) unless data.empty?
94
- # Preservation level
95
- if preservation_levels
96
- data_list = []
97
- preservation_levels.each do |preservation_level|
98
- data = {
99
- preservationLevelValue: preservation_level[:value],
100
- preservationLevelRole: preservation_level[:role],
101
- preservationLevelRationale: preservation_level[:rationale],
102
- preservationLevelDateAssigned: preservation_level[:date],
103
- }.cleanup
104
- data_list << OpenStruct.new(data) unless data.empty?
105
- end
106
- tech_data << PreservationLevel.new(array: data_list) unless data_list.empty?
107
- end
108
- # Dependencies
109
- if env_dependencies
110
- data_list = []
111
- env_dependencies.each do |dependency|
112
- data = {
113
- dependencyName: dependency[:name],
114
- dependencyIdentifierType1: dependency[:type1],
115
- dependencyIdentifierValue1: dependency[:value1],
116
- dependencyIdentifierType2: dependency[:type2],
117
- dependencyIdentifierValue2: dependency[:value2],
118
- dependencyIdentifierType3: dependency[:type3],
119
- dependencyIdentifierValue3: dependency[:value3],
120
- }.cleanup
121
- data_list << OpenStruct.new(data) unless data.empty?
122
- end
123
- tech_data << EnvironmentDependencies.new(array: data_list) unless data_list.empty?
124
- end
125
- # Hardware registry id
126
- if hardware_ids
127
- data_list = []
128
- hardware_ids.each do |id|
129
- data = {
130
- registryId: id
131
- }.cleanup
132
- data_list << OpenStruct.new(data) unless data.empty?
133
- end
134
- tech_data << EnvHardwareRegistry.new(array: data_list) unless data_list.empty?
135
- end
136
- # Software registry id
137
- if software_ids
138
- data_list = []
139
- software_ids.each do |id|
140
- data = {
141
- registryId: id
142
- }.cleanup
143
- data_list << OpenStruct.new(data) unless data.empty?
144
- end
145
- tech_data << EnvSoftwareRegistry.new(array: data_list) unless data_list.empty?
146
- end
147
- # Hardware
148
- if hardware_infos
149
- data_list = []
150
- hardware_infos.each do |hardware|
151
- data = {
152
- hardwareName: hardware[:name],
153
- hardwareType: hardware[:type],
154
- hardwareOtherInformation: hardware[:info],
155
- }.cleanup
156
- data_list << OpenStruct.new(data) unless data.empty?
157
- end
158
- tech_data << EnvironmentHardware.new(array: data_list) unless data_list.empty?
159
- end
160
- # Software
161
- if software_infos
162
- data_list = []
163
- software_infos.each do |software|
164
- data = {
165
- softwareName: software[:name],
166
- softwareVersion: software[:version],
167
- softwareType: software[:type],
168
- softwareOtherInformation: software[:info],
169
- softwareDependancy: software[:dependency],
170
- }.cleanup
171
- data_list << OpenStruct.new(data) unless data.empty?
172
- end
173
- tech_data << EnvironmentSoftware.new(array: data_list) unless data_list.empty?
174
- end
175
- # Relationship
176
- if relationship_infos
177
- data_list = []
178
- relationship_infos.each do |relationship|
179
- data = {
180
- relationshipType: relationship[:type],
181
- relationshipSubType: relationship[:subtype],
182
- relatedObjectIdentifierType1: relationship[:type1],
183
- relatedObjectIdentifierValue1: relationship[:id1],
184
- relatedObjectSequence1: relationship[:seq1],
185
- relatedObjectIdentifierType2: relationship[:type2],
186
- relatedObjectIdentifierValue2: relationship[:id2],
187
- relatedObjectSequence2: relationship[:seq2],
188
- relatedObjectIdentifierType3: relationship[:type3],
189
- relatedObjectIdentifierValue3: relationship[:id3],
190
- relatedObjectSequence3: relationship[:seq3],
191
- }.cleanup
192
- data_list << OpenStruct.new(data) unless data.empty?
193
- end
194
- tech_data << RelationShip.new(array: data_list) unless data_list.empty?
195
- end
196
- # Environment
197
- if environments
198
- data_list = []
199
- environments.each do |environment|
200
- data = {
201
- environmentCharacteristic: environment[:characteristic],
202
- environmentPurpose: environment[:purpose],
203
- environmentNote: environment[:note],
204
- }.cleanup
205
- data_list << OpenStruct.new(data) unless data.empty?
206
- end
207
- tech_data << Environment.new(array: data_list) unless data_list.empty?
208
- end
209
- # Finally assemble technical section
210
- dnx[:tech] = tech_data unless tech_data.empty?
211
- # Rights section
212
- rights_data = []
213
- data = {
214
- policyId: access_right_id
215
- }.cleanup
216
- rights_data << AccessRightsPolicy.new(data) unless data.empty?
217
- dnx[:rights] = rights_data unless rights_data.empty?
218
- # Source metadata
219
- if source_metadata
220
- source_metadata.each_with_index do |metadata, i|
221
- dnx["source-#{metadata[:type].to_s.upcase}-#{i}"] = metadata[:data]
222
- end
223
- end
224
- dnx
225
- end
226
-
227
- end
228
-
229
47
  # Container class for creating a file in the METS.
230
48
  class File
231
49
  include MetsObject
@@ -291,7 +109,7 @@ module Libis
291
109
  fileLocation: location,
292
110
  fileOriginalName: original || target_name,
293
111
  fileOriginalPath: target_path,
294
- # fileOriginalID: URI.encode(location),
112
+ # fileOriginalID: CGI.escape(location),
295
113
  # fileExtension: ::File.extname(orig_name),
296
114
  fileMIMEType: mimetype,
297
115
  fileSizeBytes: size,
@@ -524,6 +342,188 @@ module Libis
524
342
 
525
343
  end
526
344
 
345
+ # Container class for creating a representation in the METS.
346
+ class Representation
347
+ include MetsObject
348
+
349
+ # The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
350
+ attr_accessor :preservation_type, :usage_type, :representation_code, :entity_type, :access_right_id,
351
+ :user_a, :user_b, :user_c,
352
+ :group_id, :priority, :order,
353
+ :digital_original, :content, :context, :hardware, :carrier, :original_name,
354
+ :preservation_levels, :env_dependencies, :hardware_ids, :software_ids,
355
+ :hardware_infos, :software_infos, :relationship_infos, :environments,
356
+ :dc_record, :source_metadata
357
+
358
+ # The id that will be used in the XML file to reference this representation.
359
+ def xml_id
360
+ "rep#{@id}"
361
+ end
362
+
363
+ # This method creates the appropriate {DnxSection}s based on what attributes are filled in.
364
+ def amd
365
+ dnx = {}
366
+ tech_data = []
367
+ # General characteristics
368
+ data = {
369
+ preservationType: preservation_type,
370
+ usageType: usage_type,
371
+ DigitalOriginal: digital_original,
372
+ label: label,
373
+ representationEntityType: entity_type,
374
+ contentType: content,
375
+ contextType: context,
376
+ hardwareUsed: hardware,
377
+ physicalCarrierMedia: carrier,
378
+ deliveryPriority: priority,
379
+ orderingSequence: order,
380
+ RepresentationCode: representation_code,
381
+ RepresentationOriginalName: original_name,
382
+ UserDefinedA: user_a,
383
+ UserDefinedB: user_b,
384
+ UserDefinedC: user_c,
385
+ }.cleanup
386
+ tech_data << GeneralRepCharacteristics.new(data) unless data.empty?
387
+ # Object characteristics
388
+ data = {
389
+ groupID: group_id
390
+ }.cleanup
391
+ tech_data << ObjectCharacteristics.new(data) unless data.empty?
392
+ # Preservation level
393
+ if preservation_levels
394
+ data_list = []
395
+ preservation_levels.each do |preservation_level|
396
+ data = {
397
+ preservationLevelValue: preservation_level[:value],
398
+ preservationLevelRole: preservation_level[:role],
399
+ preservationLevelRationale: preservation_level[:rationale],
400
+ preservationLevelDateAssigned: preservation_level[:date],
401
+ }.cleanup
402
+ data_list << OpenStruct.new(data) unless data.empty?
403
+ end
404
+ tech_data << PreservationLevel.new(array: data_list) unless data_list.empty?
405
+ end
406
+ # Dependencies
407
+ if env_dependencies
408
+ data_list = []
409
+ env_dependencies.each do |dependency|
410
+ data = {
411
+ dependencyName: dependency[:name],
412
+ dependencyIdentifierType1: dependency[:type1],
413
+ dependencyIdentifierValue1: dependency[:value1],
414
+ dependencyIdentifierType2: dependency[:type2],
415
+ dependencyIdentifierValue2: dependency[:value2],
416
+ dependencyIdentifierType3: dependency[:type3],
417
+ dependencyIdentifierValue3: dependency[:value3],
418
+ }.cleanup
419
+ data_list << OpenStruct.new(data) unless data.empty?
420
+ end
421
+ tech_data << EnvironmentDependencies.new(array: data_list) unless data_list.empty?
422
+ end
423
+ # Hardware registry id
424
+ if hardware_ids
425
+ data_list = []
426
+ hardware_ids.each do |id|
427
+ data = {
428
+ registryId: id
429
+ }.cleanup
430
+ data_list << OpenStruct.new(data) unless data.empty?
431
+ end
432
+ tech_data << EnvHardwareRegistry.new(array: data_list) unless data_list.empty?
433
+ end
434
+ # Software registry id
435
+ if software_ids
436
+ data_list = []
437
+ software_ids.each do |id|
438
+ data = {
439
+ registryId: id
440
+ }.cleanup
441
+ data_list << OpenStruct.new(data) unless data.empty?
442
+ end
443
+ tech_data << EnvSoftwareRegistry.new(array: data_list) unless data_list.empty?
444
+ end
445
+ # Hardware
446
+ if hardware_infos
447
+ data_list = []
448
+ hardware_infos.each do |hardware|
449
+ data = {
450
+ hardwareName: hardware[:name],
451
+ hardwareType: hardware[:type],
452
+ hardwareOtherInformation: hardware[:info],
453
+ }.cleanup
454
+ data_list << OpenStruct.new(data) unless data.empty?
455
+ end
456
+ tech_data << EnvironmentHardware.new(array: data_list) unless data_list.empty?
457
+ end
458
+ # Software
459
+ if software_infos
460
+ data_list = []
461
+ software_infos.each do |software|
462
+ data = {
463
+ softwareName: software[:name],
464
+ softwareVersion: software[:version],
465
+ softwareType: software[:type],
466
+ softwareOtherInformation: software[:info],
467
+ softwareDependancy: software[:dependency],
468
+ }.cleanup
469
+ data_list << OpenStruct.new(data) unless data.empty?
470
+ end
471
+ tech_data << EnvironmentSoftware.new(array: data_list) unless data_list.empty?
472
+ end
473
+ # Relationship
474
+ if relationship_infos
475
+ data_list = []
476
+ relationship_infos.each do |relationship|
477
+ data = {
478
+ relationshipType: relationship[:type],
479
+ relationshipSubType: relationship[:subtype],
480
+ relatedObjectIdentifierType1: relationship[:type1],
481
+ relatedObjectIdentifierValue1: relationship[:id1],
482
+ relatedObjectSequence1: relationship[:seq1],
483
+ relatedObjectIdentifierType2: relationship[:type2],
484
+ relatedObjectIdentifierValue2: relationship[:id2],
485
+ relatedObjectSequence2: relationship[:seq2],
486
+ relatedObjectIdentifierType3: relationship[:type3],
487
+ relatedObjectIdentifierValue3: relationship[:id3],
488
+ relatedObjectSequence3: relationship[:seq3],
489
+ }.cleanup
490
+ data_list << OpenStruct.new(data) unless data.empty?
491
+ end
492
+ tech_data << RelationShip.new(array: data_list) unless data_list.empty?
493
+ end
494
+ # Environment
495
+ if environments
496
+ data_list = []
497
+ environments.each do |environment|
498
+ data = {
499
+ environmentCharacteristic: environment[:characteristic],
500
+ environmentPurpose: environment[:purpose],
501
+ environmentNote: environment[:note],
502
+ }.cleanup
503
+ data_list << OpenStruct.new(data) unless data.empty?
504
+ end
505
+ tech_data << Environment.new(array: data_list) unless data_list.empty?
506
+ end
507
+ # Finally assemble technical section
508
+ dnx[:tech] = tech_data unless tech_data.empty?
509
+ # Rights section
510
+ rights_data = []
511
+ data = {
512
+ policyId: access_right_id
513
+ }.cleanup
514
+ rights_data << AccessRightsPolicy.new(data) unless data.empty?
515
+ dnx[:rights] = rights_data unless rights_data.empty?
516
+ # Source metadata
517
+ if source_metadata
518
+ source_metadata.each_with_index do |metadata, i|
519
+ dnx["source-#{metadata[:type].to_s.upcase}-#{i}"] = metadata[:data]
520
+ end
521
+ end
522
+ dnx
523
+ end
524
+
525
+ end
526
+
527
527
  # Container class for creating a structmap in the METS.
528
528
  class Map
529
529
  include MetsObject
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Tools
3
- VERSION = '1.0.16'
3
+ VERSION = '1.0.18'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-31 00:00:00.000000000 Z
11
+ date: 2023-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -386,7 +386,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
386
386
  - !ruby/object:Gem::Version
387
387
  version: '0'
388
388
  requirements: []
389
- rubygems_version: 3.2.15
389
+ rubygems_version: 3.3.7
390
390
  signing_key:
391
391
  specification_version: 4
392
392
  summary: LIBIS toolbox.