Permalink
Browse files

It all works again, now on the latest versions of all the dependencies.

  • Loading branch information...
1 parent fdb50d2 commit 26bdcdc13db0e1bb246781b38ba3a543419cf910 @tomtaylor tomtaylor committed Nov 30, 2011
Showing with 15 additions and 30 deletions.
  1. +7 −3 instapaper_full.gemspec
  2. +0 −24 lib/faraday/oauth.rb
  3. +8 −3 lib/instapaper_full.rb
@@ -19,7 +19,11 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_dependency("faraday", ">=0.5.5")
- s.add_dependency("simple_oauth", ">=0.1.4")
- s.add_dependency("yajl-ruby",">=0.8.1")
+ s.add_dependency("faraday", "~> 0.7.5")
+ s.add_dependency("faraday_middleware", "~> 0.7.0")
+ s.add_dependency("simple_oauth", "~> 0.1")
+ s.add_dependency("multi_json", "~> 1.0.4")
+ s.add_dependency("yajl-ruby", "~> 1.1.0")
+
+ s.add_development_dependency("rake")
end
View
@@ -1,24 +0,0 @@
-# from https://github.com/jnunemaker/twitter/blob/master/lib/faraday/oauth.rb
-
-require 'faraday'
-require 'simple_oauth'
-
-# @private
-module Faraday
- # @private
- class Request::OAuth < Faraday::Middleware
- def call(env)
- params = env[:body].is_a?(Hash) ? env[:body] : {}
- signature_params = params.reject{|k,v| v.respond_to?(:content_type) }
- header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)
-
- env[:request_headers]['Authorization'] = header.to_s
-
- @app.call(env)
- end
-
- def initialize(app, options)
- @app, @options = app, options
- end
- end
-end
@@ -1,4 +1,6 @@
-require 'faraday/oauth'
+require 'json'
+require 'faraday/request/oauth'
+require 'faraday/response/parse_json'
module InstapaperFull
class API
@@ -17,16 +19,19 @@ def connection
:consumer_key => @options[:consumer_key],
:consumer_secret => @options[:consumer_secret]
}
+
if authenticated?
oauth_options[:token] = @options[:oauth_token]
oauth_options[:token_secret] = @options[:oauth_token_secret]
end
- Faraday::Connection.new(options) do |builder|
+ Faraday.new(options) do |builder|
builder.use Faraday::Request::OAuth, oauth_options
+ builder.use Faraday::Request::UrlEncoded
+ builder.use Faraday::Response::Logger
builder.adapter Faraday.default_adapter
if authenticated?
- builder.response :yajl
+ builder.use Faraday::Response::ParseJson
end
end
end

0 comments on commit 26bdcdc

Please sign in to comment.