gared 0.0.28 → 0.0.29

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gared/primo.rb +12 -2
  3. data/test/test_gared.rb +11 -11
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f22677bcf110b745ab91eff743bec77b61da5c8a8bc621d5ca9d01cedb3f3884
4
- data.tar.gz: 8c2c1ee16db5008fc2952376767d892700db64283597af81c3f5469a9a1505dd
3
+ metadata.gz: 5a4f6f4cbc307c097bf84e4308d7cc76257583ba58f97d0c861ebd79e1e362e6
4
+ data.tar.gz: 83aca016e843de3bbdbdfbeecdf1b4b544a376d3205970a810c5076ce3d3466e
5
5
  SHA512:
6
- metadata.gz: e499ca87b0ee1c1fef99c225bbdee3f73e38b8bfa6535eb6fcb955b4eec1abdec6b28104f4ac38db05ed32e7e67152baa518992bba89ad8c7bfa1326854ff097
7
- data.tar.gz: 16a97a64cf82de5998d5a816755e94ced98d5d4e084eeacbea2cb2fc4f6b651add34b6801f26847d5577a52e29014d93d5c6166899ecad7e5325a304139c57bb
6
+ metadata.gz: 686d91870739b68c421f68c3a55fd8443dec0f4747118137d0cd256758e67e223c9db5617c7cbd408a4295c32936741172f8865dd96c1303a318841ff4157a41
7
+ data.tar.gz: 85336cda8af09b48fa3515d90efb5898dbe28592282c17ce3f352cde96ba459aa50a9cab7c2b32c6d32df4afe52a547d7a999a02a19eb4c4edf28e5beff729fd
data/lib/gared/primo.rb CHANGED
@@ -53,14 +53,24 @@ module Gared
53
53
  # collect additional URLS from record, for clients to be able to determine whether a scanned object exists
54
54
  additional_urls = []
55
55
  deets.keys.each do |key|
56
- additional_urls << deets[key] if deets[key] =~ /https?:[^\s]/
56
+ if deets[key].class == Array
57
+ deets[key].each do |kkey|
58
+ additional_urls << kkey if kkey.class == String && kkey =~ /https?:[^\s]/
59
+ end
60
+ elsif deets[key].class == String
61
+ additional_urls << deets[key] if deets[key] =~ /https?:[^\s]/
62
+ end
57
63
  end
58
64
  p.additional_urls = additional_urls if additional_urls.length > 0
59
65
  h = Holding.new
60
66
  h.source_id = p.source_id
61
67
  h.source_name = 'Primo:'+@options[:institution]
62
68
 
63
- h.location = r['LIBRARIES']['LIBRARY'][0].nil? ? r['LIBRARIES']['LIBRARY']['callNumber'] : r['LIBRARIES']['LIBRARY'][0]['callNumber'] # there seem to be two cases, different between NLI and TAU, for example
69
+ begin
70
+ h.location = r['LIBRARIES']['LIBRARY'][0].nil? ? r['LIBRARIES']['LIBRARY']['callNumber'] : r['LIBRARIES']['LIBRARY'][0]['callNumber'] # there seem to be two cases, different between NLI and TAU, for example; there also seems to not even be a LIBRARIES key for some electronic resources. We're skipping those.
71
+ rescue Exception
72
+ puts $!
73
+ end
64
74
  p.add_holding(h)
65
75
  ret << p
66
76
  rescue Exception
data/test/test_gared.rb CHANGED
@@ -10,7 +10,7 @@ class GaredTest < Minitest::Test
10
10
  return
11
11
  end
12
12
  puts "Testing NLI API"
13
- byebug
13
+ #byebug
14
14
  nli = Gared::Nli_Api.new('https://api.nli.org.il/openlibrary/search', ENV['NLI_API_KEY'])
15
15
  refute_nil nli
16
16
  #recs = nli.query_publications_by_person('ביאליק')
@@ -20,16 +20,16 @@ class GaredTest < Minitest::Test
20
20
  refute_empty(recs[0].title)
21
21
  end
22
22
 
23
- # temporarily disabled until we find another Primo server to test against
24
- # def test_primo_query_publications_by_person
25
- # puts "Testing Primo"
26
- # primo = Gared::Primo.new('http://primo.nli.org.il/PrimoWebServices/xservice/search/brief', 'NNL')
27
- # refute_nil primo
28
- # recs = primo.query_publications_by_person('אילנאה')
29
- # refute_nil recs
30
- # refute_empty(recs)
31
- # refute_empty(recs[0].title)
32
- # end
23
+ # temporarily disabled until we find another Primo server to test against
24
+ def test_primo_query_publications_by_person
25
+ puts "Testing Primo"
26
+ primo = Gared::Primo.new('http://tau-primo.hosted.exlibrisgroup.com/PrimoWebServices/xservice/search/brief', 'TAU')
27
+ refute_nil primo
28
+ recs = primo.query_publications_by_person('אילנאה')
29
+ refute_nil recs
30
+ refute_empty(recs)
31
+ refute_empty(recs[0].title)
32
+ end
33
33
 
34
34
  def test_googlebooks_query_publications_by_person
35
35
  if ENV['GOOGLE_API_KEY'].nil?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asaf Bartov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-28 00:00:00.000000000 Z
11
+ date: 2023-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
- rubygems_version: 3.2.32
105
+ rubygems_version: 3.4.10
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Scrape Hebrew bibliography sources