Class: Rubyoverflow::Statistics

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyoverflow/statistics.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

change_end_point, client, convert_if_array, convert_to_id_list, #find_parse_querystring, request, #request

Constructor Details

#initialize(hash, request_path = '') ⇒ Statistics

Returns a new instance of Statistics.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rubyoverflow/statistics.rb', line 7

def initialize(hash, request_path = '')
  dash = StatisticsDash.new hash

  @total_questions = dash.total_questions
  @total_accepted = dash.total_accepted
  @total_badges = dash.total_badges
  @total_unanswered = dash.total_unanswered
  @total_votes = dash.total_votes
  @total_comments = dash.total_comments
  @total_answers = dash.total_answers
  @total_users = dash.total_users
  @questions_per_minute = dash.questions_per_minute
  @answers_per_minute = dash.answers_per_minute
  @badges_per_minute = dash.badges_per_minute
  @views_per_day = dash.views_per_day
  @site = ApiSite.new dash.site
  @api_version = ApiVersion.new dash.api_version
end

Instance Attribute Details

#answers_per_minuteObject (readonly)

Returns the value of attribute answers_per_minute.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def answers_per_minute
  @answers_per_minute
end

#api_versionObject (readonly)

Returns the value of attribute api_version.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def api_version
  @api_version
end

#badges_per_minuteObject (readonly)

Returns the value of attribute badges_per_minute.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def badges_per_minute
  @badges_per_minute
end

#questions_per_minuteObject (readonly)

Returns the value of attribute questions_per_minute.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def questions_per_minute
  @questions_per_minute
end

#siteObject (readonly)

Returns the value of attribute site.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def site
  @site
end

#total_acceptedObject (readonly)

Returns the value of attribute total_accepted.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def total_accepted
  @total_accepted
end

#total_answersObject (readonly)

Returns the value of attribute total_answers.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def total_answers
  @total_answers
end

#total_badgesObject (readonly)

Returns the value of attribute total_badges.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def total_badges
  @total_badges
end

#total_commentsObject (readonly)

Returns the value of attribute total_comments.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def total_comments
  @total_comments
end

#total_questionsObject (readonly)

Returns the value of attribute total_questions.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def total_questions
  @total_questions
end

#total_unansweredObject (readonly)

Returns the value of attribute total_unanswered.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def total_unanswered
  @total_unanswered
end

#total_usersObject (readonly)

Returns the value of attribute total_users.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def total_users
  @total_users
end

#total_votesObject (readonly)

Returns the value of attribute total_votes.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def total_votes
  @total_votes
end

#views_per_dayObject (readonly)

Returns the value of attribute views_per_day.



4
5
6
# File 'lib/rubyoverflow/statistics.rb', line 4

def views_per_day
  @views_per_day
end

Class Method Details

.retrieveObject

Retrieves the stats for the domain

Maps to ‘stats’



32
33
34
35
# File 'lib/rubyoverflow/statistics.rb', line 32

def retrieve
  hash, url = request('stats')
  Statistics.new hash['statistics'].first, url
end