Module: Redd::Client::Authenticated::Moderation

Included in:
Redd::Client::Authenticated
Defined in:
lib/redd/client/authenticated/moderation.rb

Instance Method Summary collapse

Instance Method Details

#accept_moderator_invite(subreddit) ⇒ Object



24
25
26
27
# File 'lib/redd/client/authenticated/moderation.rb', line 24

def accept_moderator_invite(subreddit)
  name = extract_attribute(subreddit, :display_name)
  post "/r/#{name}/api/accept_moderator_invite", api_type: "json"
end

#approve(thing) ⇒ Object



5
6
7
8
# File 'lib/redd/client/authenticated/moderation.rb', line 5

def approve(thing)
  fullname = extract_fullname(thing)
  post "/api/approve", id: fullname
end

#distinguish(thing, how = :yes) ⇒ Object



15
16
17
18
# File 'lib/redd/client/authenticated/moderation.rb', line 15

def distinguish(thing, how = :yes)
  fullname = extract_fullname(thing)
  post "/api/distinguish", api_type: "json", id: fullname, how: how
end

#get_modqueue(*args) ⇒ Object



57
58
59
# File 'lib/redd/client/authenticated/moderation.rb', line 57

def get_modqueue(*args)
  get_submissions(:modqueue, *args)
end

#get_reports(*args) ⇒ Object



49
50
51
# File 'lib/redd/client/authenticated/moderation.rb', line 49

def get_reports(*args)
  get_submissions(:reports, *args)
end

#get_spam(*args) ⇒ Object



53
54
55
# File 'lib/redd/client/authenticated/moderation.rb', line 53

def get_spam(*args)
  get_submissions(:spam, *args)
end

#get_submissions(type, subreddit = nil, params = {}) ⇒ Object (private)



67
68
69
70
71
72
73
# File 'lib/redd/client/authenticated/moderation.rb', line 67

def get_submissions(type, subreddit = nil, params = {})
  subreddit_name = extract_attribute(subreddit, :display_name)
  path = "/about/#{type}.json"
  path = path.prepend("/r/#{subreddit_name}") if subreddit_name

  object_from_response :get, path, params
end

#get_unmoderated(*args) ⇒ Object



61
62
63
# File 'lib/redd/client/authenticated/moderation.rb', line 61

def get_unmoderated(*args)
  get_submissions(:unmoderated, *args)
end

#ignore_reports(thing) ⇒ Object



39
40
41
42
# File 'lib/redd/client/authenticated/moderation.rb', line 39

def ignore_reports(thing)
  fullname = extract_fullname(subreddit)
  post "/api/ignore_reports", id: fullname
end

#leave_contributor_status(subreddit) ⇒ Object



29
30
31
32
# File 'lib/redd/client/authenticated/moderation.rb', line 29

def leave_contributor_status(subreddit)
  fullname = extract_fullname(subreddit)
  post "/api/leavecontributor", id: fullname
end

#leave_moderator_status(subreddit) ⇒ Object



34
35
36
37
# File 'lib/redd/client/authenticated/moderation.rb', line 34

def leave_moderator_status(subreddit)
  fullname = extract_fullname(subreddit)
  post "/api/leavemoderator", id: fullname
end

#remove(thing) ⇒ Object



10
11
12
13
# File 'lib/redd/client/authenticated/moderation.rb', line 10

def remove(thing)
  fullname = extract_fullname(thing)
  post "/api/remove", id: fullname
end

#undistinguish(thing) ⇒ Object



20
21
22
# File 'lib/redd/client/authenticated/moderation.rb', line 20

def undistinguish(thing)
  distinguish(thing, :no)
end

#unignore_reports(thing) ⇒ Object



44
45
46
47
# File 'lib/redd/client/authenticated/moderation.rb', line 44

def unignore_reports(thing)
  fullname = extract_fullname(subreddit)
  post "/api/unignore_reports", id: fullname
end