Sha256: 75282d407d4d8df6d5ace21dc33c8b7d6af491bc2a52445bde2fcc0a9091011c

Contents?: true

Size: 736 Bytes

Versions: 7

Compression:

Stored size: 736 Bytes

Contents

module Voyager
  class Collection
    attr_reader :holdings, :holdings_status
    
    def initialize(args = {})
      @connection = args[:connection] || raise("Must pass a connection")
      @bibid = args[:bibid] || raise("Must pass a bibid")
      @bibid = @bibid.to_s
            
      parse_results
      
    end
    
    def to_hash(args = {})
      {
        statuses: @holdings_status.to_hash(args)
      }
    end
    
    private
    
    def parse_results
      results = @connection.results['retrieve_holdings'][@bibid.to_s]
      @holdings = {}
     
      @holdings = results.reject { |r| r["MFHD_ID"].nil? } if results

      status = Status.new(@holdings)
      
      @holdings_status = status

    end
    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
voyager_oracle_api-1.1.1 lib/collection.rb
voyager_oracle_api-1.1.0 lib/collection.rb
voyager_oracle_api-1.0.0 lib/collection.rb
voyager_oracle_api-0.3.5 lib/collection.rb
voyager_oracle_api-0.3.4 lib/collection.rb
voyager_oracle_api-0.3.2 lib/collection.rb
voyager_oracle_api-0.3.0 lib/collection.rb