Sha256: 4529919577c0fc1561bcc8363f79c8f54af6aae15dd42528a209ef61ef29d5b4

Contents?: true

Size: 618 Bytes

Versions: 7

Compression:

Stored size: 618 Bytes

Contents

module Redd
  module Objects
    class Thing
      # Things that can be saved to a user's account.
      module Saveable
        # Save a link or comment (if gilded) to the user's account.
        # @param [String] category A category to save to (if gilded).
        def save(category = nil)
          params = {id: fullname}
          params << {category: category} if category
          post("/api/save", params)
        end

        # Remove the link or comment from the user's saved links.
        def unsave
          post("/api/unsave", id: fullname)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
redd-0.7.6 lib/redd/objects/thing/saveable.rb
redd-0.7.5 lib/redd/objects/thing/saveable.rb
redd-0.7.4 lib/redd/objects/thing/saveable.rb
redd-0.7.3 lib/redd/objects/thing/saveable.rb
redd-0.7.2 lib/redd/objects/thing/saveable.rb
redd-0.7.1 lib/redd/objects/thing/saveable.rb
redd-0.7.0 lib/redd/objects/thing/saveable.rb