Class: Stacked::User

Inherits:
Base
  • Object
show all
Defined in:
lib/stacked/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, association, collection, find, #initialize, #parse_answers, #parse_badges, #parse_comments, #parse_post_timeline, #parse_questions, #parse_reputations, #parse_tags, #parse_type, #parse_user_timeline, #post, records, request, singular, stats

Constructor Details

This class inherits a constructor from Stacked::Base

Instance Attribute Details

#about_meObject

Returns the value of attribute about_me.



3
4
5
# File 'lib/stacked/user.rb', line 3

def about_me
  @about_me
end

#accept_rateObject

Returns the value of attribute accept_rate.



3
4
5
# File 'lib/stacked/user.rb', line 3

def accept_rate
  @accept_rate
end

#ageObject

Returns the value of attribute age.



3
4
5
# File 'lib/stacked/user.rb', line 3

def age
  @age
end

#answer_countObject

Returns the value of attribute answer_count.



3
4
5
# File 'lib/stacked/user.rb', line 3

def answer_count
  @answer_count
end

#creation_dateObject Also known as: created_at

Returns the value of attribute creation_date.



3
4
5
# File 'lib/stacked/user.rb', line 3

def creation_date
  @creation_date
end

#display_nameObject Also known as: name

Returns the value of attribute display_name.



3
4
5
# File 'lib/stacked/user.rb', line 3

def display_name
  @display_name
end

#down_vote_countObject Also known as: down_votes

Returns the value of attribute down_vote_count.



3
4
5
# File 'lib/stacked/user.rb', line 3

def down_vote_count
  @down_vote_count
end

#email_hashObject Also known as: gravatar

Returns the value of attribute email_hash.



3
4
5
# File 'lib/stacked/user.rb', line 3

def email_hash
  @email_hash
end

#last_access_dateObject

Returns the value of attribute last_access_date.



3
4
5
# File 'lib/stacked/user.rb', line 3

def last_access_date
  @last_access_date
end

#locationObject

Returns the value of attribute location.



3
4
5
# File 'lib/stacked/user.rb', line 3

def location
  @location
end

#question_countObject

Returns the value of attribute question_count.



3
4
5
# File 'lib/stacked/user.rb', line 3

def question_count
  @question_count
end

#reputationObject

Returns the value of attribute reputation.



3
4
5
# File 'lib/stacked/user.rb', line 3

def reputation
  @reputation
end

#up_vote_countObject Also known as: up_votes

Returns the value of attribute up_vote_count.



3
4
5
# File 'lib/stacked/user.rb', line 3

def up_vote_count
  @up_vote_count
end

#user_idObject Also known as: id

Returns the value of attribute user_id.



3
4
5
# File 'lib/stacked/user.rb', line 3

def user_id
  @user_id
end

#user_typeObject Also known as: type

Returns the value of attribute user_type.



3
4
5
# File 'lib/stacked/user.rb', line 3

def user_type
  @user_type
end

#view_countObject Also known as: views

Returns the value of attribute view_count.



3
4
5
# File 'lib/stacked/user.rb', line 3

def view_count
  @view_count
end

#website_urlObject

Returns the value of attribute website_url.



3
4
5
# File 'lib/stacked/user.rb', line 3

def website_url
  @website_url
end

Class Method Details

.filter(filter, options = {}) ⇒ Object

Returns users matching the given filter.



27
28
29
30
# File 'lib/stacked/user.rb', line 27

def filter(filter, options={})
  options.reverse_merge!(:filter => filter)
  records(path, options)
end

Instance Method Details

#added_favorites(options = {}) ⇒ Object Also known as: added_favourites

Paginated favorites in the order they were added.



100
101
102
# File 'lib/stacked/user.rb', line 100

def added_favorites(options={})
  parse_questions(request(singular(id) + "favorites/added", options))
end

#answers(options = {}) ⇒ Object Also known as: recent_answers

Paginated answers for this user.



38
39
40
# File 'lib/stacked/user.rb', line 38

def answers(options={})
  parse_answers(request(singular(id) + "answers", options))
end

#answers_by_views(options = {}) ⇒ Object

Paginated answers by views for this user.



43
44
45
# File 'lib/stacked/user.rb', line 43

def answers_by_views(options={})
  parse_answers(request(singular(id) + "answers/views", options))
end

#answers_by_votes(options = {}) ⇒ Object

Paginated answers by votes for this user.



48
49
50
# File 'lib/stacked/user.rb', line 48

def answers_by_votes(options={})
  parse_answers(request(singular(id) + "answers/votes", options))
end

#badges(options = {}) ⇒ Object



169
170
171
# File 'lib/stacked/user.rb', line 169

def badges(options={})
  parse_badges(request(singular(id) + "badges", options))
end

#comments(options = {}) ⇒ Object

Paginated comments for this user.



62
63
64
# File 'lib/stacked/user.rb', line 62

def comments(options={})
  parse_comments(request(singular(id) + "comments", options))
end

#comments_by_score(options = {}) ⇒ Object Also known as: popular_comments

Paginated comments for this user ordered by score.



84
85
86
# File 'lib/stacked/user.rb', line 84

def comments_by_score(options={})
  parse_comments(request(singular(id) + "comments/score", options))
end

#directed_at(other_user_id, options = {}) ⇒ Object

Find a comment directed at other_user_id. Works only if you specify it the correct range. This method’s a bit funny. dev.meta.stackoverflow.com/questions/34747/comments-api-method



69
70
71
# File 'lib/stacked/user.rb', line 69

def directed_at(other_user_id, options={})
  parse_comments(request(singular(id) + "comments" + other_user_id.to_s, options))
end

#directed_at_by_date(other_user_id, options = {}) ⇒ Object

All comments directed at other_user_id ordered by creation date in descending order.



74
75
76
# File 'lib/stacked/user.rb', line 74

def directed_at_by_date(other_user_id, options={})
  parse_comments(request(singular(id) + "comments" + other_user_id.to_s + "recent", options))
end

#directed_at_by_score(other_user_id, options = {}) ⇒ Object

All comments directed at other_user_id ordered by votes.



79
80
81
# File 'lib/stacked/user.rb', line 79

def directed_at_by_score(other_user_id, options={})
  parse_comments(request(singular(id) + "comments" + other_user_id.to_s + "score", options))
end

#favorites(options = {}) ⇒ Object Also known as: favourites, recent_favourites

Paginated favorites.



105
106
107
# File 'lib/stacked/user.rb', line 105

def favorites(options={})
  parse_questions(request(singular(id) + "favorites", options))
end

#mentioned(options = {}) ⇒ Object Also known as: mentions



165
166
167
# File 'lib/stacked/user.rb', line 165

def mentioned(options={})
  parse_comments(request(singular(id) + "mentioned", options))
end

#newest_answers(options = {}) ⇒ Object

Newest answers for this user.



53
54
55
# File 'lib/stacked/user.rb', line 53

def newest_answers(options={})
  parse_answers(request(singular(id) + "answers/newest", options))
end

#newest_favorites(options = {}) ⇒ Object Also known as: newest_favourites



109
110
111
# File 'lib/stacked/user.rb', line 109

def newest_favorites(options={})
  parse_questions(request(singular(id) + "favorites/newest", options))
end

#newest_questions(options = {}) ⇒ Object

Questions #



135
136
137
# File 'lib/stacked/user.rb', line 135

def newest_questions(options={})
  parse_questions(request(singular(id) + "questions/newest", options))
end


113
114
115
# File 'lib/stacked/user.rb', line 113

def popular_favorites(options={})
  parse_questions(request(singular(id) + "favorites/views", options))
end

#questions(options = {}) ⇒ Object



139
140
141
# File 'lib/stacked/user.rb', line 139

def questions(options={})
  parse_questions(request(singular(id) + "questions", options))
end

#questions_by_views(options = {}) ⇒ Object



143
144
145
# File 'lib/stacked/user.rb', line 143

def questions_by_views(options={})
  parse_questions(request(singular(id) + "questions/views", options))
end

#questions_by_votes(options = {}) ⇒ Object Also known as: popular_questions



147
148
149
# File 'lib/stacked/user.rb', line 147

def questions_by_votes(options={})
  parse_questions(request(singular(id) + "questions/votes", options))
end

#recent_comments(options = {}) ⇒ Object

Paginated comments for this user ordered by date created.



91
92
93
# File 'lib/stacked/user.rb', line 91

def recent_comments(options={})
  parse_comments(request(singular(id) + "comments/recent", options))
end

#recent_favorites(options = {}) ⇒ Object



120
121
122
# File 'lib/stacked/user.rb', line 120

def recent_favorites(options={})
  parse_questions(request(singular(id) + "favorites/recent", options))
end

#recent_questions(options = {}) ⇒ Object



153
154
155
# File 'lib/stacked/user.rb', line 153

def recent_questions(options={})
  parse_questions(request(singular(id) + "questions/recent", options))
end

#reputations(options = {}) ⇒ Object

Other stuff #



161
162
163
# File 'lib/stacked/user.rb', line 161

def reputations(options={})
  parse_reputations(request(singular(id) + "reputation", options))
end

#tags(options = {}) ⇒ Object



173
174
175
# File 'lib/stacked/user.rb', line 173

def tags(options={})
  parse_tags(request(singular(id) + "tags", options))
end

#timeline(options = {}) ⇒ Object



179
180
181
# File 'lib/stacked/user.rb', line 179

def timeline(options={})
  parse_user_timeline(request(singular(id) + "timeline", options))
end