Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update faraday for better HTTPS support

  • Loading branch information...
commit 6d05485a22dc7a3e69a4736a9c583b42aac34462 1 parent 6046669
@technoweenie technoweenie authored
Showing with 13 additions and 6 deletions.
  1. +1 −1  Rakefile
  2. +11 −4 lib/oauth2/client.rb
  3. +1 −1  spec/spec_helper.rb
View
2  Rakefile
@@ -10,7 +10,7 @@ begin
gem.email = "michael@intridea.com"
gem.homepage = "http://github.com/intridea/oauth2"
gem.authors = ["Michael Bleigh"]
- gem.add_dependency 'faraday', '~> 0.3.0'
+ gem.add_dependency 'faraday', '~> 0.4.1'
gem.add_development_dependency "rspec", ">= 1.2.9"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
View
15 lib/oauth2/client.rb
@@ -3,9 +3,16 @@
module OAuth2
class Client
class << self
- attr_accessor :default_connection_adapter
+ def default_connection_adapter
+ warn '[DEPRECATED] OAuth2::Client#default_connection_adapter is deprecated, use Faraday.default_adapter instead. Will be removed in 0.1.0'
+ Faraday.default_adapter
+ end
+
+ def default_connection_adapter=(adapter)
+ warn '[DEPRECATED] OAuth2::Client#default_connection_adapter is deprecated, use Faraday.default_adapter instead. Will be removed in 0.1.0'
+ Faraday.default_adapter = adapter
+ end
end
- self.default_connection_adapter = :net_http
attr_accessor :id, :secret, :site, :connection, :options
@@ -21,13 +28,13 @@ class << self
# <tt>:access_token_path</tt> :: Specify the path to the access token endpoint.
# <tt>:access_token_url</tt> :: Specify the full URL of the access token endpoint.
def initialize(client_id, client_secret, opts = {})
- adapter = opts.delete(:adapter) || self.class.default_connection_adapter
+ adapter = opts.delete(:adapter)
self.id = client_id
self.secret = client_secret
self.site = opts.delete(:site) if opts[:site]
self.options = opts
self.connection = Faraday::Connection.new(site)
- if adapter != :test
+ if adapter && adapter != :test
connection.build { |b| b.adapter(adapter) }
end
end
View
2  spec/spec_helper.rb
@@ -5,7 +5,7 @@
require 'spec'
require 'spec/autorun'
-OAuth2::Client.default_connection_adapter = :test
+Faraday.default_adapter = :test
Spec::Runner.configure do |config|
Please sign in to comment.
Something went wrong with that request. Please try again.