berkeley_library-tind 0.4.0 → 0.5.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +1 -1
  3. data/.idea/inspectionProfiles/Project_Default.xml +18 -0
  4. data/.idea/tind.iml +91 -91
  5. data/.ruby-version +1 -1
  6. data/CHANGES.md +33 -1
  7. data/README.md +15 -1
  8. data/berkeley_library-tind.gemspec +3 -2
  9. data/lib/berkeley_library/tind/api/api.rb +17 -11
  10. data/lib/berkeley_library/tind/api/collection.rb +1 -1
  11. data/lib/berkeley_library/tind/api/search.rb +2 -2
  12. data/lib/berkeley_library/tind/export/exporter.rb +1 -1
  13. data/lib/berkeley_library/tind/export/table.rb +1 -1
  14. data/lib/berkeley_library/tind/export/table_metrics.rb +1 -1
  15. data/lib/berkeley_library/tind/marc/xml_builder.rb +62 -0
  16. data/lib/berkeley_library/tind/marc/xml_reader.rb +32 -19
  17. data/lib/berkeley_library/tind/marc/xml_writer.rb +152 -0
  18. data/lib/berkeley_library/tind/module_info.rb +1 -1
  19. data/lib/berkeley_library/util/files.rb +39 -0
  20. data/lib/berkeley_library/util/ods/spreadsheet.rb +1 -1
  21. data/lib/berkeley_library/util/ods/xml/element_node.rb +1 -1
  22. data/spec/berkeley_library/tind/export/export_spec.rb +3 -1
  23. data/spec/berkeley_library/tind/export/table_spec.rb +2 -0
  24. data/spec/berkeley_library/tind/marc/xml_reader_spec.rb +42 -1
  25. data/spec/berkeley_library/tind/marc/xml_writer_spec.rb +156 -0
  26. data/spec/data/new-records.xml +46 -0
  27. metadata +36 -39
  28. data/Jenkinsfile +0 -18
  29. data/lib/berkeley_library/util/arrays.rb +0 -178
  30. data/lib/berkeley_library/util/logging.rb +0 -1
  31. data/lib/berkeley_library/util/paths.rb +0 -111
  32. data/lib/berkeley_library/util/stringios.rb +0 -30
  33. data/lib/berkeley_library/util/strings.rb +0 -42
  34. data/lib/berkeley_library/util/sys_exits.rb +0 -15
  35. data/lib/berkeley_library/util/times.rb +0 -22
  36. data/lib/berkeley_library/util/uris/appender.rb +0 -162
  37. data/lib/berkeley_library/util/uris/requester.rb +0 -62
  38. data/lib/berkeley_library/util/uris/validator.rb +0 -32
  39. data/lib/berkeley_library/util/uris.rb +0 -44
  40. data/spec/berkeley_library/util/arrays_spec.rb +0 -340
  41. data/spec/berkeley_library/util/paths_spec.rb +0 -90
  42. data/spec/berkeley_library/util/stringios_spec.rb +0 -34
  43. data/spec/berkeley_library/util/strings_spec.rb +0 -27
  44. data/spec/berkeley_library/util/times_spec.rb +0 -39
  45. data/spec/berkeley_library/util/uris_spec.rb +0 -118
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45e5cb4582c39cf8970c635a80d62613a64fd18fed34d6aed5ee69056dbcef75
4
- data.tar.gz: 27d48c5c119a66e56e3cdbc0d89460cc66cc44a92653704e0c4991a9ad5bfa3b
3
+ metadata.gz: 3e7d25497211920f8416b44cef0c1571f0655ff92c3e3ff69405ce9659c9df3e
4
+ data.tar.gz: 915b8fdc55e4f5d7a48bc7ef3befd2ec4d9e3f3081eedc41980b04dd073fff5c
5
5
  SHA512:
6
- metadata.gz: e7b5c185fce614223b4290cc55db8c888b02f08d835cecdb6927b4b775ea968c3db97dc0993295a1ded15282bc87bcc8e2e311f1058a85211c07f8ddc742ad31
7
- data.tar.gz: 905fa0971f1ce7a9fd460e5a59719892f9abbfa5bf2210f5f40de30c80ea2b745d272181ddbb625f6925b0909e262a7820963a230e560be396805bf137d9ba40
6
+ metadata.gz: 187ede68d2a48c906ee37fa01555489e877d1ef4c941189fae5ba683d79a6ca7704e1903077bab6ef9e3e70f8cb1670dee5755aed85a241c538f0e380542879c
7
+ data.tar.gz: 361ec4a2b88f4f97e53ad1eb25554b97e7cef94222b828de2f27bfc9037df02e412884adf36b31bbf9aed4671a0f62c0ad0910a94225ae18c4efd1758ccf9b43
@@ -6,7 +6,7 @@ jobs:
6
6
  fail-fast: false
7
7
  matrix:
8
8
  os: [ ubuntu-latest, macos-latest ]
9
- ruby-version: [ '2.7', '3.0' ]
9
+ ruby: [ '2.7', '3.0' ]
10
10
  runs-on: ${{ matrix.os }}
11
11
 
12
12
  steps:
@@ -10,6 +10,24 @@
10
10
  <inspection_tool class="LanguageDetectionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
11
11
  <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
12
12
  <inspection_tool class="RubyCaseWithoutElseBlockInspection" enabled="false" level="WARNING" enabled_by_default="false" />
13
+ <inspection_tool class="RubyMismatchedArgumentType" enabled="true" level="WARNING" enabled_by_default="true">
14
+ <option name="myCheckNilability" value="false" />
15
+ </inspection_tool>
16
+ <inspection_tool class="RubyMismatchedConstantType" enabled="true" level="WARNING" enabled_by_default="true">
17
+ <option name="myCheckNilability" value="false" />
18
+ </inspection_tool>
19
+ <inspection_tool class="RubyMismatchedGlobalVariableType" enabled="true" level="WARNING" enabled_by_default="true">
20
+ <option name="myCheckNilability" value="false" />
21
+ </inspection_tool>
22
+ <inspection_tool class="RubyMismatchedParameterType" enabled="true" level="WARNING" enabled_by_default="true">
23
+ <option name="myCheckNilability" value="false" />
24
+ </inspection_tool>
25
+ <inspection_tool class="RubyMismatchedReturnType" enabled="true" level="WARNING" enabled_by_default="true">
26
+ <option name="myCheckNilability" value="false" />
27
+ </inspection_tool>
28
+ <inspection_tool class="RubyMismatchedVariableType" enabled="true" level="WARNING" enabled_by_default="true">
29
+ <option name="myCheckNilability" value="false" />
30
+ </inspection_tool>
13
31
  <inspection_tool class="RubyStringKeysInHashInspection" enabled="true" level="INFORMATION" enabled_by_default="true" />
14
32
  <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
15
33
  <option name="processCode" value="true" />
data/.idea/tind.iml CHANGED
@@ -6,98 +6,98 @@
6
6
  <component name="NewModuleRootManager">
7
7
  <content url="file://$MODULE_DIR$">
8
8
  <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
- <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
9
  </content>
12
- <orderEntry type="jdk" jdkName="RVM: ruby-2.7.4" jdkType="RUBY_SDK" />
10
+ <orderEntry type="jdk" jdkName="RVM: ruby-2.7.5" jdkType="RUBY_SDK" />
13
11
  <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" scope="PROVIDED" name="actionpack (v6.1.4.1, RVM: ruby-2.7.4) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="actionview (v6.1.4.1, RVM: ruby-2.7.4) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.4.1, RVM: ruby-2.7.4) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, RVM: ruby-2.7.4) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="amazing_print (v1.3.0, RVM: ruby-2.7.4) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="berkeley_library-logging (v0.2.0, RVM: ruby-2.7.4) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="berkeley_library-marc (v0.2.0, RVM: ruby-2.7.4) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-2.7.4) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="bundle-audit (v0.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.14, RVM: ruby-2.7.4) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.8.0, RVM: ruby-2.7.4) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.4) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, RVM: ruby-2.7.4) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="crack (v0.4.5, RVM: ruby-2.7.4) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, RVM: ruby-2.7.4) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.7.4) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, RVM: ruby-2.7.4) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, RVM: ruby-2.7.4) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.6, RVM: ruby-2.7.4) [gem]" level="application" />
36
- <orderEntry type="library" scope="PROVIDED" name="erubi (v1.10.0, RVM: ruby-2.7.4) [gem]" level="application" />
37
- <orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.3, RVM: ruby-2.7.4) [gem]" level="application" />
38
- <orderEntry type="library" scope="PROVIDED" name="hashdiff (v1.0.1, RVM: ruby-2.7.4) [gem]" level="application" />
39
- <orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, RVM: ruby-2.7.4) [gem]" level="application" />
40
- <orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.4, RVM: ruby-2.7.4) [gem]" level="application" />
41
- <orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.10, RVM: ruby-2.7.4) [gem]" level="application" />
42
- <orderEntry type="library" scope="PROVIDED" name="ice_nine (v0.11.2, RVM: ruby-2.7.4) [gem]" level="application" />
43
- <orderEntry type="library" scope="PROVIDED" name="listen (v3.1.5, RVM: ruby-2.7.4) [gem]" level="application" />
44
- <orderEntry type="library" scope="PROVIDED" name="lograge (v0.11.2, RVM: ruby-2.7.4) [gem]" level="application" />
45
- <orderEntry type="library" scope="PROVIDED" name="loofah (v2.12.0, RVM: ruby-2.7.4) [gem]" level="application" />
46
- <orderEntry type="library" scope="PROVIDED" name="marc (v1.1.1, RVM: ruby-2.7.4) [gem]" level="application" />
47
- <orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
48
- <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.3.1, RVM: ruby-2.7.4) [gem]" level="application" />
49
- <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2021.0704, RVM: ruby-2.7.4) [gem]" level="application" />
50
- <orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.4, RVM: ruby-2.7.4) [gem]" level="application" />
51
- <orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
52
- <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.12.3, RVM: ruby-2.7.4) [gem]" level="application" />
53
- <orderEntry type="library" scope="PROVIDED" name="oj (v3.13.2, RVM: ruby-2.7.4) [gem]" level="application" />
54
- <orderEntry type="library" scope="PROVIDED" name="ougai (v1.9.1, RVM: ruby-2.7.4) [gem]" level="application" />
55
- <orderEntry type="library" scope="PROVIDED" name="parallel (v1.20.1, RVM: ruby-2.7.4) [gem]" level="application" />
56
- <orderEntry type="library" scope="PROVIDED" name="parser (v3.0.2.0, RVM: ruby-2.7.4) [gem]" level="application" />
57
- <orderEntry type="library" scope="PROVIDED" name="parslet (v2.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
58
- <orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, RVM: ruby-2.7.4) [gem]" level="application" />
59
- <orderEntry type="library" scope="PROVIDED" name="racc (v1.5.2, RVM: ruby-2.7.4) [gem]" level="application" />
60
- <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.3, RVM: ruby-2.7.4) [gem]" level="application" />
61
- <orderEntry type="library" scope="PROVIDED" name="rack-test (v1.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
62
- <orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, RVM: ruby-2.7.4) [gem]" level="application" />
63
- <orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.4.1, RVM: ruby-2.7.4) [gem]" level="application" />
64
- <orderEntry type="library" scope="PROVIDED" name="railties (v6.1.4.1, RVM: ruby-2.7.4) [gem]" level="application" />
65
- <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
66
- <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.4) [gem]" level="application" />
67
- <orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
68
- <orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.10.1, RVM: ruby-2.7.4) [gem]" level="application" />
69
- <orderEntry type="library" scope="PROVIDED" name="rchardet (v1.8.0, RVM: ruby-2.7.4) [gem]" level="application" />
70
- <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.1.1, RVM: ruby-2.7.4) [gem]" level="application" />
71
- <orderEntry type="library" scope="PROVIDED" name="request_store (v1.5.0, RVM: ruby-2.7.4) [gem]" level="application" />
72
- <orderEntry type="library" scope="PROVIDED" name="rest-client (v2.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
73
- <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.4) [gem]" level="application" />
74
- <orderEntry type="library" scope="PROVIDED" name="roo (v2.8.3, RVM: ruby-2.7.4) [gem]" level="application" />
75
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-2.7.4) [gem]" level="application" />
76
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-2.7.4) [gem]" level="application" />
77
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-2.7.4) [gem]" level="application" />
78
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-2.7.4) [gem]" level="application" />
79
- <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, RVM: ruby-2.7.4) [gem]" level="application" />
80
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
81
- <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.10.0, RVM: ruby-2.7.4) [gem]" level="application" />
82
- <orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, RVM: ruby-2.7.4) [gem]" level="application" />
83
- <orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.4.0, RVM: ruby-2.7.4) [gem]" level="application" />
84
- <orderEntry type="library" scope="PROVIDED" name="ruby-prof (v0.17.0, RVM: ruby-2.7.4) [gem]" level="application" />
85
- <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
86
- <orderEntry type="library" scope="PROVIDED" name="ruby_dep (v1.5.0, RVM: ruby-2.7.4) [gem]" level="application" />
87
- <orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.3.2, RVM: ruby-2.7.4) [gem]" level="application" />
88
- <orderEntry type="library" scope="PROVIDED" name="scrub_rb (v1.0.1, RVM: ruby-2.7.4) [gem]" level="application" />
89
- <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.21.2, RVM: ruby-2.7.4) [gem]" level="application" />
90
- <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.3, RVM: ruby-2.7.4) [gem]" level="application" />
91
- <orderEntry type="library" scope="PROVIDED" name="simplecov-rcov (v0.2.3, RVM: ruby-2.7.4) [gem]" level="application" />
92
- <orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.3, RVM: ruby-2.7.4) [gem]" level="application" />
93
- <orderEntry type="library" scope="PROVIDED" name="thor (v1.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
94
- <orderEntry type="library" scope="PROVIDED" name="typesafe_enum (v0.3.0, RVM: ruby-2.7.4) [gem]" level="application" />
95
- <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.7.4) [gem]" level="application" />
96
- <orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, RVM: ruby-2.7.4) [gem]" level="application" />
97
- <orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.7.7, RVM: ruby-2.7.4) [gem]" level="application" />
98
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
99
- <orderEntry type="library" scope="PROVIDED" name="webmock (v3.14.0, RVM: ruby-2.7.4) [gem]" level="application" />
100
- <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="actionpack (v6.1.4.6, RVM: ruby-2.7.5) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="actionview (v6.1.4.6, RVM: ruby-2.7.5) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.4.6, RVM: ruby-2.7.5) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, RVM: ruby-2.7.5) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="amazing_print (v1.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.5) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="berkeley_library-logging (v0.2.5, RVM: ruby-2.7.5) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="berkeley_library-marc (v0.3.1, RVM: ruby-2.7.5) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="berkeley_library-util (v0.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-2.7.5) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="bundle-audit (v0.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.31, RVM: ruby-2.7.5) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.9.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.5) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, RVM: ruby-2.7.5) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="crack (v0.4.5, RVM: ruby-2.7.5) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, RVM: ruby-2.7.5) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-2.7.5) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, RVM: ruby-2.7.5) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.6, RVM: ruby-2.7.5) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="equivalent-xml (v0.6.0, RVM: ruby-2.7.5) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="erubi (v1.10.0, RVM: ruby-2.7.5) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="hashdiff (v1.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, RVM: ruby-2.7.5) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.4, RVM: ruby-2.7.5) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0, RVM: ruby-2.7.5) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="ice_nine (v0.11.2, RVM: ruby-2.7.5) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="lograge (v0.11.2, RVM: ruby-2.7.5) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="loofah (v2.14.0, RVM: ruby-2.7.5) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="marc (v1.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.4.1, RVM: ruby-2.7.5) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2022.0105, RVM: ruby-2.7.5) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.15.0, RVM: ruby-2.7.5) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.13.1, RVM: ruby-2.7.5) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="oj (v3.13.11, RVM: ruby-2.7.5) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="ougai (v1.9.1, RVM: ruby-2.7.5) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.21.0, RVM: ruby-2.7.5) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="parslet (v2.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
56
+ <orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, RVM: ruby-2.7.5) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="racc (v1.6.0, RVM: ruby-2.7.5) [gem]" level="application" />
58
+ <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="rack-test (v1.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
60
+ <orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
61
+ <orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.4.2, RVM: ruby-2.7.5) [gem]" level="application" />
62
+ <orderEntry type="library" scope="PROVIDED" name="railties (v6.1.4.6, RVM: ruby-2.7.5) [gem]" level="application" />
63
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
64
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.5) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="rchardet (v1.8.0, RVM: ruby-2.7.5) [gem]" level="application" />
66
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.2.1, RVM: ruby-2.7.5) [gem]" level="application" />
67
+ <orderEntry type="library" scope="PROVIDED" name="request_store (v1.5.1, RVM: ruby-2.7.5) [gem]" level="application" />
68
+ <orderEntry type="library" scope="PROVIDED" name="rest-client (v2.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
69
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.5) [gem]" level="application" />
70
+ <orderEntry type="library" scope="PROVIDED" name="roo (v2.8.3, RVM: ruby-2.7.5) [gem]" level="application" />
71
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
72
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
73
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
74
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
75
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
76
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
77
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.15.2, RVM: ruby-2.7.5) [gem]" level="application" />
78
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, RVM: ruby-2.7.5) [gem]" level="application" />
79
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
80
+ <orderEntry type="library" scope="PROVIDED" name="ruby-marc-spec (v0.1.3, RVM: ruby-2.7.5) [gem]" level="application" />
81
+ <orderEntry type="library" scope="PROVIDED" name="ruby-prof (v0.17.0, RVM: ruby-2.7.5) [gem]" level="application" />
82
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
83
+ <orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.3.2, RVM: ruby-2.7.5) [gem]" level="application" />
84
+ <orderEntry type="library" scope="PROVIDED" name="scrub_rb (v1.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
85
+ <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.21.2, RVM: ruby-2.7.5) [gem]" level="application" />
86
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.3, RVM: ruby-2.7.5) [gem]" level="application" />
87
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-rcov (v0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
88
+ <orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.4, RVM: ruby-2.7.5) [gem]" level="application" />
89
+ <orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, RVM: ruby-2.7.5) [gem]" level="application" />
90
+ <orderEntry type="library" scope="PROVIDED" name="typesafe_enum (v0.3.0, RVM: ruby-2.7.5) [gem]" level="application" />
91
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.7.5) [gem]" level="application" />
92
+ <orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, RVM: ruby-2.7.5) [gem]" level="application" />
93
+ <orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.8, RVM: ruby-2.7.5) [gem]" level="application" />
94
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
95
+ <orderEntry type="library" scope="PROVIDED" name="webmock (v3.14.0, RVM: ruby-2.7.5) [gem]" level="application" />
96
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4, RVM: ruby-2.7.5) [gem]" level="application" />
97
+ </component>
98
+ <component name="RModuleSettingsStorage">
99
+ <LOAD_PATH number="2" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" />
100
+ <I18N_FOLDERS number="0" />
101
101
  </component>
102
102
  <component name="RakeTasksCache">
103
103
  <option name="myRootTask">
@@ -110,7 +110,7 @@
110
110
  </RakeTaskImpl>
111
111
  <RakeTaskImpl description="Run all specs in spec directory, with coverage" fullCommand="coverage" id="coverage" />
112
112
  <RakeTaskImpl description="Run tests, check test coverage, check code style, check for vulnerabilities, build gem" fullCommand="default" id="default" />
113
- <RakeTaskImpl description="Build berkeley_library-tind.gemspec as berkeley_library-tind-0.4.0.gem" fullCommand="gem" id="gem" />
113
+ <RakeTaskImpl description="Build berkeley_library-tind.gemspec as berkeley_library-tind-0.4.3.gem" fullCommand="gem" id="gem" />
114
114
  <RakeTaskImpl description="Run RuboCop with auto-correct, and output results to console" fullCommand="ra" id="ra" />
115
115
  <RakeTaskImpl description="Run rubocop with HTML output" fullCommand="rubocop" id="rubocop" />
116
116
  <RakeTaskImpl id="rubocop">
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7
1
+ 2.7.5
data/CHANGES.md CHANGED
@@ -1,3 +1,34 @@
1
+ # 0.5.0 (2022-01-17)
2
+
3
+ - Adds a class `BerkeleyLibrary::TIND::MARC::XMLWriter` to write MARCXML in the format expected by the TIND batch uploader:
4
+
5
+ - MARC leader is written to control field 000 as required by TIND
6
+ - control fields (including the leader) use `\` (0x5c), not space (0x32), for unspecified positional
7
+ values
8
+
9
+ In addition, a `nil` or empty MARC leader is not written at all.
10
+ - Modifies `BerkeleyLibrary::TIND::MARC::XMLReader` to take into account the same peculiarities:
11
+ control field 000 is read into the leader of the MARC record, and slashes in control field values
12
+ (including the leader) are replaced with spaces.
13
+
14
+ # 0.4.3 (2022-01-26)
15
+
16
+ - Pins `berkeley_library-marc` to version 0.3.x (0.3.1 or higher).
17
+ - `BerkeleyLibrary::TIND::XMLReader#new` and `#read`: Fix issue with options/kwargs
18
+ cross-compatibility between Ruby 2.7 and 3.x
19
+ - Adjusts `BerkeleyLibrary::TIND::MARC::XMLReader` to take advantage of proper `freeze:`
20
+ option implementation in `berkeley_library-marc` 3.x.
21
+
22
+ # 0.4.2 (2021-09-23)
23
+
24
+ - Extract `BerkeleyLibrary::Util` module to [separate gem](https://github.com/BerkeleyLibrary/util)
25
+
26
+ # 0.4.1 (2021-08-26)
27
+
28
+ - Add explicit double splat to prevent
29
+ `BerkeleyLibrary::TIND::Search.perform_single_search` from raising
30
+ `ArgumentError` on Ruby 3+ due to positional / keyword ambiguity
31
+
1
32
  # 0.4.0 (2021-08-19)
2
33
 
3
34
  - Rename to `BerkeleyLibrary::TIND` in prep for move to GitHub
@@ -18,7 +49,8 @@
18
49
  # 0.3.0 (2021-05-11)
19
50
 
20
51
  - Extracts `MARCExtensions` into a separate gem,
21
- [`ucblit-marc`](https://git.lib.berkeley.edu/lap/ucblit-marc/edit).
52
+ [`ucblit-marc`](https://git.lib.berkeley.edu/lap/ucblit-marc).
53
+ - *Note:* As of August 2021 this is now [berkeley_library-marc](https://rubygems.org/gems/berkeley_library-marc).
22
54
 
23
55
  # 0.2.4 (2021-05-06)
24
56
 
data/README.md CHANGED
@@ -1,10 +1,24 @@
1
1
  # BerkeleyLibrary::TIND
2
2
 
3
3
  [![Build Status](https://github.com/BerkeleyLibrary/tind/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/BerkeleyLibrary/tind/actions/workflows/build.yml)
4
- [![Gem Version](https://img.shields.io/gem/v/berkeley_library-tind.svg)](https://github.com/BerkeleyLibrary/tind/releases)
4
+ [![Gem Version](https://img.shields.io/gem/v/berkeley_library-tind.svg)](https://rubygems.org/gems/berkeley_library-tind)
5
5
 
6
6
  Utility gem for working with the TIND DA digital archive.
7
7
 
8
+ ## Installation
9
+
10
+ In your Gemfile:
11
+
12
+ ```ruby
13
+ gem 'berkeley_library-tind'
14
+ ```
15
+
16
+ In your code:
17
+
18
+ ```ruby
19
+ require 'berkeley_library/tind'
20
+ ```
21
+
8
22
  ## Configuration
9
23
 
10
24
  To access the TIND API, you will need to set:
@@ -24,7 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.required_ruby_version = ruby_version
25
25
 
26
26
  spec.add_dependency 'berkeley_library-logging', '~> 0.2'
27
- spec.add_dependency 'berkeley_library-marc', '~> 0.2'
27
+ spec.add_dependency 'berkeley_library-marc', '~> 0.3.0', '>= 0.3.1'
28
+ spec.add_dependency 'berkeley_library-util', '~> 0.1'
28
29
  spec.add_dependency 'ice_nine', '~> 0.11'
29
30
  spec.add_dependency 'marc', '~> 1.0'
30
31
  spec.add_dependency 'rchardet', '~> 1.8'
@@ -36,7 +37,7 @@ Gem::Specification.new do |spec|
36
37
  spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
37
38
  spec.add_development_dependency 'colorize', '~> 0.8'
38
39
  spec.add_development_dependency 'dotenv', '~> 2.7'
39
- spec.add_development_dependency 'listen', '>= 3.0.5', '< 3.2'
40
+ spec.add_development_dependency 'equivalent-xml', '~> 0.6'
40
41
  spec.add_development_dependency 'rake', '~> 13.0'
41
42
  spec.add_development_dependency 'roo', '~> 2.8'
42
43
  spec.add_development_dependency 'rspec', '~> 3.10'
@@ -2,7 +2,7 @@ require 'stringio'
2
2
  require 'open-uri'
3
3
 
4
4
  require 'berkeley_library/util/uris'
5
- require 'berkeley_library/util/logging'
5
+ require 'berkeley_library/logging'
6
6
  require 'berkeley_library/tind/config'
7
7
  require 'berkeley_library/tind/api/api_exception'
8
8
 
@@ -105,16 +105,22 @@ module BerkeleyLibrary
105
105
  private
106
106
 
107
107
  def do_get(endpoint_uri, params)
108
- raise APIKeyNotSet.new(endpoint_uri, params) if Config.blank?(api_key)
109
-
110
- begin
111
- URIs.get(endpoint_uri, params, {
112
- 'Authorization' => "Token #{api_key}",
113
- 'User-Agent' => user_agent
114
- })
115
- rescue RestClient::RequestFailed => e
116
- raise APIException.wrap(e, url: endpoint_uri, params: params)
117
- end
108
+ headers = auth_headers(endpoint_uri, params)
109
+ URIs.get(endpoint_uri, params: params, headers: headers)
110
+ rescue RestClient::RequestFailed => e
111
+ raise APIException.wrap(e, url: endpoint_uri, params: params)
112
+ end
113
+
114
+ def auth_headers(endpoint_uri, params)
115
+ key = ensure_api_key(endpoint_uri, params)
116
+ {
117
+ 'Authorization' => "Token #{key}",
118
+ 'User-Agent' => user_agent
119
+ }
120
+ end
121
+
122
+ def ensure_api_key(endpoint_uri, params)
123
+ api_key.tap { |k| raise APIKeyNotSet.new(endpoint_uri, params) if Config.blank?(k) }
118
124
  end
119
125
 
120
126
  # TODO: make real body streaming work
@@ -1,5 +1,5 @@
1
1
  require 'json'
2
- require 'berkeley_library/util/logging'
2
+ require 'berkeley_library/logging'
3
3
  require 'berkeley_library/tind/api/api_exception'
4
4
 
5
5
  module BerkeleyLibrary
@@ -1,4 +1,4 @@
1
- require 'berkeley_library/util/logging'
1
+ require 'berkeley_library/logging'
2
2
  require 'berkeley_library/tind/marc/xml_reader'
3
3
  require 'berkeley_library/tind/api/date_range'
4
4
  require 'berkeley_library/tind/api/format'
@@ -66,7 +66,7 @@ module BerkeleyLibrary
66
66
  end
67
67
 
68
68
  def perform_single_search(params, freeze, &block)
69
- API.get(:search, params) do |body|
69
+ API.get(:search, **params) do |body|
70
70
  process_body(body, freeze, &block)
71
71
  ensure
72
72
  body.close
@@ -1,4 +1,4 @@
1
- require 'berkeley_library/util/logging'
1
+ require 'berkeley_library/logging'
2
2
  require 'berkeley_library/tind/api/search'
3
3
  require 'berkeley_library/tind/export/table'
4
4
 
@@ -2,7 +2,7 @@ require 'csv'
2
2
  require 'stringio'
3
3
 
4
4
  require 'marc_extensions'
5
- require 'berkeley_library/util/logging'
5
+ require 'berkeley_library/logging'
6
6
  require 'berkeley_library/tind/export/column_group_list'
7
7
 
8
8
  module BerkeleyLibrary
@@ -1,4 +1,4 @@
1
- require 'berkeley_library/util/logging'
1
+ require 'berkeley_library/logging'
2
2
  require 'berkeley_library/tind/export/row_metrics'
3
3
  require 'berkeley_library/tind/export/config'
4
4
 
@@ -0,0 +1,62 @@
1
+ require 'nokogiri'
2
+
3
+ module BerkeleyLibrary
4
+ module TIND
5
+ module MARC
6
+ class XMLBuilder
7
+ attr_reader :marc_record
8
+
9
+ def initialize(marc_record)
10
+ @marc_record = marc_record
11
+ end
12
+
13
+ def build
14
+ builder.doc.root.tap(&:unlink)
15
+ end
16
+
17
+ private
18
+
19
+ def builder
20
+ Nokogiri::XML::Builder.new do |xml|
21
+ xml.record do
22
+ add_leader(xml)
23
+ marc_record.each_control_field { |cf| add_control_field(xml, cf) }
24
+ marc_record.each_data_field { |df| add_data_field(xml, df) }
25
+ end
26
+ end
27
+ end
28
+
29
+ def add_leader(xml)
30
+ leader = marc_record.leader
31
+ return if leader.nil? || leader == ''
32
+
33
+ # TIND uses <controlfield tag="000"/> instead of <leader/>
34
+ leader_as_cf = ::MARC::ControlField.new('000', clean_leader(leader))
35
+ add_control_field(xml, leader_as_cf)
36
+ end
37
+
38
+ def add_data_field(xml, df)
39
+ xml.datafield(tag: df.tag, ind1: df.indicator1, ind2: df.indicator2) do
40
+ df.subfields.each do |sf|
41
+ xml.subfield(sf.value, code: sf.code)
42
+ end
43
+ end
44
+ end
45
+
46
+ def add_control_field(xml, cf)
47
+ # TIND uses \ (0x5c), not space (0x32), for unspecified values in positional fields
48
+ value = cf.value&.gsub(' ', '\\')
49
+ xml.controlfield(value, tag: cf.tag)
50
+ end
51
+
52
+ def clean_leader(leader)
53
+ leader.gsub(/[^\w|^\s]/, 'Z').tap do |ldr|
54
+ ldr[20..23] = '4500' unless ldr[20..23] == '4500'
55
+ ldr[6..6] = 'Z' if ldr[6..6] == ' '
56
+ end
57
+ end
58
+
59
+ end
60
+ end
61
+ end
62
+ end