Skip to content

Instantly share code, notes, and snippets.

@nullstyle
Created July 10, 2009 19:34
Show Gist options
  • Save nullstyle/144737 to your computer and use it in GitHub Desktop.
Save nullstyle/144737 to your computer and use it in GitHub Desktop.
# ===========================
# = Getting an access token =
# ===========================
require 'oauth'
require 'satisfaction'
satisfaction = Satisfaction.new
satisfaction.set_consumer "XXXX", "XXXXXXXXX"
request_token = satisfaction.request_token
system("open #{satisfaction.authorize_url(request_token)}")
puts "waiting for you to authorize the token... press return to continue"
gets
access_token = satisfaction.access_token(request_token)
# =========================
# = Using an access token =
# =========================
require 'oauth'
require 'satisfaction'
satisfaction = Satisfaction.new
satisfaction.set_consumer "XXXX", "XXXXXXXXX"
satisfaction.set_token "XXXX", "XXXXXXXXX" # this is the values from the access_token above
satisfaction.companies.post(
:name => "Scott's Tests Company - No Public Please",
:url => "http://nullstyle.com",
:domain => "stcnpp",
:website_url => "http://nullstyle.com")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment