Created
October 2, 2012 16:16
-
-
Save sideshowcoder/3820532 to your computer and use it in GitHub Desktop.
ActiveResource with OAuth2
This file contains hidden or 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
class ProtectedResource < ActiveResource::Base | |
# since the gateway uses oauth2 every call needs to be authenticated, | |
# so the token for is needed | |
class << self | |
attr_accessor :token_string | |
end | |
# setup the headers for oauth2 | |
def self.headers | |
{ 'authorization' => "Bearer #{token_string}"} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you set the token_string?