<commit_before>module Clever
  module APIOperations
    # Represents a page of data
    class Page
      attr_accessor :paging

      def initialize(uri, filters = {})
        @uri = uri
        @filters = filters

        response = Clever.request :get, uri, filters
        @list = Util.convert_to_clever_object response[:data]
        self.paging = response[:paging]
      end

      # rubocop:disable TrivialAccessors
      def all
        @list
      end
    end
  end
end<commit_msg>make Page enumerable, make hypermedia links accessible<commit_after>module Clever
  module APIOperations
    # Represents a page of data
    class Page
      include Enumerable

      attr_accessor :paging
      attr_accessor :links

      def initialize(uri, filters = {})
        @uri = uri
        @filters = filters

        response = Clever.request :get, uri, filters
        @list = Util.convert_to_clever_object response[:data]
        self.paging = response[:paging]
        self.links = {}
        response[:links].each do |link|
          links[link[:rel].to_sym] = link[:uri]
        end
      end

      def each(&blk)
        @list.each(&blk)
      end

      # TODO: remove this
      def all
        accum = []
        each do |elem|
          accum << elem
        end
        accum
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0790273556231003, 'fraction_numerical': 0.0, 'mean_word_length': 1.9266666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1772237', 'n_tokens_mistral': 381, 'n_tokens_neox': 377, 'n_words': 108}