authlogic-connect-andrewacove 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/gempackagetask'
6
6
  spec = Gem::Specification.new do |s|
7
7
  s.name = "authlogic-connect-andrewacove"
8
8
  s.authors = ['Lance Pollard', 'Andrew Cove']
9
- s.version = '0.5.5'
9
+ s.version = '0.5.6'
10
10
  s.summary = "Personal fork of Authlogic Connect: Oauth and OpenID made dead simple"
11
11
  s.homepage = "http://github.com/andrewacove/authlogic-connect"
12
12
  s.email = "andrewacove@gmail.com"
@@ -18,15 +18,23 @@ class OauthToken < AccessToken
18
18
 
19
19
  def get(path, options = {})
20
20
  config_options = self.class.send(:credentials)[:options]
21
- api_version = config_options[:api_version] unless config_options.nil?
21
+ unless config_options.nil?
22
+ api_version = config_options[:api_version]
23
+ user_agent = config_options[:user_agent]
24
+ end
22
25
  path.insert(0, "/#{api_version}") unless api_version.nil?
26
+ options.reverse_merge!("User-Agent" => user_agent) unless user_agent.nil?
23
27
  client.get(path, options)
24
28
  end
25
29
 
26
30
  def post(path, body='', headers ={})
27
31
  config_options = self.class.send(:credentials)[:options]
28
- api_version = config_options[:api_version] unless config_options.nil?
32
+ unless config_options.nil?
33
+ api_version = config_options[:api_version]
34
+ user_agent = config_options[:user_agent]
35
+ end
29
36
  path.insert(0, "/#{api_version}") unless api_version.nil?
37
+ headers.reverse_merge!("User-Agent" => user_agent) unless user_agent.nil?
30
38
  client.post(path, body, headers)
31
39
  end
32
40
 
@@ -18,15 +18,23 @@ class OauthToken < AccessToken
18
18
 
19
19
  def get(path, options = {})
20
20
  config_options = self.class.send(:credentials)[:options]
21
- api_version = config_options[:api_version] unless config_options.nil?
21
+ unless config_options.nil?
22
+ api_version = config_options[:api_version]
23
+ user_agent = config_options[:user_agent]
24
+ end
22
25
  path.insert(0, "/#{api_version}") unless api_version.nil?
26
+ options.reverse_merge! {"User-Agent" => user_agent} unless user_agent.nil?
23
27
  client.get(path, options)
24
28
  end
25
29
 
26
30
  def post(path, body='', headers ={})
27
31
  config_options = self.class.send(:credentials)[:options]
28
- api_version = config_options[:api_version] unless config_options.nil?
32
+ unless config_options.nil?
33
+ api_version = config_options[:api_version]
34
+ user_agent = config_options[:user_agent]
35
+ end
29
36
  path.insert(0, "/#{api_version}") unless api_version.nil?
37
+ headers.reverse_merge! {"User-Agent" => user_agent} unless user_agent.nil?
30
38
  client.post(path, body, headers)
31
39
  end
32
40
 
@@ -57,17 +65,14 @@ class OauthToken < AccessToken
57
65
  @oauth_key
58
66
  end
59
67
 
60
- def reset_consumer!
68
+
69
+ def consumer
61
70
  if oauth_version == 1.0
62
- @consumer = OAuth::Consumer.new(credentials[:key], credentials[:secret], config.merge(credentials[:options] || {}))
71
+ OAuth::Consumer.new(credentials[:key], credentials[:secret], config.merge(credentials[:options] || {}))
63
72
  else
64
- @consumer = OAuth2::Client.new(credentials[:key], credentials[:secret], config.merge(credentials[:options] || {}))
73
+ OAuth2::Client.new(credentials[:key], credentials[:secret], config.merge(credentials[:options] || {}))
65
74
  end
66
75
  end
67
-
68
- def consumer
69
- @consumer || reset_consumer!
70
- end
71
76
 
72
77
  # if we're lucky we can find it by the token.
73
78
  def find_by_key_or_token(key, token, options = {})
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlogic-connect-andrewacove
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 5
10
- version: 0.5.5
9
+ - 6
10
+ version: 0.5.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lance Pollard
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-06-30 00:00:00 -07:00
19
+ date: 2010-07-07 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency