Skip to content

Instantly share code, notes, and snippets.

@wlrs
Created October 30, 2012 17:42
Show Gist options
  • Save wlrs/3981774 to your computer and use it in GitHub Desktop.
Save wlrs/3981774 to your computer and use it in GitHub Desktop.
uservoice api article positioning
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