libis-services 0.1.3 → 0.1.5
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/libis/services/alma/sru_service.rb +14 -6
 - data/lib/libis/services/primo/limo.rb +11 -3
 - data/lib/libis/services/version.rb +1 -1
 - data/spec/alma_service_spec.rb +2 -2
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1939b9a4c0048b76d3d44dc3a002085ad7f39e28
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 68fa2f7271055a8433dba8f832af917551c249d9
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 
     | 
    
         
            -
                       
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 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  
     | 
| 
      
 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  
     | 
| 
      
 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
         
     | 
    
        data/spec/alma_service_spec.rb
    CHANGED
    
    | 
         @@ -8,14 +8,14 @@ describe 'Alma' do 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
              let(:record) {
         
     | 
| 
       10 
10 
     | 
    
         
             
                {
         
     | 
| 
       11 
     | 
    
         
            -
                    leader: ' 
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 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: 
         
     |