Sha256: b641ad7b3bc36cac241ffe2c90f56399bd525c8d03328d56fadb1a1cf3cb3eb7

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

module Alma
  class LoanSet
    extend Forwardable
    include Enumerable
    #include Alma::Error

    attr_reader :response
    def_delegators :response, :[], :fetch

    def initialize(response_body_hash)
      @response = response_body_hash
    end

    def each
      @response.fetch(key, []).map{|item| Alma::Loan.new(item)}
    end
    alias list each

    def size
      each.count
    end


    def key
      'item_loan'
    end

    def total_record_count
      fetch('total_record_count', 0)
    end
    alias :total_records :total_record_count

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alma-0.2.8 lib/alma/loan_set.rb