Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from newspaperclub/master

Fixed it all
  • Loading branch information...
commit 8f2dde611abd35de2a11471374b62993b57c8df3 2 parents fdb50d2 + 0797750
Matt Biddulph authored
View
10 instapaper_full.gemspec
@@ -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
24 lib/faraday/oauth.rb
@@ -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
View
11 lib/instapaper_full.rb
@@ -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
View
2  lib/instapaper_full/version.rb
@@ -1,3 +1,3 @@
module InstapaperFull
- VERSION = "0.0.4"
+ VERSION = "0.1.0"
end
Please sign in to comment.
Something went wrong with that request. Please try again.