libis-services 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16c6005df56e91ea7b9806570aefb5a024bc01a4
4
- data.tar.gz: 4ab1b7d063c4f2aaf10143aca268051c176e56da
3
+ metadata.gz: 1939b9a4c0048b76d3d44dc3a002085ad7f39e28
4
+ data.tar.gz: 68fa2f7271055a8433dba8f832af917551c249d9
5
5
  SHA512:
6
- metadata.gz: d1d1080408037cc6725bcd78a3001269f733f8d8b06e7b8b32ad926c68425662f0050460da1233575787eb512eca4798ac371cf697fad1e60fcbe8c926a7b87e
7
- data.tar.gz: d41b1ef29ba1a94f66ab93c135d3383be513c6fde2180ab85998e096dc6174bfc5fef93014ce8c96be71b5c568f8670c398a2c251954c7dfd377f1f8c16ba041
6
+ metadata.gz: c57e4e644a234e526ffaa316114194df3fc17284e76e52c68e748d2e0d6821b856d12d110a5df40b33ccc711b1a5cc46e7e351d3a1c36bc763e469e5d33ddefd
7
+ data.tar.gz: 3aa269554726807010b99a8273fd9d02db1b9486acb86ea24cd35034e3fe5bc1782a28033c9b99d9d32230a6a74bbb5b7db9ddbbc19454fc7e54a965aed50ddb
@@ -15,22 +15,30 @@ module Libis
15
15
  end
16
16
 
17
17
  def search(field, value, library = '32KUL_LIBIS_NETWORK')
18
+
18
19
  result = get library, version: '1.2', operation: 'searchRetrieve', recordSchema: 'marcxml',
19
20
  query: "#{field}=#{value}"
20
21
 
21
- unless result['//diag:diagnostic'].blank?
22
- raise Libis::Services::ServiceError, "#{result['/searchRetrieveResponse/diag:diagnostic/diag:message']}"
23
- end
22
+ if result.is_a?(Libis::Tools::XmlDocument)
23
+
24
+ unless result['//diag:diagnostic'].blank?
25
+ raise Libis::Services::ServiceError, "#{result['/searchRetrieveResponse/diag:diagnostic/diag:message']}"
26
+ end
24
27
 
25
- result.xpath('//record').map do |record|
26
- Libis::Tools::XmlDocument.parse(record.to_s)
28
+ return result.xpath('//record').map do |record|
29
+ Libis::Tools::XmlDocument.parse(record.to_s)
30
+ end
27
31
  end
32
+
33
+ raise Libis::Services::ServiceError, "#{result[:error_type]} - #{result[:error_name]}" if result[:error_type]
34
+ raise Libis::Services::ServiceError, "Unexpected reply: '#{result.to_s}' (#{result.class})"
35
+
28
36
  end
29
37
 
30
38
  protected
31
39
 
32
40
  def result_parser(response)
33
- Libis::Tools::XmlDocument.parse(response)
41
+ Libis::Tools::XmlDocument.parse(response) rescue response
34
42
  end
35
43
 
36
44
  end
@@ -15,17 +15,25 @@ module Libis
15
15
  end
16
16
 
17
17
  def get_marc(alma_id)
18
- get 'primo_library/libweb/jqprimo/helpers/record_helper.jsp', id: "#{alma_id}.xml"
18
+ result = get "primo_library/libweb/jqp/record/#{alma_id}.xml"
19
+ return result if result.is_a?(Libis::Tools::XmlDocument)
20
+
21
+ raise Libis::Services::ServiceError, "#{result[:error_type]} - #{result[:error_name]}" if result[:error_type]
22
+ raise Libis::Services::ServiceError, "Unexpected reply: '#{result.to_s}' (#{result.class})"
19
23
  end
20
24
 
21
25
  def get_pnx(alma_id)
22
- get 'primo_library/libweb/jqprimo/helpers/record_helper.jsp', id: "#{alma_id}.pnx"
26
+ result = get "primo_library/libweb/jqp/record/#{alma_id}.pnx"
27
+ return result if result.is_a?(Libis::Tools::XmlDocument)
28
+
29
+ raise Libis::Services::ServiceError, "#{result[:error_type]} - #{result[:error_name]}" if result[:error_type]
30
+ raise Libis::Services::ServiceError, "Unexpected reply: '#{result.to_s}' (#{result.class})"
23
31
  end
24
32
 
25
33
  protected
26
34
 
27
35
  def result_parser(response)
28
- Libis::Tools::XmlDocument.parse(response)
36
+ Libis::Tools::XmlDocument.parse(response) rescue response
29
37
  end
30
38
  end
31
39
  end
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Services
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
  end
@@ -8,14 +8,14 @@ describe 'Alma' do
8
8
 
9
9
  let(:record) {
10
10
  {
11
- leader: '01206nas 2200337u 4500',
11
+ leader: '01205nas a2200337u 4500',
12
12
  controlfield: ['9930800070101471', '20151015113543.0', '881205c19679999be r|p|| 0|||a|dut c'],
13
13
  datafield: [
14
14
  {
15
15
  subfield: '(BeLVLBS)003080007LBS01-Aleph',
16
16
  :@tag => '035', :@ind1 => ' ', :@ind2 => ' '
17
17
  }, {
18
- subfield: 'Kerk en leven. Bisdom Antwerpen (0991).',
18
+ subfield: 'Kerk en leven. Bisdom Antwerpen (0991)',
19
19
  :@tag => '245', :@ind1 => '0', :@ind2 => '0'
20
20
  }, {
21
21
  subfield: 'K & L',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -316,3 +316,4 @@ test_files:
316
316
  - spec/rosetta_producer_spec.rb
317
317
  - spec/rosetta_sip_spec.rb
318
318
  - spec/spec_helper.rb
319
+ has_rdoc: