Sha256: 13bc07ee7a68cce198d86a5ede7d8b99c9b8677a4056da50d5421af183209323

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

module Alma
  class FineSet
    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 key
      'fee'
    end

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

    def size
      each.count
    end

    def sum
      fetch('total_sum', 0)
    end
    alias :total_sum :sum

    def currency
      fetch('currency', nil)
    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/fine_set.rb