Sha256: 791a9a2e90443282ef988c8eb26973f881888ee12cb311f45754bffa54da9512

Contents?: true

Size: 734 Bytes

Versions: 3

Compression:

Stored size: 734 Bytes

Contents

module StackExchange
  module StackOverflow

    class Statistics

      extend Forwardable

      def_delegators :@struct, :total_questions, :total_unanswered, :total_answers,
                              :total_comments, :total_votes, :total_badges,
                              :total_users, :questions_per_minute, :answers_per_minute,
                              :badges_per_minute, :api_version

      def initialize(hash)
        @struct = OpenStruct.new hash
      end

      class << self
        attr_reader :client

        def all(options = {})
          response = client.request('/stats', options)
          stats = response['statistics'].first
          Statistics.new stats
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pilha-0.1.5 lib/pilha/stack_overflow/statistics.rb
pilha-0.1.3 lib/pilha/stack_overflow/statistics.rb
pilha-0.1.2 lib/pilha/stack_overflow/statistics.rb