Sha256: a6b61d7f7cd35a3d6b116d26dea6b82736d39b3e5276a1e6534f2d796679e7b3

Contents?: true

Size: 806 Bytes

Versions: 5

Compression:

Stored size: 806 Bytes

Contents

require 'berkeley_library/holdings/world_cat/symbols'

module BerkeleyLibrary
  module Holdings
    class HoldingsResult
      attr_reader :oclc_number, :wc_symbols, :ht_record_url, :wc_error, :ht_error

      def initialize(oclc_number, wc_symbols: [], wc_error: nil, ht_record_url: nil, ht_error: nil)
        @oclc_number = oclc_number
        @wc_symbols = wc_symbols
        @wc_error = wc_error
        @ht_record_url = ht_record_url
        @ht_error = ht_error
      end

      def nrlf?
        @has_nrlf ||= wc_symbols.intersection(WorldCat::Symbols::NRLF).any?
      end

      def srlf?
        @has_srlf ||= wc_symbols.intersection(WorldCat::Symbols::SRLF).any?
      end

      def uc_symbols
        @uc_symbols ||= wc_symbols.intersection(WorldCat::Symbols::UC)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
berkeley_library-holdings-1.0.5 lib/berkeley_library/holdings/holdings_result.rb
berkeley_library-holdings-1.0.4 lib/berkeley_library/holdings/holdings_result.rb
berkeley_library-holdings-1.0.3 lib/berkeley_library/holdings/holdings_result.rb
berkeley_library-holdings-1.0.2 lib/berkeley_library/holdings/holdings_result.rb
berkeley_library-holdings-1.0.1 lib/berkeley_library/holdings/holdings_result.rb