Module: RedditKit::Client::Miscellaneous

Included in:
RedditKit::Client
Defined in:
lib/redditkit/client/miscellaneous.rb

Overview

Methods which don’t belong in any clear categroy, such as editing and deleting items on reddit.

Instance Method Summary collapse

Instance Method Details

#delete(object) ⇒ Object

Deletes a link or comment.



19
20
21
22
# File 'lib/redditkit/client/miscellaneous.rb', line 19

def delete(object)
  full_name = extract_full_name object
  post 'api/del', :id => full_name
end

#edit(object, options) ⇒ Object

Edit the text or a self post or comment.

Options Hash (options):

  • text (String)

    The new text for the link or comment.



11
12
13
14
# File 'lib/redditkit/client/miscellaneous.rb', line 11

def edit(object, options)
  parameters = { :text => options[:text], :thing_id => extract_full_name(object) }
  post('/api/editusertext', parameters)
end

#report(object) ⇒ Object

Reports a link or comment. The reddit API will also hide the link or comment.



43
44
45
46
# File 'lib/redditkit/client/miscellaneous.rb', line 43

def report(object)
  full_name = extract_full_name object
  post 'api/report', :id => full_name
end

#save(object) ⇒ Object

Saves a link or comment.



27
28
29
30
# File 'lib/redditkit/client/miscellaneous.rb', line 27

def save(object)
  full_name = extract_full_name object
  post 'api/save', :id => full_name
end

#unsave(object) ⇒ Object

Unsaves a link or comment.



35
36
37
38
# File 'lib/redditkit/client/miscellaneous.rb', line 35

def unsave(object)
  full_name = extract_full_name object
  post 'api/unsave', :id => full_name
end