Skip to content

Instantly share code, notes, and snippets.

@dwaynemac
Created August 25, 2010 14:19
Show Gist options
  • Save dwaynemac/549593 to your computer and use it in GitHub Desktop.
Save dwaynemac/549593 to your computer and use it in GitHub Desktop.
# app/models/person.rb
class Person < ActiveResource::Base
self.site = "http://api.oauth_protected_site.com"
end
# controller
@people = Person.find(:all)
# OAuth connection
@consumer=OAuth::Consumer.new( "key","secret", {:site=>"http://api.oauth_protected_site.com"})
@request_token=@consumer.get_request_token
@access_token=@request_token.get_access_token
# controller
@people = @access_token.get('/people.xml')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment