bento_search 0.8.0 → 0.9.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 (44) hide show
  1. data/README.md +16 -2
  2. data/app/helpers/bento_search_helper.rb +4 -10
  3. data/app/item_decorators/bento_search/decorator_base.rb +17 -0
  4. data/app/item_decorators/bento_search/standard_decorator.rb +3 -3
  5. data/app/models/bento_search/link.rb +3 -0
  6. data/app/models/bento_search/result_item.rb +17 -1
  7. data/app/models/bento_search/results.rb +5 -0
  8. data/app/models/bento_search/ris_creator.rb +166 -0
  9. data/app/models/bento_search/search_engine.rb +22 -2
  10. data/app/search_engines/bento_search/ebsco_host_engine.rb +54 -6
  11. data/app/search_engines/bento_search/eds_engine.rb +18 -3
  12. data/app/search_engines/bento_search/google_books_engine.rb +81 -54
  13. data/app/search_engines/bento_search/mock_engine.rb +8 -0
  14. data/app/search_engines/bento_search/primo_engine.rb +6 -2
  15. data/app/search_engines/bento_search/scopus_engine.rb +4 -0
  16. data/app/search_engines/bento_search/summon_engine.rb +26 -4
  17. data/app/search_engines/bento_search/worldcat_sru_dc_engine.rb +15 -0
  18. data/app/views/bento_search/_link.html.erb +3 -2
  19. data/lib/bento_search/version.rb +1 -1
  20. data/test/dummy/app/views/_test_custom_item_partial.html.erb +9 -0
  21. data/test/dummy/log/development.log +1 -0
  22. data/test/dummy/log/test.log +84981 -0
  23. data/test/helper/bento_search_helper_test.rb +11 -1
  24. data/test/unit/ebsco_host_engine_test.rb +59 -0
  25. data/test/unit/eds_engine_test.rb +10 -0
  26. data/test/unit/google_books_engine_test.rb +20 -0
  27. data/test/unit/primo_engine_test.rb +1 -1
  28. data/test/unit/ris_creator_test.rb +159 -0
  29. data/test/unit/scopus_engine_test.rb +2 -0
  30. data/test/unit/search_engine_test.rb +37 -0
  31. data/test/unit/summon_engine_test.rb +21 -0
  32. data/test/unit/worldcat_sru_dc_engine_test.rb +151 -0
  33. data/test/vcr_cassettes/ebscohost/live__get_identifier__round_trip.yml +1324 -0
  34. data/test/vcr_cassettes/ebscohost/live_get_id__on_bad_db_raises.yml +45 -0
  35. data/test/vcr_cassettes/ebscohost/live_get_id__with_no_results_raises.yml +45 -0
  36. data/test/vcr_cassettes/gbs/live_get_id_.yml +415 -0
  37. data/test/vcr_cassettes/gbs/live_get_id__with_not_found_id.yml +41 -0
  38. data/test/vcr_cassettes/summon/live__get_id_.yml +313 -0
  39. data/test/vcr_cassettes/summon/live_get_id__on_non-existing_id.yml +54 -0
  40. data/test/vcr_cassettes/worldcat_sru_dc/live_get_id_.yml +769 -0
  41. data/test/vcr_cassettes/worldcat_sru_dc/live_get_id__for_bad_id.yml +68 -0
  42. data/test/view/link_test.rb +21 -0
  43. metadata +31 -6
  44. data/test/vcr_cassettes/max_out_pagination.yml +0 -155
@@ -0,0 +1,68 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://www.worldcat.org/webservices/catalog/search/sru?maximumRecords=10&query=srw.no%20=%20%22NOT%22%20AND%20srw.no%20=%20%22EXISTING%22&recordSchema=info:srw/schema/1/dc&wskey=DUMMY_API_KEY
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: !binary |-
14
+ T0s=
15
+ headers:
16
+ !binary "RGF0ZQ==":
17
+ - !binary |-
18
+ VGh1LCAwMyBKYW4gMjAxMyAwMDozMTo1NCBHTVQ=
19
+ !binary "U2VydmVy":
20
+ - !binary |-
21
+ QXBhY2hl
22
+ !binary "Q29udGVudC1MZW5ndGg=":
23
+ - !binary |-
24
+ OTUx
25
+ !binary "Q29udGVudC1UeXBl":
26
+ - !binary |-
27
+ dGV4dC94bWw7Y2hhcnNldD11dGYtOA==
28
+ body:
29
+ encoding: US-ASCII
30
+ string: ! '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
31
+
32
+ <?xml-stylesheet type="text/xsl" href="/webservices/catalog/xsl/searchRetrieveResponse.xsl"?>
33
+
34
+
35
+ <searchRetrieveResponse xmlns="http://www.loc.gov/zing/srw/" xmlns:oclcterms="http://purl.org/oclc/terms/"
36
+ xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:diag="http://www.loc.gov/zing/srw/diagnostic/"
37
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
38
+
39
+ <version>1.1</version>
40
+
41
+ <numberOfRecords>0</numberOfRecords>
42
+
43
+ <echoedSearchRetrieveRequest xmlns:srw="http://www.loc.gov/zing/srw/">
44
+
45
+ <version>1.1</version>
46
+
47
+ <query>srw.no = "NOT" AND srw.no = "EXISTING"</query>
48
+
49
+ <maximumRecords>10</maximumRecords>
50
+
51
+ <recordSchema>info:srw/schema/1/dc</recordSchema>
52
+
53
+ <recordPacking>xml</recordPacking>
54
+
55
+ <startRecord>1</startRecord>
56
+
57
+ <sortKeys>relevance</sortKeys>
58
+
59
+ <wskey>DUMMY_API_KEY</wskey>
60
+
61
+ </echoedSearchRetrieveRequest>
62
+
63
+ </searchRetrieveResponse>
64
+
65
+ '
66
+ http_version:
67
+ recorded_at: Thu, 03 Jan 2013 00:31:55 GMT
68
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ class LinkTest < ActionView::TestCase
4
+
5
+ def test_link_target
6
+ link = BentoSearch::Link.new(:label => "foo", :url => "/foo", :target => "custom_target")
7
+
8
+ render "bento_search/link", :link => link
9
+
10
+ assert_select("a[target=custom_target]")
11
+ end
12
+
13
+ def test_link_no_target
14
+ link = BentoSearch::Link.new(:label => "foo", :url => "/foo")
15
+
16
+ render "bento_search/link", :link => link
17
+
18
+ assert_select("a[target]", :count => 0)
19
+ end
20
+
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bento_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-27 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -222,6 +222,7 @@ files:
222
222
  - app/models/bento_search/search_engine/capabilities.rb
223
223
  - app/models/bento_search/registrar.rb
224
224
  - app/models/bento_search/multi_searcher.rb
225
+ - app/models/bento_search/ris_creator.rb
225
226
  - app/models/bento_search/result_item.rb
226
227
  - app/models/bento_search/results/pagination.rb
227
228
  - app/models/bento_search/openurl_creator.rb
@@ -265,12 +266,14 @@ files:
265
266
  - MIT-LICENSE
266
267
  - Rakefile
267
268
  - README.md
269
+ - test/view/link_test.rb
268
270
  - test/view/std_item_test.rb
269
271
  - test/support/test_with_cassette.rb
270
272
  - test/integration/navigation_test.rb
271
273
  - test/dummy/app/controllers/application_controller.rb
272
274
  - test/dummy/app/assets/javascripts/application.js
273
275
  - test/dummy/app/assets/stylesheets/application.css
276
+ - test/dummy/app/views/_test_custom_item_partial.html.erb
274
277
  - test/dummy/app/views/layouts/application.html.erb
275
278
  - test/dummy/app/helpers/application_helper.rb
276
279
  - test/dummy/public/404.html
@@ -305,7 +308,11 @@ files:
305
308
  - test/vcr_cassettes/summon/proper_tags_for_snippets.yml
306
309
  - test/vcr_cassettes/summon/search.yml
307
310
  - test/vcr_cassettes/summon/bad_auth.yml
311
+ - test/vcr_cassettes/summon/live__get_id_.yml
312
+ - test/vcr_cassettes/summon/live_get_id__on_non-existing_id.yml
308
313
  - test/vcr_cassettes/xerxes/live_search.yml
314
+ - test/vcr_cassettes/worldcat_sru_dc/live_get_id__for_bad_id.yml
315
+ - test/vcr_cassettes/worldcat_sru_dc/live_get_id_.yml
309
316
  - test/vcr_cassettes/worldcat_sru_dc/smoke_test.yml
310
317
  - test/vcr_cassettes/worldcat_sru_dc/max_out_pagination.yml
311
318
  - test/vcr_cassettes/primo/search_smoke_test.yml
@@ -314,6 +321,7 @@ files:
314
321
  - test/vcr_cassettes/ebscohost/live_search.yml
315
322
  - test/vcr_cassettes/ebscohost/fulltext_info.yml
316
323
  - test/vcr_cassettes/ebscohost/error_bad_db.yml
324
+ - test/vcr_cassettes/ebscohost/live_get_id__on_bad_db_raises.yml
317
325
  - test/vcr_cassettes/ebscohost/live_pathological_book_item_example.yml
318
326
  - test/vcr_cassettes/ebscohost/error_bad_password.yml
319
327
  - test/vcr_cassettes/ebscohost/dissertation_example.yml
@@ -321,6 +329,8 @@ files:
321
329
  - test/vcr_cassettes/ebscohost/get_info.yml
322
330
  - test/vcr_cassettes/ebscohost/live_book_example.yml
323
331
  - test/vcr_cassettes/ebscohost/live_search_smoke_test.yml
332
+ - test/vcr_cassettes/ebscohost/live__get_identifier__round_trip.yml
333
+ - test/vcr_cassettes/ebscohost/live_get_id__with_no_results_raises.yml
324
334
  - test/vcr_cassettes/eds/basic_search_smoke_test.yml
325
335
  - test/vcr_cassettes/eds/get_auth_token.yml
326
336
  - test/vcr_cassettes/eds/get_auth_token_failure.yml
@@ -337,11 +347,13 @@ files:
337
347
  - test/vcr_cassettes/scopus/bad_api_key_should_return_error_response.yml
338
348
  - test/vcr_cassettes/scopus/escaped_chars.yml
339
349
  - test/vcr_cassettes/scopus/zero_results_search.yml
340
- - test/vcr_cassettes/max_out_pagination.yml
341
350
  - test/vcr_cassettes/gbs/pagination.yml
342
351
  - test/vcr_cassettes/gbs/error_condition.yml
352
+ - test/vcr_cassettes/gbs/live_get_id_.yml
343
353
  - test/vcr_cassettes/gbs/search.yml
344
354
  - test/vcr_cassettes/gbs/empty_results.yml
355
+ - test/vcr_cassettes/gbs/live_get_id__with_not_found_id.yml
356
+ - test/unit/ris_creator_test.rb
345
357
  - test/unit/eds_engine_test.rb
346
358
  - test/unit/result_item_test.rb
347
359
  - test/unit/item_decorators_test.rb
@@ -349,6 +361,7 @@ files:
349
361
  - test/unit/google_site_search_test.rb
350
362
  - test/unit/search_engine_test.rb
351
363
  - test/unit/search_engine_base_test.rb
364
+ - test/unit/worldcat_sru_dc_engine_test.rb
352
365
  - test/unit/register_engine_test.rb
353
366
  - test/unit/google_books_engine_test.rb
354
367
  - test/unit/summon_engine_test.rb
@@ -377,7 +390,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
377
390
  version: '0'
378
391
  segments:
379
392
  - 0
380
- hash: -2218214500238866825
393
+ hash: -2756145825252285045
381
394
  required_rubygems_version: !ruby/object:Gem::Requirement
382
395
  none: false
383
396
  requirements:
@@ -386,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
386
399
  version: '0'
387
400
  segments:
388
401
  - 0
389
- hash: -2218214500238866825
402
+ hash: -2756145825252285045
390
403
  requirements: []
391
404
  rubyforge_project:
392
405
  rubygems_version: 1.8.24
@@ -395,12 +408,14 @@ specification_version: 3
395
408
  summary: An abstraction/normalization layer for querying and displaying results for
396
409
  external search engines, in Ruby on Rails.
397
410
  test_files:
411
+ - test/view/link_test.rb
398
412
  - test/view/std_item_test.rb
399
413
  - test/support/test_with_cassette.rb
400
414
  - test/integration/navigation_test.rb
401
415
  - test/dummy/app/controllers/application_controller.rb
402
416
  - test/dummy/app/assets/javascripts/application.js
403
417
  - test/dummy/app/assets/stylesheets/application.css
418
+ - test/dummy/app/views/_test_custom_item_partial.html.erb
404
419
  - test/dummy/app/views/layouts/application.html.erb
405
420
  - test/dummy/app/helpers/application_helper.rb
406
421
  - test/dummy/public/404.html
@@ -435,7 +450,11 @@ test_files:
435
450
  - test/vcr_cassettes/summon/proper_tags_for_snippets.yml
436
451
  - test/vcr_cassettes/summon/search.yml
437
452
  - test/vcr_cassettes/summon/bad_auth.yml
453
+ - test/vcr_cassettes/summon/live__get_id_.yml
454
+ - test/vcr_cassettes/summon/live_get_id__on_non-existing_id.yml
438
455
  - test/vcr_cassettes/xerxes/live_search.yml
456
+ - test/vcr_cassettes/worldcat_sru_dc/live_get_id__for_bad_id.yml
457
+ - test/vcr_cassettes/worldcat_sru_dc/live_get_id_.yml
439
458
  - test/vcr_cassettes/worldcat_sru_dc/smoke_test.yml
440
459
  - test/vcr_cassettes/worldcat_sru_dc/max_out_pagination.yml
441
460
  - test/vcr_cassettes/primo/search_smoke_test.yml
@@ -444,6 +463,7 @@ test_files:
444
463
  - test/vcr_cassettes/ebscohost/live_search.yml
445
464
  - test/vcr_cassettes/ebscohost/fulltext_info.yml
446
465
  - test/vcr_cassettes/ebscohost/error_bad_db.yml
466
+ - test/vcr_cassettes/ebscohost/live_get_id__on_bad_db_raises.yml
447
467
  - test/vcr_cassettes/ebscohost/live_pathological_book_item_example.yml
448
468
  - test/vcr_cassettes/ebscohost/error_bad_password.yml
449
469
  - test/vcr_cassettes/ebscohost/dissertation_example.yml
@@ -451,6 +471,8 @@ test_files:
451
471
  - test/vcr_cassettes/ebscohost/get_info.yml
452
472
  - test/vcr_cassettes/ebscohost/live_book_example.yml
453
473
  - test/vcr_cassettes/ebscohost/live_search_smoke_test.yml
474
+ - test/vcr_cassettes/ebscohost/live__get_identifier__round_trip.yml
475
+ - test/vcr_cassettes/ebscohost/live_get_id__with_no_results_raises.yml
454
476
  - test/vcr_cassettes/eds/basic_search_smoke_test.yml
455
477
  - test/vcr_cassettes/eds/get_auth_token.yml
456
478
  - test/vcr_cassettes/eds/get_auth_token_failure.yml
@@ -467,11 +489,13 @@ test_files:
467
489
  - test/vcr_cassettes/scopus/bad_api_key_should_return_error_response.yml
468
490
  - test/vcr_cassettes/scopus/escaped_chars.yml
469
491
  - test/vcr_cassettes/scopus/zero_results_search.yml
470
- - test/vcr_cassettes/max_out_pagination.yml
471
492
  - test/vcr_cassettes/gbs/pagination.yml
472
493
  - test/vcr_cassettes/gbs/error_condition.yml
494
+ - test/vcr_cassettes/gbs/live_get_id_.yml
473
495
  - test/vcr_cassettes/gbs/search.yml
474
496
  - test/vcr_cassettes/gbs/empty_results.yml
497
+ - test/vcr_cassettes/gbs/live_get_id__with_not_found_id.yml
498
+ - test/unit/ris_creator_test.rb
475
499
  - test/unit/eds_engine_test.rb
476
500
  - test/unit/result_item_test.rb
477
501
  - test/unit/item_decorators_test.rb
@@ -479,6 +503,7 @@ test_files:
479
503
  - test/unit/google_site_search_test.rb
480
504
  - test/unit/search_engine_test.rb
481
505
  - test/unit/search_engine_base_test.rb
506
+ - test/unit/worldcat_sru_dc_engine_test.rb
482
507
  - test/unit/register_engine_test.rb
483
508
  - test/unit/google_books_engine_test.rb
484
509
  - test/unit/summon_engine_test.rb
@@ -1,155 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://www.worldcat.org/webservices/catalog/search/sru?maximumRecords=10&query=srw.kw%20=%20%22cancer%22&recordSchema=info:srw/schema/1/dc&startRecord=9999&wskey=x6LycLe0om93dk2sMdK8h5kb1n1nuqyD1gSszhb50QfCbPKdSyNlhAjWsgflf1NMgnZzaIOsucb2vXli
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 200
13
- message: !binary |-
14
- T0s=
15
- headers:
16
- !binary "RGF0ZQ==":
17
- - !binary |-
18
- V2VkLCAyNiBTZXAgMjAxMiAyMToxOTo0MyBHTVQ=
19
- !binary "U2VydmVy":
20
- - !binary |-
21
- QXBhY2hl
22
- !binary "Q29udGVudC1MZW5ndGg=":
23
- - !binary |-
24
- Mjc0Ng==
25
- !binary "Q29udGVudC1UeXBl":
26
- - !binary |-
27
- dGV4dC94bWw7Y2hhcnNldD11dGYtOA==
28
- body:
29
- encoding: US-ASCII
30
- string: ! '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
31
-
32
- <?xml-stylesheet type="text/xsl" href="/webservices/catalog/xsl/searchRetrieveResponse.xsl"?>
33
-
34
-
35
- <searchRetrieveResponse xmlns="http://www.loc.gov/zing/srw/" xmlns:oclcterms="http://purl.org/oclc/terms/"
36
- xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:diag="http://www.loc.gov/zing/srw/diagnostic/"
37
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
38
-
39
- <version>1.1</version>
40
-
41
- <numberOfRecords>410602</numberOfRecords>
42
-
43
- <records>
44
-
45
- <record>
46
-
47
- <recordSchema>info:srw/schema/1/dc</recordSchema>
48
-
49
- <recordPacking>xml</recordPacking>
50
-
51
- <recordData>
52
-
53
- <oclcdcs>
54
-
55
- <dc:date>1976</dc:date>
56
-
57
- <dc:identifier>0340-7004</dc:identifier>
58
-
59
- <dc:language xsi:type="http://purl.org/dc/terms/ISO639-2">eng</dc:language>
60
-
61
- <dc:publisher>Springer Verlag</dc:publisher>
62
-
63
- <dc:title>Cancer immunology and immunotherapy.</dc:title>
64
-
65
- <dc:type>Text</dc:type>
66
-
67
- <oclcterms:recordCreationDate xsi:type="http://purl.org/oclc/terms/marc008date">010507</oclcterms:recordCreationDate>
68
-
69
- <oclcterms:recordIdentifier>301186271</oclcterms:recordIdentifier>
70
-
71
- </oclcdcs>
72
-
73
- </recordData>
74
-
75
- </record>
76
-
77
- <record>
78
-
79
- <recordSchema>info:srw/schema/1/dc</recordSchema>
80
-
81
- <recordPacking>xml</recordPacking>
82
-
83
- <recordData>
84
-
85
- <oclcdcs>
86
-
87
- <dc:creator>Timms, Carol.</dc:creator>
88
-
89
- <dc:date>c2007</dc:date>
90
-
91
- <dc:format>213 p. : ill. ; 18 cm.</dc:format>
92
-
93
- <dc:identifier>9780615234540 (spiral)</dc:identifier>
94
-
95
- <dc:identifier>0615234542 (spiral)</dc:identifier>
96
-
97
- <dc:language xsi:type="http://purl.org/dc/terms/ISO639-2">eng</dc:language>
98
-
99
- <dc:publisher>s.n.]</dc:publisher>
100
-
101
- <dc:subject xsi:type="http://purl.org/dc/terms/LCSH">Breast--Cancer--Anecdotes.</dc:subject>
102
-
103
- <dc:subject xsi:type="http://purl.org/dc/terms/LCSH">Cancer--Treatment.</dc:subject>
104
-
105
- <dc:subject xsi:type="http://purl.org/dc/terms/LCSH">Breast--Cancer.</dc:subject>
106
-
107
- <dc:subject xsi:type="http://purl.org/dc/terms/LCSH">Breast--Cancer--Patients--United
108
- States--Biography.</dc:subject>
109
-
110
- <dc:title>Adventures in breast cancer </dc:title>
111
-
112
- <dc:type>Text</dc:type>
113
-
114
- <oclcterms:recordCreationDate xsi:type="http://purl.org/oclc/terms/marc008date">090219</oclcterms:recordCreationDate>
115
-
116
- <oclcterms:recordIdentifier>309925865</oclcterms:recordIdentifier>
117
-
118
- </oclcdcs>
119
-
120
- </recordData>
121
-
122
- </record>
123
-
124
- </records>
125
-
126
- <nextRecordPosition>10001</nextRecordPosition>
127
-
128
- <resultSetIdleTime/>
129
-
130
- <echoedSearchRetrieveRequest xmlns:srw="http://www.loc.gov/zing/srw/">
131
-
132
- <version>1.1</version>
133
-
134
- <query>srw.kw = "cancer"</query>
135
-
136
- <maximumRecords>2</maximumRecords>
137
-
138
- <recordSchema>info:srw/schema/1/dc</recordSchema>
139
-
140
- <recordPacking>xml</recordPacking>
141
-
142
- <startRecord>9999</startRecord>
143
-
144
- <sortKeys>relevance</sortKeys>
145
-
146
- <wskey>x6LycLe0om93dk2sMdK8h5kb1n1nuqyD1gSszhb50QfCbPKdSyNlhAjWsgflf1NMgnZzaIOsucb2vXli</wskey>
147
-
148
- </echoedSearchRetrieveRequest>
149
-
150
- </searchRetrieveResponse>
151
-
152
- '
153
- http_version:
154
- recorded_at: Wed, 26 Sep 2012 21:19:49 GMT
155
- recorded_with: VCR 2.2.5