# File lib/lasso/model/oauth_one.rb, line 1 def define_oauth_one(parent) eval <<OAUTHONE class OAuthOne#{parent} < #{parent} alias_attribute :oauth_token, :token_a alias_attribute :oauth_token_secret, :token_b validates_presence_of :oauth_token, :oauth_token_secret def client @client ||= OAuth::Consumer.new(config(:key), config(:secret), :site => config(:site), :request_token_path => config(:request_token_path), :authorize_path => config(:authorize_path), :access_token_path => config(:access_token_path)) end def access @access ||= OAuth::AccessToken.new(client, oauth_token, oauth_token_secret) end end OAUTHONE end
# File lib/lasso/model/oauth_two.rb, line 1 def define_oauth_two(parent) eval <<OAUTHTWO class OAuthTwo#{parent} < #{parent} alias_attribute :access_token, :token_a alias_attribute :refresh_token, :token_b validates_presence_of :access_token def client @client ||= OAuth2::Client.new(config(:key), config(:secret), :site => config(:site), :authorize_path => config(:authorize_path), :type => 'web_server', :access_token_path => config(:access_token_path)) end def access @access ||= OAuth2::AccessToken.new(client, access_token, refresh_token) end end OAUTHTWO end