Sha256: 59bc6fb8c7356b713b6081a253b90350900d09353ac7efe1721df908e4ef7867

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

module Alma
  class RequestSet
    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::AlmaRecord.new(item)}
    end
    alias list each

    def size
      each.count
    end

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

    def key
      'user_request'
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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