berkeley_library-tind 0.5.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +15 -3
  3. data/.gitignore +3 -0
  4. data/.idea/inspectionProfiles/Project_Default.xml +10 -0
  5. data/.idea/tind.iml +10 -9
  6. data/.rubocop.yml +1 -1
  7. data/CHANGES.md +15 -1
  8. data/README.md +165 -2
  9. data/berkeley_library-tind.gemspec +2 -2
  10. data/bin/alma-multiple-tind +50 -0
  11. data/bin/alma-single-tind +48 -0
  12. data/bin/save_tind_records +80 -0
  13. data/bin/tind-marc +73 -0
  14. data/lib/berkeley_library/tind/export/ods_exporter.rb +4 -6
  15. data/lib/berkeley_library/tind/mapping/additional_datafield_process.rb +128 -0
  16. data/lib/berkeley_library/tind/mapping/alma.rb +42 -0
  17. data/lib/berkeley_library/tind/mapping/alma_base.rb +108 -0
  18. data/lib/berkeley_library/tind/mapping/alma_multiple_tind.rb +31 -0
  19. data/lib/berkeley_library/tind/mapping/alma_single_tind.rb +28 -0
  20. data/lib/berkeley_library/tind/mapping/config.rb +44 -0
  21. data/lib/berkeley_library/tind/mapping/csv_mapper.rb +35 -0
  22. data/lib/berkeley_library/tind/mapping/csv_multiple_mapper.rb +41 -0
  23. data/lib/berkeley_library/tind/mapping/data/one_to_multiple_mapping.csv +4 -0
  24. data/lib/berkeley_library/tind/mapping/data/one_to_one_mapping.csv +39 -0
  25. data/lib/berkeley_library/tind/mapping/external_tind_field.rb +103 -0
  26. data/lib/berkeley_library/tind/mapping/field_catalog.rb +137 -0
  27. data/lib/berkeley_library/tind/mapping/field_catalog_util.rb +105 -0
  28. data/lib/berkeley_library/tind/mapping/match_tind_field.rb +77 -0
  29. data/lib/berkeley_library/tind/mapping/misc.rb +69 -0
  30. data/lib/berkeley_library/tind/mapping/multiple_rule.rb +36 -0
  31. data/lib/berkeley_library/tind/mapping/single_rule.rb +149 -0
  32. data/lib/berkeley_library/tind/mapping/tind_control_subfield.rb +59 -0
  33. data/lib/berkeley_library/tind/mapping/tind_field.rb +49 -0
  34. data/lib/berkeley_library/tind/mapping/tind_field_from_leader.rb +27 -0
  35. data/lib/berkeley_library/tind/mapping/tind_field_from_multiple_map.rb +59 -0
  36. data/lib/berkeley_library/tind/mapping/tind_field_from_single_map.rb +182 -0
  37. data/lib/berkeley_library/tind/mapping/tind_field_util.rb +112 -0
  38. data/lib/berkeley_library/tind/mapping/tind_marc.rb +134 -0
  39. data/lib/berkeley_library/tind/mapping/tind_record_util.rb +135 -0
  40. data/lib/berkeley_library/tind/mapping/tind_subfield_util.rb +154 -0
  41. data/lib/berkeley_library/tind/mapping/util.rb +136 -0
  42. data/lib/berkeley_library/tind/mapping.rb +1 -0
  43. data/lib/berkeley_library/tind/module_info.rb +1 -1
  44. data/spec/berkeley_library/tind/mapping/additional_datafield_process_spec.rb +35 -0
  45. data/spec/berkeley_library/tind/mapping/alma_base_spec.rb +115 -0
  46. data/spec/berkeley_library/tind/mapping/alma_multiple_tind_spec.rb +20 -0
  47. data/spec/berkeley_library/tind/mapping/alma_single_tind_spec.rb +87 -0
  48. data/spec/berkeley_library/tind/mapping/alma_spec.rb +28 -0
  49. data/spec/berkeley_library/tind/mapping/config_spec.rb +19 -0
  50. data/spec/berkeley_library/tind/mapping/csv_mapper_spec.rb +27 -0
  51. data/spec/berkeley_library/tind/mapping/csv_multiple_mapper_spec.rb +27 -0
  52. data/spec/berkeley_library/tind/mapping/external_tind_field_spec.rb +45 -0
  53. data/spec/berkeley_library/tind/mapping/field_catalog_spec.rb +78 -0
  54. data/spec/berkeley_library/tind/mapping/field_catalog_util_spec.rb +105 -0
  55. data/spec/berkeley_library/tind/mapping/match_tind_field_spec.rb +24 -0
  56. data/spec/berkeley_library/tind/mapping/misc_spec.rb +51 -0
  57. data/spec/berkeley_library/tind/mapping/multiple_rule_spec.rb +44 -0
  58. data/spec/berkeley_library/tind/mapping/single_rule_spec.rb +52 -0
  59. data/spec/berkeley_library/tind/mapping/tind_control_subfield_spec.rb +96 -0
  60. data/spec/berkeley_library/tind/mapping/tind_field_from_leader_spec.rb +21 -0
  61. data/spec/berkeley_library/tind/mapping/tind_field_from_multiple_map_spec.rb +31 -0
  62. data/spec/berkeley_library/tind/mapping/tind_field_from_single_map_spec.rb +167 -0
  63. data/spec/berkeley_library/tind/mapping/tind_field_spec.rb +60 -0
  64. data/spec/berkeley_library/tind/mapping/tind_field_util_spec.rb +68 -0
  65. data/spec/berkeley_library/tind/mapping/tind_marc_spec.rb +88 -0
  66. data/spec/berkeley_library/tind/mapping/tind_record_util_spec.rb +30 -0
  67. data/spec/berkeley_library/tind/mapping/tind_subfield_util_spec.rb +48 -0
  68. data/spec/berkeley_library/tind/mapping/util_spec.rb +56 -0
  69. data/spec/berkeley_library/tind/marc/xml_writer_spec.rb +24 -0
  70. data/spec/data/api/pre_assigned_response.json +15 -0
  71. data/spec/data/api/result_file.csv +3 -0
  72. data/spec/data/api/upload_file.json +1 -0
  73. data/spec/data/api/upload_response.json +13 -0
  74. data/spec/data/mapping/991032333019706532-sru.xml +216 -0
  75. data/spec/data/mapping/one_to_multiple_mapping.csv +4 -0
  76. data/spec/data/mapping/one_to_one_mapping.csv +39 -0
  77. data/spec/data/mapping/record.xml +266 -0
  78. data/spec/data/mapping/record_not_qualified.xml +36 -0
  79. metadata +89 -54
  80. data/lib/berkeley_library/util/files.rb +0 -39
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkeley_library-tind
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-23 00:00:00.000000000 Z
11
+ date: 2022-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: berkeley_library-alma
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: berkeley_library-logging
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -51,6 +65,9 @@ dependencies:
51
65
  - - "~>"
52
66
  - !ruby/object:Gem::Version
53
67
  version: '0.1'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 0.1.2
54
71
  type: :runtime
55
72
  prerelease: false
56
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,6 +75,9 @@ dependencies:
58
75
  - - "~>"
59
76
  - !ruby/object:Gem::Version
60
77
  version: '0.1'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.1.2
61
81
  - !ruby/object:Gem::Dependency
62
82
  name: ice_nine
63
83
  requirement: !ruby/object:Gem::Requirement
@@ -378,7 +398,11 @@ files:
378
398
  - README.md
379
399
  - Rakefile
380
400
  - berkeley_library-tind.gemspec
401
+ - bin/alma-multiple-tind
402
+ - bin/alma-single-tind
403
+ - bin/save_tind_records
381
404
  - bin/tind-export
405
+ - bin/tind-marc
382
406
  - docker-compose.yml
383
407
  - lib/berkeley_library/tind.rb
384
408
  - lib/berkeley_library/tind/api.rb
@@ -408,12 +432,39 @@ files:
408
432
  - lib/berkeley_library/tind/export/row_metrics.rb
409
433
  - lib/berkeley_library/tind/export/table.rb
410
434
  - lib/berkeley_library/tind/export/table_metrics.rb
435
+ - lib/berkeley_library/tind/mapping.rb
436
+ - lib/berkeley_library/tind/mapping/additional_datafield_process.rb
437
+ - lib/berkeley_library/tind/mapping/alma.rb
438
+ - lib/berkeley_library/tind/mapping/alma_base.rb
439
+ - lib/berkeley_library/tind/mapping/alma_multiple_tind.rb
440
+ - lib/berkeley_library/tind/mapping/alma_single_tind.rb
441
+ - lib/berkeley_library/tind/mapping/config.rb
442
+ - lib/berkeley_library/tind/mapping/csv_mapper.rb
443
+ - lib/berkeley_library/tind/mapping/csv_multiple_mapper.rb
444
+ - lib/berkeley_library/tind/mapping/data/one_to_multiple_mapping.csv
445
+ - lib/berkeley_library/tind/mapping/data/one_to_one_mapping.csv
446
+ - lib/berkeley_library/tind/mapping/external_tind_field.rb
447
+ - lib/berkeley_library/tind/mapping/field_catalog.rb
448
+ - lib/berkeley_library/tind/mapping/field_catalog_util.rb
449
+ - lib/berkeley_library/tind/mapping/match_tind_field.rb
450
+ - lib/berkeley_library/tind/mapping/misc.rb
451
+ - lib/berkeley_library/tind/mapping/multiple_rule.rb
452
+ - lib/berkeley_library/tind/mapping/single_rule.rb
453
+ - lib/berkeley_library/tind/mapping/tind_control_subfield.rb
454
+ - lib/berkeley_library/tind/mapping/tind_field.rb
455
+ - lib/berkeley_library/tind/mapping/tind_field_from_leader.rb
456
+ - lib/berkeley_library/tind/mapping/tind_field_from_multiple_map.rb
457
+ - lib/berkeley_library/tind/mapping/tind_field_from_single_map.rb
458
+ - lib/berkeley_library/tind/mapping/tind_field_util.rb
459
+ - lib/berkeley_library/tind/mapping/tind_marc.rb
460
+ - lib/berkeley_library/tind/mapping/tind_record_util.rb
461
+ - lib/berkeley_library/tind/mapping/tind_subfield_util.rb
462
+ - lib/berkeley_library/tind/mapping/util.rb
411
463
  - lib/berkeley_library/tind/marc.rb
412
464
  - lib/berkeley_library/tind/marc/xml_builder.rb
413
465
  - lib/berkeley_library/tind/marc/xml_reader.rb
414
466
  - lib/berkeley_library/tind/marc/xml_writer.rb
415
467
  - lib/berkeley_library/tind/module_info.rb
416
- - lib/berkeley_library/util/files.rb
417
468
  - lib/berkeley_library/util/ods/spreadsheet.rb
418
469
  - lib/berkeley_library/util/ods/xml/content_doc.rb
419
470
  - lib/berkeley_library/util/ods/xml/document_node.rb
@@ -476,6 +527,31 @@ files:
476
527
  - spec/berkeley_library/tind/export/exporter_spec.rb
477
528
  - spec/berkeley_library/tind/export/row_spec.rb
478
529
  - spec/berkeley_library/tind/export/table_spec.rb
530
+ - spec/berkeley_library/tind/mapping/additional_datafield_process_spec.rb
531
+ - spec/berkeley_library/tind/mapping/alma_base_spec.rb
532
+ - spec/berkeley_library/tind/mapping/alma_multiple_tind_spec.rb
533
+ - spec/berkeley_library/tind/mapping/alma_single_tind_spec.rb
534
+ - spec/berkeley_library/tind/mapping/alma_spec.rb
535
+ - spec/berkeley_library/tind/mapping/config_spec.rb
536
+ - spec/berkeley_library/tind/mapping/csv_mapper_spec.rb
537
+ - spec/berkeley_library/tind/mapping/csv_multiple_mapper_spec.rb
538
+ - spec/berkeley_library/tind/mapping/external_tind_field_spec.rb
539
+ - spec/berkeley_library/tind/mapping/field_catalog_spec.rb
540
+ - spec/berkeley_library/tind/mapping/field_catalog_util_spec.rb
541
+ - spec/berkeley_library/tind/mapping/match_tind_field_spec.rb
542
+ - spec/berkeley_library/tind/mapping/misc_spec.rb
543
+ - spec/berkeley_library/tind/mapping/multiple_rule_spec.rb
544
+ - spec/berkeley_library/tind/mapping/single_rule_spec.rb
545
+ - spec/berkeley_library/tind/mapping/tind_control_subfield_spec.rb
546
+ - spec/berkeley_library/tind/mapping/tind_field_from_leader_spec.rb
547
+ - spec/berkeley_library/tind/mapping/tind_field_from_multiple_map_spec.rb
548
+ - spec/berkeley_library/tind/mapping/tind_field_from_single_map_spec.rb
549
+ - spec/berkeley_library/tind/mapping/tind_field_spec.rb
550
+ - spec/berkeley_library/tind/mapping/tind_field_util_spec.rb
551
+ - spec/berkeley_library/tind/mapping/tind_marc_spec.rb
552
+ - spec/berkeley_library/tind/mapping/tind_record_util_spec.rb
553
+ - spec/berkeley_library/tind/mapping/tind_subfield_util_spec.rb
554
+ - spec/berkeley_library/tind/mapping/util_spec.rb
479
555
  - spec/berkeley_library/tind/marc/xml_reader_spec.rb
480
556
  - spec/berkeley_library/tind/marc/xml_writer_spec.rb
481
557
  - spec/berkeley_library/util/ods/spreadsheet_spec.rb
@@ -487,10 +563,19 @@ files:
487
563
  - spec/berkeley_library/util/ods/xml/style/family_spec.rb
488
564
  - spec/berkeley_library/util/ods/xml/table/table_row_spec.rb
489
565
  - spec/berkeley_library/util/ods/xml/table/table_spec.rb
566
+ - spec/data/api/pre_assigned_response.json
567
+ - spec/data/api/result_file.csv
568
+ - spec/data/api/upload_file.json
569
+ - spec/data/api/upload_response.json
490
570
  - spec/data/collection-names.txt
491
571
  - spec/data/collections.json
492
572
  - spec/data/disjoint-records.xml
493
573
  - spec/data/issue-4.xml
574
+ - spec/data/mapping/991032333019706532-sru.xml
575
+ - spec/data/mapping/one_to_multiple_mapping.csv
576
+ - spec/data/mapping/one_to_one_mapping.csv
577
+ - spec/data/mapping/record.xml
578
+ - spec/data/mapping/record_not_qualified.xml
494
579
  - spec/data/new-records.xml
495
580
  - spec/data/record-184453.xml
496
581
  - spec/data/record-184458.xml
@@ -531,54 +616,4 @@ rubygems_version: 3.1.6
531
616
  signing_key:
532
617
  specification_version: 4
533
618
  summary: TIND DA utilities for the UC Berkeley Library
534
- test_files:
535
- - spec/.rubocop.yml
536
- - spec/berkeley_library/tind/api/api_exception_spec.rb
537
- - spec/berkeley_library/tind/api/api_spec.rb
538
- - spec/berkeley_library/tind/api/collection_spec.rb
539
- - spec/berkeley_library/tind/api/date_range_spec.rb
540
- - spec/berkeley_library/tind/api/format_spec.rb
541
- - spec/berkeley_library/tind/api/search_spec.rb
542
- - spec/berkeley_library/tind/config_spec.rb
543
- - spec/berkeley_library/tind/export/column_group_spec.rb
544
- - spec/berkeley_library/tind/export/column_spec.rb
545
- - spec/berkeley_library/tind/export/config_spec.rb
546
- - spec/berkeley_library/tind/export/export_command_spec.rb
547
- - spec/berkeley_library/tind/export/export_format_spec.rb
548
- - spec/berkeley_library/tind/export/export_matcher.rb
549
- - spec/berkeley_library/tind/export/export_spec.rb
550
- - spec/berkeley_library/tind/export/exporter_spec.rb
551
- - spec/berkeley_library/tind/export/row_spec.rb
552
- - spec/berkeley_library/tind/export/table_spec.rb
553
- - spec/berkeley_library/tind/marc/xml_reader_spec.rb
554
- - spec/berkeley_library/tind/marc/xml_writer_spec.rb
555
- - spec/berkeley_library/util/ods/spreadsheet_spec.rb
556
- - spec/berkeley_library/util/ods/xml/content_doc_spec.rb
557
- - spec/berkeley_library/util/ods/xml/manifest/file_entry_spec.rb
558
- - spec/berkeley_library/util/ods/xml/manifest/manifest_spec.rb
559
- - spec/berkeley_library/util/ods/xml/office/document_content_spec.rb
560
- - spec/berkeley_library/util/ods/xml/style/automatic_styles_spec.rb
561
- - spec/berkeley_library/util/ods/xml/style/family_spec.rb
562
- - spec/berkeley_library/util/ods/xml/table/table_row_spec.rb
563
- - spec/berkeley_library/util/ods/xml/table/table_spec.rb
564
- - spec/data/collection-names.txt
565
- - spec/data/collections.json
566
- - spec/data/disjoint-records.xml
567
- - spec/data/issue-4.xml
568
- - spec/data/new-records.xml
569
- - spec/data/record-184453.xml
570
- - spec/data/record-184458.xml
571
- - spec/data/record-187888.xml
572
- - spec/data/records-api-search-cjk-p1.xml
573
- - spec/data/records-api-search-cjk-p2.xml
574
- - spec/data/records-api-search-p1.xml
575
- - spec/data/records-api-search-p2.xml
576
- - spec/data/records-api-search-p3.xml
577
- - spec/data/records-api-search-p4.xml
578
- - spec/data/records-api-search-p5.xml
579
- - spec/data/records-api-search-p6.xml
580
- - spec/data/records-api-search-p7.xml
581
- - spec/data/records-api-search.xml
582
- - spec/data/records-manual-search.xml
583
- - spec/spec_helper.rb
584
- - test/profile/table_from_records_profile.rb
619
+ test_files: []
@@ -1,39 +0,0 @@
1
- module BerkeleyLibrary
2
- module Util
3
- # TODO: Move this to `berkeley_library-util`
4
- module Files
5
- class << self
6
- include Files
7
- end
8
-
9
- def file_exists?(path)
10
- (path.respond_to?(:exist?) && path.exist?) ||
11
- (path.respond_to?(:to_str) && File.exist?(path))
12
- end
13
-
14
- def parent_exists?(path)
15
- path.respond_to?(:parent) && path.parent.exist? ||
16
- path.respond_to?(:to_str) && Pathname.new(path).parent.exist?
17
- end
18
-
19
- # Returns true if `obj` is close enough to an IO object for Nokogiri
20
- # to parse as one.
21
- #
22
- # @param obj [Object] the object that might be an IO
23
- # @see https://github.com/sparklemotion/nokogiri/blob/v1.11.1/lib/nokogiri/xml/sax/parser.rb#L81 Nokogiri::XML::SAX::Parser#parse
24
- def reader_like?(obj)
25
- obj.respond_to?(:read) && obj.respond_to?(:close)
26
- end
27
-
28
- # Returns true if `obj` is close enough to an IO object for Nokogiri
29
- # to write to.
30
- #
31
- # @param obj [Object] the object that might be an IO
32
- def writer_like?(obj)
33
- # TODO: is it possible/desirable to loosen this? how strict is libxml2?
34
- obj.is_a?(IO) || obj.is_a?(StringIO)
35
- end
36
-
37
- end
38
- end
39
- end