Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Fix editusertext action #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/redditkit/client/miscellaneous.rb
Expand Up @@ -7,10 +7,15 @@ module Miscellaneous
# Edit the text or a self post or comment.
#
# @param object [String, RedditKit::Comment, RedditKit::Link] A link or comment's full name, a RedditKit::Link, or a RedditKit::Subreddit.
# @option options [String] text The new text for the link or comment.
# @option options [String] :text The text to update with
def edit(object, options)
parameters = { :text => options[:text], :thing_id => extract_full_name(object) }
post('/api/editusertext', parameters)
raise ArgumentError, "second paramater must be a hash." unless options.is_a?(Hash)
parameters = {
:text => options.fetch(:text),
:thing_id => extract_full_name(object),
:api_type => "json",
}
post '/api/editusertext', parameters
end

# Deletes a link or comment.
Expand Down