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

Commit

Permalink
Merge 71b6e81 into 5c405f7
Browse files Browse the repository at this point in the history
  • Loading branch information
willglynn committed Dec 17, 2013
2 parents 5c405f7 + 71b6e81 commit 1370287
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/redditkit/client/links.rb
Expand Up @@ -75,14 +75,23 @@ def links_with_domain(domain, options = {})
# @option options [String] :text The text value for the post, as Markdown.
# @option options [String] :captcha_identifier An identifier for a CAPTCHA, if the current user is required to fill one out.
# @option options [String] :captcha_value The value for the CAPTCHA with the given identifier, as filled out by the user.
# @option options [Boolean] :save If true, the link will be implicitly saved after submission.
def submit(title, subreddit, options = {})
subreddit_name = extract_string subreddit, :display_name
parameters = { :title => title, :sr => subreddit_name, :iden => options[:captcha_identifier], :captcha => options[:captcha_value] }
parameters = {
:title => title,
:sr => subreddit_name,
:iden => options[:captcha_identifier],
:captcha => options[:captcha_value],
:save => options[:save]
}

if options[:url]
parameters[:url] = options[:url]
parameters[:kind] = 'link'
else
parameters[:text] = options[:text]
parameters[:kind] = 'self'
end

post('api/submit', parameters)
Expand Down

0 comments on commit 1370287

Please sign in to comment.