Permalink
Browse files

Pulling user agent out of configuration options.

  • Loading branch information...
1 parent 8967584 commit 27f5cee19d8888b90c66b55389d61c1b53098a13 @aac aac committed Jul 7, 2010
Showing with 11 additions and 3 deletions.
  1. +1 −1 Rakefile
  2. +10 −2 lib/authlogic_connect/oauth/tokens/oauth_token.rb
View
@@ -6,7 +6,7 @@ require 'rake/gempackagetask'
spec = Gem::Specification.new do |s|
s.name = "authlogic-connect-andrewacove"
s.authors = ['Lance Pollard', 'Andrew Cove']
- s.version = '0.5.5'
+ s.version = '0.5.6'
s.summary = "Personal fork of Authlogic Connect: Oauth and OpenID made dead simple"
s.homepage = "http://github.com/andrewacove/authlogic-connect"
s.email = "andrewacove@gmail.com"
@@ -18,15 +18,23 @@ def oauth_version
def get(path, options = {})
config_options = self.class.send(:credentials)[:options]
- api_version = config_options[:api_version] unless config_options.nil?
+ unless config_options.nil?
+ api_version = config_options[:api_version]
+ user_agent = config_options[:user_agent]
+ end
path.insert(0, "/#{api_version}") unless api_version.nil?
+ options.reverse_merge!("User-Agent" => user_agent) unless user_agent.nil?
client.get(path, options)
end
def post(path, body='', headers ={})
config_options = self.class.send(:credentials)[:options]
- api_version = config_options[:api_version] unless config_options.nil?
+ unless config_options.nil?
+ api_version = config_options[:api_version]
+ user_agent = config_options[:user_agent]
+ end
path.insert(0, "/#{api_version}") unless api_version.nil?
+ headers.reverse_merge!("User-Agent" => user_agent) unless user_agent.nil?
client.post(path, body, headers)
end

0 comments on commit 27f5cee

Please sign in to comment.