Skip to content

Instantly share code, notes, and snippets.

@pius
Created July 17, 2009 15:16
Show Gist options
  • Save pius/149103 to your computer and use it in GitHub Desktop.
Save pius/149103 to your computer and use it in GitHub Desktop.
irb(main):005:0> satisfaction = Satisfaction.new
=> #<Satisfaction:0x180dff8 @identity_map=#<Sfn::IdentityMap:0x180df30 @pages={}, @records={}>, @options={:root=>"http://api.getsatisfaction.com", :autoload=>false, :authorize_url=>"http://getsatisfaction.com/api/authorize", :request_token_url=>"http://getsatisfaction.com/api/request_token", :access_token_url=>"http://getsatisfaction.com/api/access_token"}, @loader=#<Sfn::Loader:0x180df58 @cache=#<Sfn::Loader::HashCache:0x180decc @cached_responses={}>, @options={:cache=>:hash}>>
irb(main):006:0> satisfaction.set_consumer REDACTED, REDACTED
=> #<OAuth::Consumer:0x1808788 @options={:oauth_version=>"1.0", :request_token_path=>"/oauth/request_token", :authorize_path=>"/oauth/authorize", :access_token_path=>"/oauth/access_token", :signature_method=>"HMAC-SHA1", :scheme=>:header, :http_method=>:post, :proxy=>nil}, @secret=REDACTED, @key=REDACTED>
irb(main):007:0> request_token = satisfaction.request_token
=> #<OAuth::Token:0x18014c4 @secret=[REDACTED], @token=[REDACTED]>
irb(main):008:0> system("open #{satisfaction.authorize_url(request_token)}")
=> true
irb(main):009:0> access_token = satisfaction.access_token(request_token)
=> #<OAuth::Token:0x17f5ee4 @secret=[REDACTED], @token=[REDACTED]>
irb(main):011:0> satisfaction.set_token access_token.token, access_token.secret
=> #<OAuth::Token:0x17f109c @secret=[REDACTED], @token=[REDACTED]>
irb(main):012:0> satisfaction.companies.post(:name => "Dybercyne", :url => "http://d.cyberdyne.heroku.com", :domain => "fake", :website_url => "http://cyberdyne.heroku.com")
=> [:unauthorized, "Access Denied"]
irb(main):013:0> satisfaction.set_token access_token.secret, access_token.token
=> #<OAuth::Token:0x17db580 @secret=[REDACTED], @token=[REDACTED]>
irb(main):014:0> satisfaction.companies.post(:name => "Dybercyne", :url => "http://d.cyberdyne.heroku.com", :domain => "fake", :website_url => "http://cyberdyne.heroku.com")
=> [:unauthorized, "Access Denied"]
irb(main):016:0> satisfaction.companies.post(:name => "Scott's Tests Company - No Public Please", :url => "http://nullstyle.com", :domain => "stcnpp", :website_url => "http://nullstyle.com")
=> [:unauthorized, "Access Denied"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment