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.

Parameters:



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.

Parameters:

  • object (String, RedditKit::Comment, RedditKit::Link)

    A link or comment’s full name, a RedditKit::Link, or a RedditKit::Subreddit.

  • options (Hash)

    a customizable set of options

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.

Parameters:



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.

Parameters:



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.

Parameters:



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