gared 0.0.13 → 0.0.14
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.
- checksums.yaml +4 -4
- data/lib/gared/aleph.rb +2 -2
- data/lib/gared/googlebooks.rb +2 -2
- data/lib/gared/hebrewbooks.rb +2 -2
- data/lib/gared/idea.rb +2 -2
- data/lib/gared/primo.rb +2 -2
- data/lib/gared/publication.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 286e7492b38fde6e12e7bc5bbe47828e970328c134b82edef3e2313c52351237
|
4
|
+
data.tar.gz: 4d51a740a2c4c62f15a0a2c02955d5ac17148e9e0db0274e4d91471f7ddae2fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeddb91957ab79ae8b1926bca68b50106d014f04e7c0b6b264f4642153be2545f2fcc5f938bfc9fb93afe7b5162fd6de93fa8f1d080a9ead24c29127439cffe9
|
7
|
+
data.tar.gz: f8e39a2ce1b525fc315155b42fe57329e08ae10b6154465afded022f37a9d4a3587091a38e0ca519950d49c6b5e2d27f2a74cfec511dad07fc8f14aac086e02c
|
data/lib/gared/aleph.rb
CHANGED
@@ -33,7 +33,7 @@ module Gared
|
|
33
33
|
def query_publication(publication)
|
34
34
|
end
|
35
35
|
|
36
|
-
def query_publications_by_person(person)
|
36
|
+
def query_publications_by_person(person, ctx = nil)
|
37
37
|
ZOOM::Connection.open(@options[:host], @options[:port]) do |conn|
|
38
38
|
conn.database_name = @options[:database] # 'aleph.nli.org.il',9991
|
39
39
|
conn.preferred_record_syntax = @options[:syntax]
|
@@ -45,7 +45,7 @@ module Gared
|
|
45
45
|
xml = Nokogiri::Slop(r.xml)
|
46
46
|
xml.remove_namespaces! # keeps biting me :)
|
47
47
|
# these scrapes are based on the National Library of Israel usage. No attempt to make it generic. :)
|
48
|
-
p = Publication.new
|
48
|
+
p = Publication.new(ctx)
|
49
49
|
begin
|
50
50
|
p.author_line = xml.xpath('//datafield[@tag=\'100\']/subfield[@code=\'a\']')[0].text
|
51
51
|
# puts "author: #{p.author_line}" # DEBUG
|
data/lib/gared/googlebooks.rb
CHANGED
@@ -6,7 +6,7 @@ module Gared
|
|
6
6
|
@options = {api_key: api_key, maxResults: page_size}
|
7
7
|
end
|
8
8
|
|
9
|
-
def query_publications_by_person(person)
|
9
|
+
def query_publications_by_person(person, ctx = nil)
|
10
10
|
url = "https://www.googleapis.com/books/v1/volumes?q=inauthor:#{URI.escape(person)}&filter=full&key=#{@options[:api_key]}&maxResults=#{@options[:maxResults]}"
|
11
11
|
resp = JSON.parse(RestClient.get(url))
|
12
12
|
|
@@ -23,7 +23,7 @@ module Gared
|
|
23
23
|
end
|
24
24
|
recs.each do |r|
|
25
25
|
next unless r['accessInfo']['pdf']['isAvailable']
|
26
|
-
p = Publication.new
|
26
|
+
p = Publication.new(ctx)
|
27
27
|
p.source_id = r['id']
|
28
28
|
p.title = r['volumeInfo']['title']
|
29
29
|
h = Holding.new
|
data/lib/gared/hebrewbooks.rb
CHANGED
@@ -18,7 +18,7 @@ module Gared
|
|
18
18
|
def query_publication(publication)
|
19
19
|
end
|
20
20
|
|
21
|
-
def query_publications_by_person(person)
|
21
|
+
def query_publications_by_person(person, ctx = nil)
|
22
22
|
@browser.goto 'http://hebrewbooks.org/home.aspx'
|
23
23
|
@browser.wait
|
24
24
|
t = @browser.text_field(id: 'cpMstr_author')
|
@@ -29,7 +29,7 @@ module Gared
|
|
29
29
|
ret = []
|
30
30
|
if trs.size > 0
|
31
31
|
trs.each do |tr|
|
32
|
-
p = Publication.new
|
32
|
+
p = Publication.new(ctx)
|
33
33
|
p.title = tr.tds[0].text
|
34
34
|
p.author_line = tr.tds[1].text
|
35
35
|
p.source_id = tr.tds[0].a.href
|
data/lib/gared/idea.rb
CHANGED
@@ -19,7 +19,7 @@ module Gared
|
|
19
19
|
def query_publication(publication)
|
20
20
|
end
|
21
21
|
|
22
|
-
def query_publications_by_person(person)
|
22
|
+
def query_publications_by_person(person, ctx = nil)
|
23
23
|
@browser.goto @options[:opac_url]
|
24
24
|
@browser.wait
|
25
25
|
t = @browser.text_field(id: 'get_var_0')
|
@@ -38,7 +38,7 @@ module Gared
|
|
38
38
|
trs.each do |tr|
|
39
39
|
item = tr.tr.tds[1]
|
40
40
|
urlpart = item.h5.a.href
|
41
|
-
p = Publication.new
|
41
|
+
p = Publication.new(ctx)
|
42
42
|
p.title = item.ps[0].text # first line is always the title. After that, all bets are off...
|
43
43
|
item.ps.each{|para|
|
44
44
|
st = para.text.strip
|
data/lib/gared/primo.rb
CHANGED
@@ -20,7 +20,7 @@ module Gared
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# return in-memory Publication instances with associated Holdings
|
23
|
-
def query_publications_by_person(person)
|
23
|
+
def query_publications_by_person(person, ctx = nil)
|
24
24
|
ret = []
|
25
25
|
begin
|
26
26
|
url = @options[:url]+"?institution=#{@options[:institution]}&query=creator,contains,#{URI.escape(person)}&indx=1&bulkSize=50&query=facet_rtype,exact,books}&json=true"
|
@@ -37,7 +37,7 @@ module Gared
|
|
37
37
|
end
|
38
38
|
recs.each do |r|
|
39
39
|
deets = r['PrimoNMBib']['record']['display']
|
40
|
-
p = Publication.new
|
40
|
+
p = Publication.new(ctx)
|
41
41
|
p.title = deets['title']
|
42
42
|
p.author_line = deets['creator']
|
43
43
|
p.language = deets['language']
|
data/lib/gared/publication.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Gared
|
2
2
|
class Publication
|
3
3
|
|
4
|
-
attr_accessor :title, :publisher_line, :author_line, :notes, :source_id, :holdings, :language, :pub_year
|
4
|
+
attr_accessor :title, :publisher_line, :author_line, :notes, :source_id, :holdings, :language, :pub_year, :context
|
5
5
|
|
6
|
-
def initialize
|
6
|
+
def initialize(ctx)
|
7
7
|
@holdings = []
|
8
|
+
self.context = ctx
|
8
9
|
end
|
9
10
|
|
10
11
|
def add_holding(holding)
|
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.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Asaf Bartov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zoom
|