Module: Redd::Objects::Thing::Saveable

Included in:
Comment, Submission
Defined in:
lib/redd/objects/thing/saveable.rb

Overview

Things that can be saved to a user’s account.

Instance Method Summary collapse

Instance Method Details

#save(category = nil) ⇒ Object

Save a link or comment (if gilded) to the user’s account.

Parameters:

  • category (String) (defaults to: nil)

    A category to save to (if gilded).



8
9
10
11
12
# File 'lib/redd/objects/thing/saveable.rb', line 8

def save(category = nil)
  params = { id: fullname }
  params[:category] = category if category
  post('/api/save', params)
end

#unsaveObject

Remove the link or comment from the user’s saved links.



15
16
17
# File 'lib/redd/objects/thing/saveable.rb', line 15

def unsave
  post('/api/unsave', id: fullname)
end