exlibris-primo 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/README.rdoc +5 -2
  2. data/Rakefile +1 -5
  3. data/lib/exlibris/primo/eshelf.rb +4 -3
  4. data/lib/exlibris/primo/holding.rb +2 -10
  5. data/lib/exlibris/primo/record.rb +11 -6
  6. data/lib/exlibris/primo/searcher.rb +2 -4
  7. data/lib/exlibris/primo/version.rb +2 -2
  8. data/test/exlibris-primo_test.rb +3 -3
  9. data/test/test_helper.rb +33 -7
  10. data/test/unit/eshelf_test.rb +106 -87
  11. data/test/unit/record_test.rb +64 -45
  12. data/test/unit/searcher_benchmarks.rb +20 -28
  13. data/test/unit/searcher_test.rb +298 -273
  14. data/test/unit/web_service_benchmarks.rb +19 -21
  15. data/test/unit/web_service_test.rb +130 -102
  16. data/test/vcr_cassettes/eshelf_add_invalid_records.yml +107 -0
  17. data/test/vcr_cassettes/eshelf_add_same_record_twice.yml +159 -0
  18. data/test/vcr_cassettes/eshelf_add_to_empty_basket.yml +107 -0
  19. data/test/vcr_cassettes/eshelf_add_to_invalid_basket.yml +55 -0
  20. data/test/vcr_cassettes/eshelf_invalid_eshelf.yml +55 -0
  21. data/test/vcr_cassettes/eshelf_invalid_institution.yml +55 -0
  22. data/test/vcr_cassettes/eshelf_valid_eshelf.yml +2553 -0
  23. data/test/vcr_cassettes/eshelf_valid_eshelf_structure.yml +47 -0
  24. data/test/vcr_cassettes/record.yml +212 -0
  25. data/test/vcr_cassettes/record_invalid_record.yml +55 -0
  26. data/test/vcr_cassettes/record_sub_record.yml +212 -0
  27. data/test/vcr_cassettes/record_valid_record.yml +212 -0
  28. data/test/vcr_cassettes/searcher_base_holdings_by_id.yml +212 -0
  29. data/test/vcr_cassettes/searcher_dedupmrg_by_id.yml +347 -0
  30. data/test/vcr_cassettes/searcher_diacritics1_by_id.yml +207 -0
  31. data/test/vcr_cassettes/searcher_diacritics2_by_id.yml +232 -0
  32. data/test/vcr_cassettes/searcher_holdings_by_id.yml +212 -0
  33. data/test/vcr_cassettes/searcher_invalid_id.yml +55 -0
  34. data/test/vcr_cassettes/searcher_rsrcs_by_id.yml +270 -0
  35. data/test/vcr_cassettes/searcher_search_by_isbn.yml +278 -0
  36. data/test/vcr_cassettes/searcher_search_by_issn.yml +297 -0
  37. data/test/vcr_cassettes/searcher_search_by_title_author_genre.yml +671 -0
  38. data/test/vcr_cassettes/searcher_test_bug_1361.yml +224 -0
  39. data/test/vcr_cassettes/searcher_test_problem_by_id.yml +194 -0
  40. data/test/vcr_cassettes/searcher_tocs_by_id.yml +217 -0
  41. data/test/vcr_cassettes/web_service_author_search.yml +1269 -0
  42. data/test/vcr_cassettes/web_service_bogus_200.yml +392 -0
  43. data/test/vcr_cassettes/web_service_brief_search.yml +299 -0
  44. data/test/vcr_cassettes/web_service_get_eshelf.yml +11823 -0
  45. data/test/vcr_cassettes/web_service_get_eshelf_structure_search.yml +47 -0
  46. data/test/vcr_cassettes/web_service_invalid_document.yml +54 -0
  47. data/test/vcr_cassettes/web_service_isbn_search.yml +299 -0
  48. data/test/vcr_cassettes/web_service_issn_search.yml +293 -0
  49. data/test/vcr_cassettes/web_service_problem_document.yml +193 -0
  50. data/test/vcr_cassettes/web_service_single_document.yml +233 -0
  51. data/test/vcr_cassettes/web_service_title_author_genre_search.yml +719 -0
  52. data/test/vcr_cassettes/web_service_title_search.yml +1035 -0
  53. metadata +147 -77
  54. data/lib/tasks/exlibris-primo_tasks.rake +0 -4
  55. data/test/dummy/README.rdoc +0 -261
  56. data/test/dummy/Rakefile +0 -7
  57. data/test/dummy/app/assets/javascripts/application.js +0 -15
  58. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  59. data/test/dummy/app/controllers/application_controller.rb +0 -3
  60. data/test/dummy/app/helpers/application_helper.rb +0 -2
  61. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  62. data/test/dummy/config.ru +0 -4
  63. data/test/dummy/config/application.rb +0 -56
  64. data/test/dummy/config/boot.rb +0 -10
  65. data/test/dummy/config/database.yml +0 -25
  66. data/test/dummy/config/environment.rb +0 -5
  67. data/test/dummy/config/environments/development.rb +0 -37
  68. data/test/dummy/config/environments/production.rb +0 -67
  69. data/test/dummy/config/environments/test.rb +0 -37
  70. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  71. data/test/dummy/config/initializers/inflections.rb +0 -15
  72. data/test/dummy/config/initializers/mime_types.rb +0 -5
  73. data/test/dummy/config/initializers/secret_token.rb +0 -7
  74. data/test/dummy/config/initializers/session_store.rb +0 -8
  75. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  76. data/test/dummy/config/locales/en.yml +0 -5
  77. data/test/dummy/config/routes.rb +0 -58
  78. data/test/dummy/db/README +0 -0
  79. data/test/dummy/db/test.sqlite3 +0 -0
  80. data/test/dummy/log/test.log +0 -1704
  81. data/test/dummy/public/404.html +0 -26
  82. data/test/dummy/public/422.html +0 -26
  83. data/test/dummy/public/500.html +0 -25
  84. data/test/dummy/public/favicon.ico +0 -0
  85. data/test/dummy/script/rails +0 -6
@@ -1,30 +1,28 @@
1
1
  require 'test_helper'
2
2
 
3
- class WebServiceBenchmarks < ActiveSupport::TestCase
3
+ class WebServiceBenchmarks < Test::Unit::TestCase
4
4
  PNX_NS = {'pnx' => 'http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib'}
5
5
  SEARCH_NS = {'search' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
6
6
 
7
7
  def setup
8
8
  @primo_definition = YAML.load( %{
9
- type: PrimoService
10
- priority: 2 # After SFX, to get SFX metadata enhancement
11
- status: active
12
- base_url: http://bobcat.library.nyu.edu
13
- vid: NYU
14
- institution: NYU
15
- holding_search_institution: NYU
16
- holding_search_text: Search for this title in BobCat.
17
- suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
18
- ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
19
- service_types:
20
- - primo_source
21
- - holding_search
22
- - fulltext
23
- - table_of_contents
24
- - referent_enhance
25
- - cover_image
26
- })
27
-
9
+ type: PrimoService
10
+ priority: 2 # After SFX, to get SFX metadata enhancement
11
+ status: active
12
+ base_url: http://bobcat.library.nyu.edu
13
+ vid: NYU
14
+ institution: NYU
15
+ holding_search_institution: NYU
16
+ holding_search_text: Search for this title in BobCat.
17
+ suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
18
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
19
+ service_types:
20
+ - primo_source
21
+ - holding_search
22
+ - fulltext
23
+ - table_of_contents
24
+ - referent_enhance
25
+ - cover_image })
28
26
  @base_url = @primo_definition["base_url"]
29
27
  @bogus_404_url = "http://library.nyu.edu/bogus"
30
28
  @bogus_200_url = "http://library.nyu.edu"
@@ -38,7 +36,7 @@ class WebServiceBenchmarks < ActiveSupport::TestCase
38
36
  @title_author_genre_search_params = {:title => "Travels with My Aunt", :author => "Graham Greene", :genre => "Book"}
39
37
  end
40
38
 
41
- test "benchmarks" do
39
+ def testbenchmarks
42
40
  Benchmark.bmbm do |results|
43
41
  results.report("Get Record:") {
44
42
  (1..10).each {
@@ -1,32 +1,30 @@
1
1
  require 'test_helper'
2
2
 
3
- class WebServiceTest < ActiveSupport::TestCase
3
+ class WebServiceTest < Test::Unit::TestCase
4
4
  PNX_NS = {'pnx' => 'http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib'}
5
5
  SEARCH_NS = {'search' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
6
6
  SEAR_NS = {'sear' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
7
7
  PRIM_NS = {'prim' => 'http://www.exlibris.com/primo/xsd/primoeshelffolder'}
8
-
8
+
9
9
  def setup
10
10
  @primo_definition = YAML.load( %{
11
- type: PrimoService
12
- priority: 2 # After SFX, to get SFX metadata enhancement
13
- status: active
14
- base_url: http://bobcat.library.nyu.edu
15
- vid: NYU
16
- institution: NYU
17
- holding_search_institution: NYU
18
- holding_search_text: Search for this title in BobCat.
19
- suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
20
- ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
21
- service_types:
22
- - primo_source
23
- - holding_search
24
- - fulltext
25
- - table_of_contents
26
- - referent_enhance
27
- - cover_image
28
- })
29
-
11
+ type: PrimoService
12
+ priority: 2 # After SFX, to get SFX metadata enhancement
13
+ status: active
14
+ base_url: http://bobcatdev.library.nyu.edu
15
+ vid: NYU
16
+ institution: NYU
17
+ holding_search_institution: NYU
18
+ holding_search_text: Search for this title in BobCat.
19
+ suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
20
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
21
+ service_types:
22
+ - primo_source
23
+ - holding_search
24
+ - fulltext
25
+ - table_of_contents
26
+ - referent_enhance
27
+ - cover_image })
30
28
  @valid_user_id = "N18158418"
31
29
  @invalid_user_id = "INVALID_USER"
32
30
  @default_institution = "NYU"
@@ -42,105 +40,135 @@ class WebServiceTest < ActiveSupport::TestCase
42
40
  @author_search_params = {:author => "Graham Greene"}
43
41
  @title_author_genre_search_params = {:title => "Travels with My Aunt", :author => "Graham Greene", :genre => "Book"}
44
42
  end
45
-
46
- test "bogus_response" do
47
- assert_raise(SOAP::HTTPStreamError) {
48
- ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @bogus_404_url)
49
- }
50
- assert_raise(SOAP::HTTPStreamError) {
51
- ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @bogus_200_url)
52
- }
43
+
44
+ def testbogus_response
45
+ VCR.turned_off do
46
+ assert_raise(SOAP::HTTPStreamError) {
47
+ ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @bogus_404_url)
48
+ }
49
+ end
50
+ VCR.use_cassette('web service bogus 200') do
51
+ assert_raise(SOAP::HTTPStreamError) {
52
+ ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @bogus_200_url)
53
+ }
54
+ end
53
55
  end
54
-
56
+
55
57
  # Test GetRecord for a single Primo document.
56
- test "get_record" do
57
- ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @base_url)
58
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
59
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
60
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
61
- assert_equal(@primo_test_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
58
+ def testget_record
59
+ VCR.use_cassette('web service single document') do
60
+ ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @base_url, {:institution => "NYU"})
61
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
62
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
63
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
64
+ assert_equal(@primo_test_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text,
65
+ "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
66
+ end
62
67
  end
63
-
64
- test "get_record_count" do
65
- ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @base_url)
66
- assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
68
+
69
+ def testget_record_count
70
+ VCR.use_cassette('web service single document') do
71
+ ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_doc_id, @base_url, {:institution => "NYU"})
72
+ assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
73
+ end
67
74
  end
68
-
69
- test "search_brief_count" do
70
- ws = Exlibris::Primo::WebService::SearchBrief.new(@isbn_search_params, @base_url)
71
- assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
75
+
76
+ def testsearch_brief_count
77
+ VCR.use_cassette('web service brief search') do
78
+ ws = Exlibris::Primo::WebService::SearchBrief.new(@isbn_search_params, @base_url, {:institution => "NYU"})
79
+ assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
80
+ end
72
81
  end
73
-
74
- test "get_genre_discrepancy" do
75
- ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_problem_doc_id, @base_url)
76
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
77
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
78
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
79
- assert_equal(@primo_test_problem_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
80
- assert_not_nil(ws.response.at("//pnx:display/pnx:availlibrary", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
82
+
83
+ def testget_genre_discrepancy
84
+ VCR.use_cassette('web service problem document') do
85
+ ws = Exlibris::Primo::WebService::GetRecord.new(@primo_test_problem_doc_id, @base_url, {:institution => "NYU"})
86
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
87
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
88
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
89
+ assert_equal(@primo_test_problem_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text,
90
+ "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
91
+ assert_not_nil(ws.response.at("//pnx:display/pnx:availlibrary", PNX_NS).inner_text,
92
+ "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
93
+ end
81
94
  end
82
-
95
+
83
96
  # Test GetRecord with invalid Primo doc id.
84
- test "get_bogus_record" do
85
- assert_raise(RuntimeError) {
86
- ws = Exlibris::Primo::WebService::GetRecord.new(@primo_invalid_doc_id, @base_url)
87
- }
97
+ def testget_bogus_record
98
+ VCR.use_cassette('web service invalid document') do
99
+ assert_raise(RuntimeError) {
100
+ ws = Exlibris::Primo::WebService::GetRecord.new(@primo_invalid_doc_id, @base_url, {:institution => "NYU"})
101
+ }
102
+ end
88
103
  end
89
-
104
+
90
105
  # Test SearchBrief by isbn.
91
- test "isbn_search" do
92
- ws = Exlibris::Primo::WebService::SearchBrief.new(@isbn_search_params, @base_url)
93
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
94
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
95
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
106
+ def testisbn_search
107
+ VCR.use_cassette('web service isbn search') do
108
+ ws = Exlibris::Primo::WebService::SearchBrief.new(@isbn_search_params, @base_url, {:institution => "NYU"})
109
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
110
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
111
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
112
+ end
96
113
  end
97
-
114
+
98
115
  # Test SearchBrief by issn.
99
- test "issn_search" do
100
- ws = Exlibris::Primo::WebService::SearchBrief.new(@issn_search_params, @base_url)
101
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
102
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
103
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
116
+ def testissn_search
117
+ VCR.use_cassette('web service issn search') do
118
+ ws = Exlibris::Primo::WebService::SearchBrief.new(@issn_search_params, @base_url, {:institution => "NYU"})
119
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
120
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
121
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
122
+ end
104
123
  end
105
-
124
+
106
125
  # Test SearchBrief by title.
107
- test "title_search" do
108
- ws = Exlibris::Primo::WebService::SearchBrief.new(@title_search_params, @base_url)
109
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
110
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
111
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
126
+ def testtitle_search
127
+ VCR.use_cassette('web service title search') do
128
+ ws = Exlibris::Primo::WebService::SearchBrief.new(@title_search_params, @base_url, {:institution => "NYU"})
129
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
130
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
131
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
132
+ end
112
133
  end
113
-
134
+
114
135
  # Test SearchBrief by author.
115
- test "author_search" do
116
- ws = Exlibris::Primo::WebService::SearchBrief.new(@author_search_params, @base_url)
117
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
118
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
119
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
136
+ def testauthor_search
137
+ VCR.use_cassette('web service author search') do
138
+ ws = Exlibris::Primo::WebService::SearchBrief.new(@author_search_params, @base_url, {:institution => "NYU"})
139
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
140
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
141
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
142
+ end
120
143
  end
121
-
144
+
122
145
  # Test SearchBrief by title/author/genre.
123
- test "title_author_genre_search" do
124
- ws = Exlibris::Primo::WebService::SearchBrief.new(@title_author_genre_search_params, @base_url)
125
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
126
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
127
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
146
+ def testtitle_author_genre_search
147
+ VCR.use_cassette('web service title author genre search') do
148
+ ws = Exlibris::Primo::WebService::SearchBrief.new(@title_author_genre_search_params, @base_url, {:institution => "NYU"})
149
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
150
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
151
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
152
+ end
128
153
  end
129
-
130
- test "get_new_eshelf" do
131
- ws = Exlibris::Primo::WebService::GetEShelf.new(@valid_user_id, @default_institution, @base_url)
132
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
133
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
134
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
135
- assert_not_nil(ws.response.at("//sear:DOC", SEAR_NS), "#{ws.class} response returned a nil document")
136
- end
137
-
138
- test "get_new_eshelf_structure" do
139
- ws = Exlibris::Primo::WebService::GetEShelfStructure.new(@valid_user_id, @default_institution, @base_url)
140
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
141
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
142
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
143
- assert_not_nil(ws.response.at("//prim:eshelf_folders", PRIM_NS), "#{ws.class} response returned a nil document")
154
+
155
+ def testget_new_eshelf
156
+ VCR.use_cassette('web service get eshelf') do
157
+ ws = Exlibris::Primo::WebService::GetEShelf.new(@valid_user_id, @default_institution, @base_url, {:institution => "NYU"})
158
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
159
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
160
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
161
+ assert_not_nil(ws.response.at("//sear:DOC", SEAR_NS), "#{ws.class} response returned a nil document")
162
+ end
144
163
  end
145
164
 
165
+ def testget_new_eshelf_structure
166
+ VCR.use_cassette('web service get eshelf structure search') do
167
+ ws = Exlibris::Primo::WebService::GetEShelfStructure.new(@valid_user_id, @default_institution, @base_url, {:institution => "NYU"})
168
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
169
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
170
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
171
+ assert_not_nil(ws.response.at("//prim:eshelf_folders", PRIM_NS), "#{ws.class} response returned a nil document")
172
+ end
173
+ end
146
174
  end
@@ -0,0 +1,107 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://bobcat.library.nyu.edu/PrimoWebServices/services/primo/eshelf
6
+ body:
7
+ string: |-
8
+ <?xml version="1.0" encoding="utf-8" ?>
9
+ <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
11
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
12
+ <env:Body>
13
+ <n1:addToEshelf env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
14
+ xmlns:n1="http://www.exlibris.com/primo/xsd/wsRequest">
15
+ <addToEshelfRequest xsi:type="xsd:string">&lt;addToEshelfRequest xmlns=&apos;http://www.exlibris.com/primo/xsd/wsRequest&apos;&gt;&lt;userId&gt;N18158418&lt;/userId&gt;&lt;institution&gt;NYU&lt;/institution&gt;&lt;docId&gt;INVALID_DOC_ID&lt;/docId&gt;&lt;folderId&gt;298560007&lt;/folderId&gt;&lt;/addToEshelfRequest&gt;</addToEshelfRequest>
16
+ </n1:addToEshelf>
17
+ </env:Body>
18
+ </env:Envelope>
19
+ headers:
20
+ Content-Type:
21
+ - text/xml; charset=utf-8
22
+ Soapaction:
23
+ - "\"\""
24
+ User-Agent:
25
+ - SOAP4R/1.6.1-SNAPSHOT
26
+ Accept:
27
+ - "*/*"
28
+ response:
29
+ status:
30
+ code: 200
31
+ message: OK
32
+ headers:
33
+ X-Powered-By:
34
+ - "Servlet 2.4; Tomcat-5.0.28/JBoss-4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)"
35
+ Content-Type:
36
+ - text/xml;charset=utf-8
37
+ Transfer-Encoding:
38
+ - chunked
39
+ Date:
40
+ - Fri, 12 Oct 2012 17:59:05 GMT
41
+ Server:
42
+ - Apache-Coyote/1.1
43
+ body:
44
+ string: |-
45
+ <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:addToEshelfResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://www.exlibris.com/primo/xsd/wsRequest"><addToEshelfReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">&lt;SEGMENTS xmlns=&quot;http://www.exlibrisgroup.com/xsd/jaguar/search&quot;&gt;
46
+ &lt;JAGROOT&gt;
47
+ &lt;RESULT&gt;
48
+ &lt;ERROR MESSAGE=&quot;DocId parameter is missing or incorrect&quot; CODE=&quot;-2&quot;/&gt;
49
+ &lt;/RESULT&gt;
50
+ &lt;/JAGROOT&gt;
51
+ &lt;/SEGMENTS&gt;
52
+ </addToEshelfReturn></ns1:addToEshelfResponse></soapenv:Body></soapenv:Envelope>
53
+ http_version:
54
+ recorded_at: Fri, 12 Oct 2012 17:59:06 GMT
55
+ - request:
56
+ method: post
57
+ uri: http://bobcat.library.nyu.edu/PrimoWebServices/services/primo/eshelf
58
+ body:
59
+ string: |-
60
+ <?xml version="1.0" encoding="utf-8" ?>
61
+ <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
62
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
63
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
64
+ <env:Body>
65
+ <n1:removeFromEshelf env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
66
+ xmlns:n1="http://www.exlibris.com/primo/xsd/wsRequest">
67
+ <removeFromEshelfRequest xsi:type="xsd:string">&lt;removeFromEshelfRequest xmlns=&apos;http://www.exlibris.com/primo/xsd/wsRequest&apos;&gt;&lt;userId&gt;N18158418&lt;/userId&gt;&lt;institution&gt;NYU&lt;/institution&gt;&lt;docId&gt;INVALID_DOC_ID&lt;/docId&gt;&lt;folderId&gt;298560007&lt;/folderId&gt;&lt;/removeFromEshelfRequest&gt;</removeFromEshelfRequest>
68
+ </n1:removeFromEshelf>
69
+ </env:Body>
70
+ </env:Envelope>
71
+ headers:
72
+ Content-Type:
73
+ - text/xml; charset=utf-8
74
+ Soapaction:
75
+ - "\"\""
76
+ User-Agent:
77
+ - SOAP4R/1.6.1-SNAPSHOT
78
+ Accept:
79
+ - "*/*"
80
+ response:
81
+ status:
82
+ code: 200
83
+ message: OK
84
+ headers:
85
+ X-Powered-By:
86
+ - "Servlet 2.4; Tomcat-5.0.28/JBoss-4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)"
87
+ Content-Type:
88
+ - text/xml;charset=utf-8
89
+ Transfer-Encoding:
90
+ - chunked
91
+ Date:
92
+ - Fri, 12 Oct 2012 17:59:05 GMT
93
+ Server:
94
+ - Apache-Coyote/1.1
95
+ body:
96
+ string: |-
97
+ <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:removeFromEshelfResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://www.exlibris.com/primo/xsd/wsRequest"><removeFromEshelfReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">&lt;SEGMENTS xmlns=&quot;http://www.exlibrisgroup.com/xsd/jaguar/search&quot;&gt;
98
+ &lt;JAGROOT&gt;
99
+ &lt;RESULT&gt;
100
+ &lt;ERROR MESSAGE=&quot;DocId parameter is missing or incorrect&quot; CODE=&quot;-2&quot;/&gt;
101
+ &lt;/RESULT&gt;
102
+ &lt;/JAGROOT&gt;
103
+ &lt;/SEGMENTS&gt;
104
+ </removeFromEshelfReturn></ns1:removeFromEshelfResponse></soapenv:Body></soapenv:Envelope>
105
+ http_version:
106
+ recorded_at: Fri, 12 Oct 2012 17:59:06 GMT
107
+ recorded_with: VCR 2.2.5
@@ -0,0 +1,159 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://bobcat.library.nyu.edu/PrimoWebServices/services/primo/eshelf
6
+ body:
7
+ string: |-
8
+ <?xml version="1.0" encoding="utf-8" ?>
9
+ <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
11
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
12
+ <env:Body>
13
+ <n1:addToEshelf env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
14
+ xmlns:n1="http://www.exlibris.com/primo/xsd/wsRequest">
15
+ <addToEshelfRequest xsi:type="xsd:string">&lt;addToEshelfRequest xmlns=&apos;http://www.exlibris.com/primo/xsd/wsRequest&apos;&gt;&lt;userId&gt;N18158418&lt;/userId&gt;&lt;institution&gt;NYU&lt;/institution&gt;&lt;docId&gt;nyu_aleph000062856&lt;/docId&gt;&lt;folderId&gt;298560007&lt;/folderId&gt;&lt;/addToEshelfRequest&gt;</addToEshelfRequest>
16
+ </n1:addToEshelf>
17
+ </env:Body>
18
+ </env:Envelope>
19
+ headers:
20
+ Content-Type:
21
+ - text/xml; charset=utf-8
22
+ Soapaction:
23
+ - "\"\""
24
+ User-Agent:
25
+ - SOAP4R/1.6.1-SNAPSHOT
26
+ Accept:
27
+ - "*/*"
28
+ response:
29
+ status:
30
+ code: 200
31
+ message: OK
32
+ headers:
33
+ X-Powered-By:
34
+ - "Servlet 2.4; Tomcat-5.0.28/JBoss-4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)"
35
+ Content-Type:
36
+ - text/xml;charset=utf-8
37
+ Transfer-Encoding:
38
+ - chunked
39
+ Date:
40
+ - Fri, 12 Oct 2012 17:59:05 GMT
41
+ Server:
42
+ - Apache-Coyote/1.1
43
+ body:
44
+ string: |-
45
+ <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:addToEshelfResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://www.exlibris.com/primo/xsd/wsRequest"><addToEshelfReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">&lt;SEGMENTS xmlns=&quot;http://www.exlibrisgroup.com/xsd/jaguar/search&quot;&gt;
46
+ &lt;JAGROOT&gt;
47
+ &lt;RESULT&gt;
48
+ &lt;ERROR MESSAGE=&quot;Add to eshelf action completed successfully&quot; CODE=&quot;0&quot;/&gt;
49
+ &lt;/RESULT&gt;
50
+ &lt;/JAGROOT&gt;
51
+ &lt;/SEGMENTS&gt;
52
+ </addToEshelfReturn></ns1:addToEshelfResponse></soapenv:Body></soapenv:Envelope>
53
+ http_version:
54
+ recorded_at: Fri, 12 Oct 2012 17:59:06 GMT
55
+ - request:
56
+ method: post
57
+ uri: http://bobcat.library.nyu.edu/PrimoWebServices/services/primo/eshelf
58
+ body:
59
+ string: |-
60
+ <?xml version="1.0" encoding="utf-8" ?>
61
+ <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
62
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
63
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
64
+ <env:Body>
65
+ <n1:addToEshelf env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
66
+ xmlns:n1="http://www.exlibris.com/primo/xsd/wsRequest">
67
+ <addToEshelfRequest xsi:type="xsd:string">&lt;addToEshelfRequest xmlns=&apos;http://www.exlibris.com/primo/xsd/wsRequest&apos;&gt;&lt;userId&gt;N18158418&lt;/userId&gt;&lt;institution&gt;NYU&lt;/institution&gt;&lt;docId&gt;nyu_aleph000062856&lt;/docId&gt;&lt;folderId&gt;298560007&lt;/folderId&gt;&lt;/addToEshelfRequest&gt;</addToEshelfRequest>
68
+ </n1:addToEshelf>
69
+ </env:Body>
70
+ </env:Envelope>
71
+ headers:
72
+ Content-Type:
73
+ - text/xml; charset=utf-8
74
+ Soapaction:
75
+ - "\"\""
76
+ User-Agent:
77
+ - SOAP4R/1.6.1-SNAPSHOT
78
+ Accept:
79
+ - "*/*"
80
+ response:
81
+ status:
82
+ code: 200
83
+ message: OK
84
+ headers:
85
+ X-Powered-By:
86
+ - "Servlet 2.4; Tomcat-5.0.28/JBoss-4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)"
87
+ Content-Type:
88
+ - text/xml;charset=utf-8
89
+ Transfer-Encoding:
90
+ - chunked
91
+ Date:
92
+ - Fri, 12 Oct 2012 17:59:05 GMT
93
+ Server:
94
+ - Apache-Coyote/1.1
95
+ body:
96
+ string: |-
97
+ <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:addToEshelfResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://www.exlibris.com/primo/xsd/wsRequest"><addToEshelfReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">&lt;SEGMENTS xmlns=&quot;http://www.exlibrisgroup.com/xsd/jaguar/search&quot;&gt;
98
+ &lt;JAGROOT&gt;
99
+ &lt;RESULT&gt;
100
+ &lt;ERROR MESSAGE=&quot;DocId was already added to e-Shelf&quot; CODE=&quot;-2&quot;/&gt;
101
+ &lt;/RESULT&gt;
102
+ &lt;/JAGROOT&gt;
103
+ &lt;/SEGMENTS&gt;
104
+ </addToEshelfReturn></ns1:addToEshelfResponse></soapenv:Body></soapenv:Envelope>
105
+ http_version:
106
+ recorded_at: Fri, 12 Oct 2012 17:59:06 GMT
107
+ - request:
108
+ method: post
109
+ uri: http://bobcat.library.nyu.edu/PrimoWebServices/services/primo/eshelf
110
+ body:
111
+ string: |-
112
+ <?xml version="1.0" encoding="utf-8" ?>
113
+ <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
114
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
115
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
116
+ <env:Body>
117
+ <n1:removeFromEshelf env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
118
+ xmlns:n1="http://www.exlibris.com/primo/xsd/wsRequest">
119
+ <removeFromEshelfRequest xsi:type="xsd:string">&lt;removeFromEshelfRequest xmlns=&apos;http://www.exlibris.com/primo/xsd/wsRequest&apos;&gt;&lt;userId&gt;N18158418&lt;/userId&gt;&lt;institution&gt;NYU&lt;/institution&gt;&lt;docId&gt;nyu_aleph000062856&lt;/docId&gt;&lt;folderId&gt;298560007&lt;/folderId&gt;&lt;/removeFromEshelfRequest&gt;</removeFromEshelfRequest>
120
+ </n1:removeFromEshelf>
121
+ </env:Body>
122
+ </env:Envelope>
123
+ headers:
124
+ Content-Type:
125
+ - text/xml; charset=utf-8
126
+ Soapaction:
127
+ - "\"\""
128
+ User-Agent:
129
+ - SOAP4R/1.6.1-SNAPSHOT
130
+ Accept:
131
+ - "*/*"
132
+ response:
133
+ status:
134
+ code: 200
135
+ message: OK
136
+ headers:
137
+ X-Powered-By:
138
+ - "Servlet 2.4; Tomcat-5.0.28/JBoss-4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)"
139
+ Content-Type:
140
+ - text/xml;charset=utf-8
141
+ Transfer-Encoding:
142
+ - chunked
143
+ Date:
144
+ - Fri, 12 Oct 2012 17:59:05 GMT
145
+ Server:
146
+ - Apache-Coyote/1.1
147
+ body:
148
+ string: |-
149
+ <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:removeFromEshelfResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://www.exlibris.com/primo/xsd/wsRequest"><removeFromEshelfReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">&lt;SEGMENTS xmlns=&quot;http://www.exlibrisgroup.com/xsd/jaguar/search&quot;&gt;
150
+ &lt;JAGROOT&gt;
151
+ &lt;RESULT&gt;
152
+ &lt;ERROR MESSAGE=&quot;Remove from eshelf action completed successfully&quot; CODE=&quot;0&quot;/&gt;
153
+ &lt;/RESULT&gt;
154
+ &lt;/JAGROOT&gt;
155
+ &lt;/SEGMENTS&gt;
156
+ </removeFromEshelfReturn></ns1:removeFromEshelfResponse></soapenv:Body></soapenv:Envelope>
157
+ http_version:
158
+ recorded_at: Fri, 12 Oct 2012 17:59:06 GMT
159
+ recorded_with: VCR 2.2.5