Sha256: 31f8d4be33cabd4f58fdd28f82f9ef9c3d3ffaaec93437d270c1a7ecc692ad32

Contents?: true

Size: 452 Bytes

Versions: 2

Compression:

Stored size: 452 Bytes

Contents

module Alma
  class LoanSet

    attr_reader :total_record_count, :list

    def initialize(ws_response)
      @ws_response = ws_response
      @total_record_count = ws_response.fetch('total_record_count', 0)
      @list ||= list_results
    end

    def response_records
      @ws_response['item_loans'].fetch('item_loan',[])
    end

    def list_results
      response_records.map do |loan|
        Alma::Loan.new(loan)
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alma-0.2.1 lib/alma/loan_set.rb
alma-0.2.0 lib/alma/loan_set.rb