Created
May 24, 2012 12:57
-
-
Save jlong/2781412 to your computer and use it in GitHub Desktop.
Creating a forum with the UserVoice API
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
#! /usr/bin/env ruby | |
require 'rubygems' | |
require "oauth" | |
require 'json' | |
# Trusted Client | |
KEY = 'CLIENT KEY' | |
SECRET = 'CLIENT SECRET' | |
SITE = 'http://your_subdomain.uservoice.com' | |
consumer = OAuth::Consumer.new(KEY, SECRET, :http_method => :post) | |
access_token = OAuth::AccessToken.new consumer | |
forum = { | |
"forum[name]" => 'Exciting New Stuff' | |
} | |
response = access_token.post("#{SITE}/api/v1/forums.json", forum) | |
forum_hash = JSON.parse(response.body) | |
puts forum_hash.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment