Class: Serel::User

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #all, associations, attribute, config, #find, finder_methods, #get, #initialize, #inspect, #meth, method_missing, #network, network_wide, new_relation, request, respond_to?, #type, with_ids

Constructor Details

This class inherits a constructor from Serel::Base

Class Method Details

.elected_moderatorsObject



40
41
42
# File 'lib/serel/user.rb', line 40

def self.elected_moderators
  url("users/moderators/elected")
end

.moderatorsObject



36
37
38
# File 'lib/serel/user.rb', line 36

def self.moderators
  url("users/moderators")
end

Instance Method Details

#answersObject



44
45
46
# File 'lib/serel/user.rb', line 44

def answers
  type(:answer).url("users/#{id}/answers")
end

#badgesObject



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

def badges
  type(:badge).url("users/#{id}/badges")
end

#comments(to_id = nil) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/serel/user.rb', line 52

def comments(to_id = nil)
  if to_id
    type(:comment).url("users/#{id}/comments/#{to_id}")
  else
    type(:comment).url("users/#{id}/comments")
  end
end

#favoritesObject



60
61
62
# File 'lib/serel/user.rb', line 60

def favorites
  type(:question).url("users/#{id}/favorites")
end

#mentionedObject



64
65
66
# File 'lib/serel/user.rb', line 64

def mentioned
  type(:comment).url("users/#{id}/mentioned")
end

#privilegesObject



68
69
70
# File 'lib/serel/user.rb', line 68

def privileges
  type(:privilege).url("users/#{id}/privileges")
end

#questionsObject



72
73
74
# File 'lib/serel/user.rb', line 72

def questions
  type(:question).url("users/#{id}/questions")
end


76
77
78
# File 'lib/serel/user.rb', line 76

def questions_featured
  type(:question).url("users/#{id}/questions/featured")
end

#questions_no_answersObject



80
81
82
# File 'lib/serel/user.rb', line 80

def questions_no_answers
  type(:question).url("users/#{id}/questions/no-answers")
end

#questions_unacceptedObject



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

def questions_unaccepted
  type(:question).url("users/#{id}/questions/unaccepted")
end

#questions_unansweredObject



88
89
90
# File 'lib/serel/user.rb', line 88

def questions_unanswered
  type(:question).url("users/#{id}/questions/unanswered")
end

#reputationObject



92
93
94
# File 'lib/serel/user.rb', line 92

def reputation
  type(:reputation).url("users/#{id}/reputation")
end

#suggested_editsObject



96
97
98
# File 'lib/serel/user.rb', line 96

def suggested_edits
  type(:suggested_edit).url("users/#{id}/suggested-edits")
end

#tagsObject



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

def tags
  type(:tag).url("users/#{id}/tags")
end

#top_answers_on(*tags) ⇒ Object



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

def top_answers_on(*tags)
  arg = tags.length > 1 ? tags.join(";") : tags.pop
  type(:answer).url("users/#{id}/tags/#{arg}/top-answers")
end

#top_questions_on(*tags) ⇒ Object



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

def top_questions_on(*tags)
  arg = tags.length > 1 ? tags.join(";") : tags.pop
  type(:question).url("users/#{id}/tags/#{arg}/top-questions")
end