stacked 0.5.0 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +43 -0
- data/LICENSE +1 -1
- data/README.markdown +58 -25
- data/Rakefile +6 -45
- data/genddoc.sh +4 -1
- data/lib/stacked.rb +11 -9
- data/lib/stacked/answer.rb +10 -27
- data/lib/stacked/badge.rb +15 -11
- data/lib/stacked/base.rb +59 -92
- data/lib/stacked/client.rb +31 -0
- data/lib/stacked/comment.rb +13 -18
- data/lib/stacked/parser.rb +47 -0
- data/lib/stacked/post_timeline.rb +17 -0
- data/lib/stacked/question.rb +52 -51
- data/lib/stacked/{reputation.rb → rep_change.rb} +5 -3
- data/lib/stacked/tag.rb +10 -2
- data/lib/stacked/user.rb +29 -161
- data/lib/stacked/{usertimeline.rb → user_timeline.rb} +5 -5
- data/lib/stacked/version.rb +4 -0
- data/spec/fakes/answers/1237127 +0 -0
- data/spec/fakes/answers/2272830 +0 -0
- data/spec/fakes/answers/2558700 +0 -0
- data/spec/fakes/badges/index +0 -0
- data/spec/fakes/badges/name +0 -0
- data/spec/fakes/badges/tags +0 -0
- data/spec/fakes/comments/1063043 +0 -0
- data/spec/fakes/comments/2561833 +0 -0
- data/spec/fakes/questions/1236996 +0 -0
- data/spec/fakes/questions/1236996-answers +0 -0
- data/spec/fakes/questions/1236996-comments +0 -0
- data/spec/fakes/questions/1236996-timeline +0 -0
- data/spec/fakes/questions/4839321/answers +0 -0
- data/spec/fakes/questions/index +0 -0
- data/spec/fakes/questions/search +0 -0
- data/spec/fakes/questions/tagged +0 -0
- data/spec/fakes/questions/unanswered +0 -0
- data/spec/fakes/questions/withcomments +0 -0
- data/spec/fakes/stats/index +0 -0
- data/spec/fakes/tags/activity +0 -0
- data/spec/fakes/tags/index +0 -0
- data/spec/fakes/tags/name +0 -0
- data/spec/fakes/tags/popular +0 -0
- data/spec/fakes/users/148722 +0 -0
- data/spec/fakes/users/148722-comments +0 -0
- data/spec/fakes/users/148722-comments-by-creation +0 -0
- data/spec/fakes/users/148722-comments-by-votes +0 -0
- data/spec/fakes/users/22656 +0 -0
- data/spec/fakes/users/22656-answers +0 -0
- data/spec/fakes/users/22656-answers-by-activity +0 -0
- data/spec/fakes/users/22656-answers-by-creation +0 -0
- data/spec/fakes/users/22656-answers-by-views +0 -0
- data/spec/fakes/users/22656-answers-by-votes +0 -0
- data/spec/fakes/users/22656-badges +0 -0
- data/spec/fakes/users/22656-comments-mentioning-by-creation +0 -0
- data/spec/fakes/users/22656-comments-mentioning-by-votes +0 -0
- data/spec/fakes/users/22656-favorites +0 -0
- data/spec/fakes/users/22656-favorites-by-activity +0 -0
- data/spec/fakes/users/22656-favorites-by-added +0 -0
- data/spec/fakes/users/22656-favorites-by-creation +0 -0
- data/spec/fakes/users/22656-favorites-by-views +0 -0
- data/spec/fakes/users/22656-mentioned +0 -0
- data/spec/fakes/users/22656-questions +0 -0
- data/spec/fakes/users/22656-questions-by-activity +0 -0
- data/spec/fakes/users/22656-questions-by-creation +0 -0
- data/spec/fakes/users/22656-questions-by-views +0 -0
- data/spec/fakes/users/22656-questions-by-votes +0 -0
- data/spec/fakes/users/22656-reputation +0 -0
- data/spec/fakes/users/22656-reputation-ranged +0 -0
- data/spec/fakes/users/22656-tags +0 -0
- data/spec/fakes/users/22656-timeline +0 -0
- data/spec/fakes/users/filter +0 -0
- data/spec/fakes/users/index +0 -0
- data/spec/fakes/users/index-page2 +0 -0
- data/spec/fakes/users/index-pagesize1 +0 -0
- data/spec/fakes/users/name +0 -0
- data/spec/fakes/users/newest +0 -0
- data/spec/fakes/users/oldest +0 -0
- data/spec/sorted_by_spec.rb +2 -2
- data/spec/spec_helper.rb +10 -8
- data/spec/stacked/answer_spec.rb +9 -8
- data/spec/stacked/badge_spec.rb +11 -3
- data/spec/stacked/base_spec.rb +24 -2
- data/spec/stacked/comment_spec.rb +11 -9
- data/spec/stacked/question_spec.rb +49 -61
- data/spec/stacked/{reputation_spec.rb → rep_change_spec.rb} +9 -5
- data/spec/stacked/tag_spec.rb +13 -6
- data/spec/stacked/user_spec.rb +99 -70
- data/spec/stacked/{usertimeline_spec.rb → user_timeline_spec.rb} +1 -1
- data/spec/support/fakes.rb +28 -0
- data/spec/support/{sorted_by.rb → matchers/sorted_by.rb} +7 -6
- data/spec/support/{within.rb → matchers/within.rb} +3 -3
- data/spec/within_spec.rb +2 -2
- data/stacked.gemspec +23 -112
- metadata +248 -54
- data/README.rdoc +0 -18
- data/VERSION +0 -1
- data/doc/Stacked.html +0 -155
- data/doc/Stacked/Answer.html +0 -1394
- data/doc/Stacked/Badge.html +0 -480
- data/doc/Stacked/Base.html +0 -1124
- data/doc/Stacked/Comment.html +0 -1037
- data/doc/Stacked/NotImplemented.html +0 -162
- data/doc/Stacked/Posttimeline.html +0 -543
- data/doc/Stacked/Question.html +0 -1763
- data/doc/Stacked/Reputation.html +0 -606
- data/doc/Stacked/Tag.html +0 -267
- data/doc/Stacked/User.html +0 -2787
- data/doc/Stacked/Usertimeline.html +0 -630
- data/doc/_index.html +0 -246
- data/doc/file.README.html +0 -54
- data/doc/index.html +0 -54
- data/doc/method_list.html +0 -1203
- data/doc/top-level-namespace.html +0 -87
- data/lib/stacked/posttimeline.rb +0 -10
@@ -0,0 +1,31 @@
|
|
1
|
+
module Stacked
|
2
|
+
# Stacked::Client class.
|
3
|
+
class Client
|
4
|
+
|
5
|
+
class << self
|
6
|
+
# Default options used to build the request URL. Must override +api_key+
|
7
|
+
DEFAULT_OPTIONS = {
|
8
|
+
:site => 'stackoverflow.com',
|
9
|
+
:version => '1.0',
|
10
|
+
:api_key => 'key'
|
11
|
+
}
|
12
|
+
|
13
|
+
attr_accessor :site
|
14
|
+
attr_accessor :version
|
15
|
+
attr_accessor :api_key
|
16
|
+
attr_reader :base_url
|
17
|
+
|
18
|
+
def configure
|
19
|
+
yield self
|
20
|
+
|
21
|
+
@site ||= DEFAULT_OPTIONS[:site]
|
22
|
+
@version ||= DEFAULT_OPTIONS[:version]
|
23
|
+
@api_key ||= DEFAULT_OPTIONS[:api_key]
|
24
|
+
@base_url ||= "http://api.#{@site}/#{@version}/"
|
25
|
+
|
26
|
+
true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
data/lib/stacked/comment.rb
CHANGED
@@ -1,37 +1,32 @@
|
|
1
1
|
module Stacked
|
2
|
+
# Stacked::Comment class.
|
2
3
|
class Comment < Base
|
3
4
|
attr_accessor :body,
|
4
5
|
:comment_id,
|
5
6
|
:creation_date,
|
6
7
|
:edit_count,
|
7
|
-
:
|
8
|
-
:owner_user_id,
|
8
|
+
:owner,
|
9
9
|
:post_id,
|
10
10
|
:post_type,
|
11
|
-
:
|
11
|
+
:reply_to_user,
|
12
12
|
:score
|
13
|
+
|
14
|
+
alias_method :reply_to_d, :creation_date
|
13
15
|
|
14
16
|
class << self
|
15
17
|
def all(*args)
|
16
18
|
raise Stacked::NotImplemented
|
17
19
|
end
|
18
20
|
end
|
19
|
-
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
Stacked::User.find(reply_to_user_id) if reply_to_user_id
|
21
|
+
|
22
|
+
# Helper method for creating Stacked::User object when initializing new Stacked::Comment objects.
|
23
|
+
def owner=(attributes)
|
24
|
+
@owner = User.new(attributes)
|
24
25
|
end
|
25
|
-
|
26
|
-
#
|
27
|
-
def
|
28
|
-
@
|
26
|
+
|
27
|
+
# Helper method for creating Stacked::User object when initializing new Stacked::Comment objects.
|
28
|
+
def reply_to_user=(attributes)
|
29
|
+
@reply_to_user = User.new(attributes)
|
29
30
|
end
|
30
|
-
|
31
|
-
alias_method :created_at, :creation_date
|
32
|
-
alias_method :id, :comment_id
|
33
|
-
alias_method :user, :owner
|
34
|
-
alias_method :edits, :edit_count
|
35
|
-
|
36
31
|
end
|
37
32
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Stacked
|
2
|
+
module Parser
|
3
|
+
# Convert an answers result into a collection of Stacked::Answer objects.
|
4
|
+
def parse_answers(result)
|
5
|
+
parse_type(result, "answer")
|
6
|
+
end
|
7
|
+
# Convert a badges result into a collection of Stacked::Badge objects.
|
8
|
+
def parse_badges(result)
|
9
|
+
parse_type(result, "badge")
|
10
|
+
end
|
11
|
+
|
12
|
+
# Convert a comments result into a collection of Stacked::Comment objects.
|
13
|
+
def parse_comments(result)
|
14
|
+
parse_type(result, "comment")
|
15
|
+
end
|
16
|
+
|
17
|
+
# Convert a post timeline result into a collection of Stacked::PostTimeline objects.
|
18
|
+
def parse_post_timeline(result)
|
19
|
+
parse_type(result, "post_timeline")
|
20
|
+
end
|
21
|
+
|
22
|
+
# Convert a questions result into a collection of Stacked::Question objects.
|
23
|
+
def parse_questions(result)
|
24
|
+
parse_type(result, "question")
|
25
|
+
end
|
26
|
+
|
27
|
+
# Convert a reputation result into a collection of Stacked::Reputation objects.
|
28
|
+
def parse_rep_changes(result)
|
29
|
+
parse_type(result, "rep_change")
|
30
|
+
end
|
31
|
+
|
32
|
+
# Convert a tags result into a collection of Stacked::Tag objects.
|
33
|
+
def parse_tags(result)
|
34
|
+
parse_type(result, "tag")
|
35
|
+
end
|
36
|
+
|
37
|
+
# Convert a user timeline result into a collection of Stacked::Usertimeline objects.
|
38
|
+
def parse_user_timeline(result)
|
39
|
+
parse_type(result, "user_timeline")
|
40
|
+
end
|
41
|
+
|
42
|
+
# Converts the specified result into objects of the +type+ class.
|
43
|
+
def parse_type(result, type)
|
44
|
+
parse(result[type.pluralize], "Stacked::#{type.classify}".constantize)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Stacked
|
2
|
+
# Stacked::PostTimeline class.
|
3
|
+
class PostTimeline < Base
|
4
|
+
attr_accessor :action,
|
5
|
+
:comment_id,
|
6
|
+
:creation_date,
|
7
|
+
:owner,
|
8
|
+
:post_comments_url,
|
9
|
+
:post_id,
|
10
|
+
:post_revision_url,
|
11
|
+
:post_url,
|
12
|
+
:question_id,
|
13
|
+
:revision_guid,
|
14
|
+
:timeline_type,
|
15
|
+
:user
|
16
|
+
end
|
17
|
+
end
|
data/lib/stacked/question.rb
CHANGED
@@ -1,85 +1,86 @@
|
|
1
1
|
module Stacked
|
2
|
+
# Stacked::Question class.
|
2
3
|
class Question < Base
|
3
4
|
attr_accessor :accepted_answer_id,
|
4
5
|
:answer_count,
|
5
6
|
:answers,
|
6
7
|
:body,
|
8
|
+
:bounty_amount,
|
7
9
|
:bounty_closes_date,
|
10
|
+
:comments,
|
8
11
|
:community_owned,
|
9
|
-
:
|
12
|
+
:closed_date,
|
13
|
+
:closed_reason,
|
14
|
+
:creation_date,
|
10
15
|
:down_vote_count,
|
11
16
|
:favorite_count,
|
12
17
|
:last_activity_date,
|
13
18
|
:last_edit_date,
|
14
|
-
:
|
15
|
-
:
|
19
|
+
:locked_date,
|
20
|
+
:migrated,
|
21
|
+
:owner,
|
22
|
+
:protected_date,
|
16
23
|
:question_id,
|
24
|
+
:question_answers_url,
|
25
|
+
:question_comments_url,
|
26
|
+
:question_timeline_url,
|
17
27
|
:score,
|
18
28
|
:tags,
|
19
29
|
:title,
|
20
30
|
:up_vote_count,
|
21
31
|
:view_count
|
32
|
+
|
33
|
+
class << self
|
34
|
+
# All questions matching the search.
|
35
|
+
def search(options={})
|
36
|
+
parse(request(base + "search", options)[resource])
|
37
|
+
end
|
22
38
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
39
|
+
# All unanswered questions.
|
40
|
+
def unanswered(options={})
|
41
|
+
records(path + "/unanswered", options)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Answers for the question.
|
46
|
+
def answers(options={})
|
47
|
+
@answers = self.class.parse_answers(request(singular(question_id) + "/answers", options))
|
48
|
+
end
|
49
|
+
|
50
|
+
# Comments for the question.
|
51
|
+
def comments(options={})
|
52
|
+
@comments ||= self.class.parse_comments(request(singular(question_id) + "/comments", options))
|
53
|
+
end
|
35
54
|
|
55
|
+
# A timeline of the question.
|
56
|
+
def timeline(options={})
|
57
|
+
self.class.parse_post_timeline(request(singular(question_id) + "/timeline", options))
|
58
|
+
end
|
59
|
+
|
36
60
|
# The Stacked::Answer representing the accepted answer.
|
37
61
|
# nil if none accepted
|
38
62
|
def accepted_answer
|
39
63
|
Answer.find(accepted_answer_id) if accepted_answer_id
|
40
64
|
end
|
41
|
-
|
42
|
-
#
|
43
|
-
def
|
44
|
-
@
|
65
|
+
|
66
|
+
# Helper method for creating Stacked::Answer object when initializing new Stacked::Question objects.
|
67
|
+
def answers=(ans)
|
68
|
+
@answers = ans.map { |a| Answer.new(a) }
|
45
69
|
end
|
46
|
-
|
47
|
-
#
|
48
|
-
def
|
49
|
-
|
70
|
+
|
71
|
+
# Helper method for creating Stacked::Comment object when initializing new Stacked::Question objects.
|
72
|
+
def comments=(coms)
|
73
|
+
@comments = coms.map { |c| Comment.new(c) }
|
74
|
+
end
|
75
|
+
|
76
|
+
# Helper method for creating Stacked::User object when initializing new Stacked::Question objects.
|
77
|
+
def owner=(attributes)
|
78
|
+
@owner = User.new(attributes)
|
50
79
|
end
|
51
80
|
|
52
81
|
# Helper method for creating Stacked::Tag objects when initializing new Stacked::Question objects.
|
53
82
|
def tags=(tags)
|
54
83
|
@tags = tags.map { |name| Tag.new(:name => name) }
|
55
84
|
end
|
56
|
-
|
57
|
-
alias_method :created_at, :creation_date
|
58
|
-
alias_method :down_votes, :down_vote_count
|
59
|
-
alias_method :favorites, :favorite_count
|
60
|
-
alias_method :favourites, :favorite_count
|
61
|
-
alias_method :id, :question_id
|
62
|
-
alias_method :updated_at, :last_edit_date
|
63
|
-
alias_method :up_votes, :up_vote_count
|
64
|
-
alias_method :user, :owner
|
65
|
-
alias_method :views, :view_count
|
66
|
-
|
67
|
-
class << self
|
68
|
-
alias_method :newest_unanswered, :unanswered
|
69
|
-
|
70
|
-
# All unanswered questions ordered by votes.
|
71
|
-
def unanswered_by_votes(options={})
|
72
|
-
records(path + "unanswered/votes", options)
|
73
|
-
end
|
74
|
-
|
75
|
-
# All questions tagged with the given tags.
|
76
|
-
# Accepts tags as either +:tags+ or +:tagged+
|
77
|
-
# Must be an Array of tags.
|
78
|
-
def tagged(options={})
|
79
|
-
options[:tagged] ||= []
|
80
|
-
options[:tagged] = (options[:tagged] << options[:tags]).join(", ")
|
81
|
-
records(path + "tagged", options)
|
82
|
-
end
|
83
|
-
end
|
84
85
|
end
|
85
86
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
module Stacked
|
2
|
-
|
2
|
+
# Stacked::RepChange class.
|
3
|
+
class RepChange < Base
|
3
4
|
attr_accessor :negative_rep,
|
4
5
|
:on_date,
|
5
6
|
:positive_rep,
|
6
7
|
:post_id,
|
7
8
|
:post_type,
|
8
|
-
:title
|
9
|
-
|
9
|
+
:title,
|
10
|
+
:user_id
|
11
|
+
|
10
12
|
# Return the cumulative score of this reputation.
|
11
13
|
def score
|
12
14
|
positive_rep - negative_rep
|
data/lib/stacked/tag.rb
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
module Stacked
|
2
|
+
# Stacked::Tag class.
|
2
3
|
class Tag < Base
|
3
4
|
attr_accessor :count,
|
4
|
-
:
|
5
|
+
:fulfills_required,
|
6
|
+
:name,
|
7
|
+
:restricted_to,
|
8
|
+
:user_id
|
5
9
|
|
6
|
-
|
10
|
+
class << self
|
11
|
+
def find(*args)
|
12
|
+
raise Stacked::NotImplemented
|
13
|
+
end
|
14
|
+
end
|
7
15
|
|
8
16
|
end
|
9
17
|
end
|
data/lib/stacked/user.rb
CHANGED
@@ -1,195 +1,63 @@
|
|
1
1
|
module Stacked
|
2
|
+
# Stacked::User class.
|
2
3
|
class User < Base
|
3
|
-
attr_accessor :about_me,
|
4
|
-
:accept_rate,
|
5
|
-
:age,
|
6
|
-
:answer_count,
|
7
|
-
:creation_date,
|
8
|
-
:display_name,
|
9
|
-
:down_vote_count,
|
10
|
-
:email_hash,
|
11
|
-
:last_access_date,
|
12
|
-
:location,
|
13
|
-
:question_count,
|
14
|
-
:reputation,
|
15
|
-
:up_vote_count,
|
16
|
-
:user_id,
|
17
|
-
:user_type,
|
18
|
-
:view_count,
|
19
|
-
:website_url
|
20
|
-
|
21
|
-
collection :newest, :oldest, :name
|
22
4
|
|
23
5
|
class << self
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
def filter(filter, options={})
|
28
|
-
options.reverse_merge!(:filter => filter)
|
29
|
-
records(path, options)
|
6
|
+
# All moderators.
|
7
|
+
def moderators(options={})
|
8
|
+
records(path + "/moderators", options)
|
30
9
|
end
|
31
10
|
end
|
32
11
|
|
33
|
-
|
34
|
-
# Answers #
|
35
|
-
###########
|
36
|
-
|
37
|
-
# Paginated answers for this user.
|
12
|
+
# Answers by this user.
|
38
13
|
def answers(options={})
|
39
|
-
parse_answers(request(singular(
|
14
|
+
self.class.parse_answers(request(singular(user_id) + "/answers", options))
|
40
15
|
end
|
41
16
|
|
42
|
-
#
|
43
|
-
def
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
# Paginated answers by votes for this user.
|
48
|
-
def answers_by_votes(options={})
|
49
|
-
parse_answers(request(singular(id) + "answers/votes", options))
|
50
|
-
end
|
51
|
-
|
52
|
-
# Newest answers for this user.
|
53
|
-
def newest_answers(options={})
|
54
|
-
parse_answers(request(singular(id) + "answers/newest", options))
|
17
|
+
# Badges awarded to user.
|
18
|
+
def badges(options={})
|
19
|
+
self.class.parse_badges(request(singular(user_id) + "/badges", options))
|
55
20
|
end
|
56
|
-
|
57
|
-
############
|
58
|
-
# Comments #
|
59
|
-
############
|
60
21
|
|
61
|
-
#
|
22
|
+
# Comments by this user.
|
62
23
|
def comments(options={})
|
63
|
-
parse_comments(request(singular(
|
64
|
-
end
|
65
|
-
|
66
|
-
# Find a comment directed at +other_user_id+.
|
67
|
-
# Works only if you specify it the correct range.
|
68
|
-
# This method's a bit funny. http://dev.meta.stackoverflow.com/questions/34747/comments-api-method
|
69
|
-
def directed_at(other_user_id, options={})
|
70
|
-
parse_comments(request(singular(id) + "comments" + other_user_id.to_s, options))
|
24
|
+
self.class.parse_comments(request(singular(user_id) + "/comments", options))
|
71
25
|
end
|
72
26
|
|
73
|
-
#
|
74
|
-
def
|
75
|
-
parse_comments(request(singular(
|
76
|
-
end
|
77
|
-
|
78
|
-
# All comments directed at +other_user_id+ ordered by votes.
|
79
|
-
def directed_at_by_score(other_user_id, options={})
|
80
|
-
parse_comments(request(singular(id) + "comments" + other_user_id.to_s + "score", options))
|
27
|
+
# Comments by this user, mentioning another user
|
28
|
+
def comments_mentioning_user(other_user_id, options={})
|
29
|
+
self.class.parse_comments(request(singular(user_id) + "/comments/#{other_user_id}", options))
|
81
30
|
end
|
82
31
|
|
83
|
-
#
|
84
|
-
def comments_by_score(options={})
|
85
|
-
parse_comments(request(singular(id) + "comments/score", options))
|
86
|
-
end
|
87
|
-
|
88
|
-
alias_method :popular_comments, :comments_by_score
|
89
|
-
|
90
|
-
# Paginated comments for this user ordered by date created.
|
91
|
-
def recent_comments(options={})
|
92
|
-
parse_comments(request(singular(id) + "comments/recent", options))
|
93
|
-
end
|
94
|
-
|
95
|
-
##############
|
96
|
-
# Favourites #
|
97
|
-
##############
|
98
|
-
|
99
|
-
# Paginated favorites in the order they were added.
|
100
|
-
def added_favorites(options={})
|
101
|
-
parse_questions(request(singular(id) + "favorites/added", options))
|
102
|
-
end
|
103
|
-
|
104
|
-
# Paginated favorites.
|
32
|
+
# Favorites of this user.
|
105
33
|
def favorites(options={})
|
106
|
-
parse_questions(request(singular(
|
107
|
-
end
|
108
|
-
|
109
|
-
def newest_favorites(options={})
|
110
|
-
parse_questions(request(singular(id) + "favorites/newest", options))
|
34
|
+
self.class.parse_questions(request(singular(user_id) + "/favorites", options))
|
111
35
|
end
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
alias_method :favorites_by_views, :popular_favorites
|
118
|
-
alias_method :favourites_by_views, :popular_favorites
|
119
|
-
|
120
|
-
def recent_favorites(options={})
|
121
|
-
parse_questions(request(singular(id) + "favorites/recent", options))
|
122
|
-
end
|
123
|
-
|
124
|
-
# Silly Americans.
|
125
|
-
alias_method :added_favourites, :added_favorites
|
126
|
-
alias_method :favourites, :favorites
|
127
|
-
alias_method :popular_favourites, :popular_favorites
|
128
|
-
alias_method :recent_favourites, :favorites
|
129
|
-
alias_method :newest_favourites, :newest_favorites
|
130
|
-
|
131
|
-
#############
|
132
|
-
# Questions #
|
133
|
-
#############
|
134
|
-
|
135
|
-
def newest_questions(options={})
|
136
|
-
parse_questions(request(singular(id) + "questions/newest", options))
|
36
|
+
|
37
|
+
# Comments that are directed at user(s).
|
38
|
+
def mentioned(options={})
|
39
|
+
self.class.parse_comments(request(singular(user_id) + "/mentioned", options))
|
137
40
|
end
|
138
41
|
|
42
|
+
# Questions by user(s).
|
139
43
|
def questions(options={})
|
140
|
-
parse_questions(request(singular(
|
141
|
-
end
|
142
|
-
|
143
|
-
def questions_by_views(options={})
|
144
|
-
parse_questions(request(singular(id) + "questions/views", options))
|
145
|
-
end
|
146
|
-
|
147
|
-
def questions_by_votes(options={})
|
148
|
-
parse_questions(request(singular(id) + "questions/votes", options))
|
149
|
-
end
|
150
|
-
|
151
|
-
alias_method :popular_questions, :questions_by_votes
|
152
|
-
|
153
|
-
def recent_questions(options={})
|
154
|
-
parse_questions(request(singular(id) + "questions/recent", options))
|
155
|
-
end
|
156
|
-
|
157
|
-
###############
|
158
|
-
# Other stuff #
|
159
|
-
###############
|
160
|
-
|
161
|
-
def reputations(options={})
|
162
|
-
parse_reputations(request(singular(id) + "reputation", options))
|
44
|
+
self.class.parse_questions(request(singular(user_id) + "/questions", options))
|
163
45
|
end
|
164
46
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
def badges(options={})
|
170
|
-
parse_badges(request(singular(id) + "badges", options))
|
47
|
+
# Reputation changes for user(s).
|
48
|
+
def rep_changes(options={})
|
49
|
+
self.class.parse_rep_changes(request(singular(user_id) + "/reputation", options))
|
171
50
|
end
|
172
51
|
|
52
|
+
# Tags participated in by user(s).
|
173
53
|
def tags(options={})
|
174
|
-
parse_tags(request(singular(
|
54
|
+
self.class.parse_tags(request(singular(user_id) + "/tags", options))
|
175
55
|
end
|
176
56
|
|
177
|
-
|
178
|
-
|
57
|
+
# Timeline of actions by user(s).
|
179
58
|
def timeline(options={})
|
180
|
-
parse_user_timeline(request(singular(
|
59
|
+
self.class.parse_user_timeline(request(singular(user_id) + "/timeline", options))
|
181
60
|
end
|
182
61
|
|
183
|
-
alias_method :created_at, :creation_date
|
184
|
-
alias_method :down_votes, :down_vote_count
|
185
|
-
alias_method :gravatar, :email_hash
|
186
|
-
alias_method :id, :user_id
|
187
|
-
alias_method :name, :display_name
|
188
|
-
alias_method :recent_answers, :answers
|
189
|
-
alias_method :type, :user_type
|
190
|
-
alias_method :up_votes, :up_vote_count
|
191
|
-
alias_method :views, :view_count
|
192
|
-
|
193
|
-
|
194
62
|
end
|
195
63
|
end
|