umlaut-primo 0.1.0 → 0.1.2
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 +15 -0
- data/Rakefile +1 -19
- data/lib/umlaut_primo/primo_service.rb +9 -9
- data/lib/umlaut_primo/version.rb +1 -1
- data/test/dummy/log/test.log +17234 -0
- data/test/fixtures/referent_values.yml +32 -0
- data/test/fixtures/referents.yml +3 -0
- data/test/fixtures/requests.yml +3 -0
- data/test/unit/primo_service_test.rb +30 -0
- data/test/vcr_cassettes/russkaia_pochta_with_no_title_by_issn.yml +187 -0
- metadata +46 -54
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDZiNzE1ZTk1MDQ4MDlkNGUyZDA5NjBmMTFmNWFjYzQ4NzQzODg3Yw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NTQxYjAyZmUxNDNmYjM0ZWVlOTljZDU4MzY2Zjk3NDVjYjQ0MjJhYg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzhmZmE1ZmEyZjZmYzViN2RhODQ1YzNiNDBmYTBhOWZiYWFjYTZlOTc4YmYx
|
10
|
+
MjQzZDcyZmJkZmI0ZmU0NDM1NTYzYjA1YTRkNWVjYWUxYzkzMzgwMTMyZTNj
|
11
|
+
NjU4ZjFkZTg0NDJiY2U0Njg2NWE1MmZkNmE1YmQxNmJhMzFlZjE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjM2YThlYzEyN2RhZmE5NDM3ZDYzNDcyMTI4N2VlZDUzOTIzNzBiMWEwZmIz
|
14
|
+
NGFlZWNjNjA1YTE5OTlkZjBlYzNmNzg0ZThiYjhmZDIwODBkMmUyMzMwMTlj
|
15
|
+
ZWUxMzVhMTNjMjRkNDA0NDg5YTNkNWIyMjgwNzRmOTlmMjc1YTY=
|
data/Rakefile
CHANGED
@@ -4,26 +4,9 @@ begin
|
|
4
4
|
rescue LoadError
|
5
5
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
6
|
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
14
|
-
|
15
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'Umlaut Primo Service Adaptor'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
|
-
|
23
7
|
Bundler::GemHelper.install_tasks
|
24
8
|
|
25
9
|
require 'rake/testtask'
|
26
|
-
|
27
10
|
Rake::TestTask.new(:test) do |t|
|
28
11
|
t.libs << 'lib'
|
29
12
|
t.libs << 'test'
|
@@ -31,5 +14,4 @@ Rake::TestTask.new(:test) do |t|
|
|
31
14
|
'test/**/*_test.rb', 'test/**/**/*_test.rb']
|
32
15
|
t.verbose = false
|
33
16
|
end
|
34
|
-
|
35
|
-
task :default => :test
|
17
|
+
task :default => :test
|
@@ -79,7 +79,7 @@
|
|
79
79
|
# used in the case where an ezproxy prefix (on any other regexp) is hardcoded in the URL,
|
80
80
|
# and needs to be removed in order to match against SFXUrls.
|
81
81
|
# Example:
|
82
|
-
# !ruby/regexp '/https\:\/\/ezproxy\.library\.
|
82
|
+
# !ruby/regexp '/https\:\/\/ezproxy\.library\.edu\/login\?url=/'
|
83
83
|
# primo_config:: _optional_ string representing the primo yaml config file in config/
|
84
84
|
# default file name: primo.yml
|
85
85
|
# hash mappings from yaml config
|
@@ -181,23 +181,23 @@ class PrimoService < Service
|
|
181
181
|
# ISBN OR
|
182
182
|
# ISSN OR
|
183
183
|
# Title and author and genre
|
184
|
-
if @record_id
|
184
|
+
if((not @record_id.blank?))
|
185
185
|
search.record_id! @record_id
|
186
|
-
elsif @isbn
|
186
|
+
elsif((not @isbn.blank?))
|
187
187
|
search.isbn_is @isbn
|
188
|
-
elsif @issn
|
188
|
+
elsif((not @issn.blank?))
|
189
189
|
search.isbn_is @issn
|
190
|
-
elsif @title and @author and @genre
|
191
|
-
search.title_is(@title).creator_is(@author).
|
190
|
+
elsif((not @title.blank?) and (not @author.blank?) and (not @genre.blank?))
|
191
|
+
search.title_is(@title).creator_is(@author).any_is(@genre)
|
192
192
|
else # Don't do a search.
|
193
193
|
return request.dispatched(self, true)
|
194
194
|
end
|
195
195
|
|
196
196
|
begin
|
197
197
|
records = search.records
|
198
|
-
# Enhance the referent with metadata from Primo Searcher if Primo record id
|
199
|
-
# i.e. if we did our search with
|
200
|
-
if @record_id and @service_types.include?("referent_enhance")
|
198
|
+
# Enhance the referent with metadata from Primo Searcher if Primo record id, ISSN
|
199
|
+
# or ISBN is present i.e. if we did our search with a Primo ID number
|
200
|
+
if (not (@record_id.blank? and @issn.blank? and @isbn.blank?)) and @service_types.include?("referent_enhance")
|
201
201
|
# We'll take the first record, since there should only be one.
|
202
202
|
enhance_referent(request, records.first)
|
203
203
|
end
|
data/lib/umlaut_primo/version.rb
CHANGED