Created
October 30, 2012 17:42
-
-
Save wlrs/3981774 to your computer and use it in GitHub Desktop.
uservoice api article positioning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uservoice-ruby' | |
require 'pp' | |
# plug me in your details | |
subdomain = 'wlrs' | |
api_key = '' | |
api_secret = '' | |
article_id = 133269 | |
client = UserVoice::Client.new(subdomain, api_key, api_secret).login_as_owner | |
article = client.get("/api/v1/articles/#{article_id}.json")['article'] | |
pp article | |
puts "\nupdating position...\n\n" | |
response = client.put("/api/v1/articles/#{article_id}.json", article: { | |
position: 1, | |
# we need to send the topic info when updating an article | |
# or the topic association is removed: | |
topic_id: article['topic']['id'], | |
topic_name: article['topic']['name'] | |
}) | |
pp response['article'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment