Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #34 from rewritten/patch-1

Faraday 0.8 is compatible with current usage, so why not allowing to use it?
  • Loading branch information...
commit 3bab3097902f7c06abc4dcd39308387c663c51f3 2 parents 6af3019 + e7587f4
@shayne shayne authored
Showing with 7 additions and 7 deletions.
  1. +1 −1  instagram.gemspec
  2. +6 −6 lib/faraday/oauth2.rb
View
2  instagram.gemspec
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('rspec', '~> 2.4')
s.add_development_dependency('webmock', '~> 1.6')
s.add_development_dependency('bluecloth', '~> 2.0.11')
- s.add_runtime_dependency('faraday', '~> 0.7')
+ s.add_runtime_dependency('faraday', ['>= 0.7', '< 0.9'])
s.add_runtime_dependency('faraday_middleware', '~> 0.8')
s.add_runtime_dependency('multi_json', '>= 1.0.3', '~> 1.0')
s.add_runtime_dependency('hashie', '>= 0.4.0')
View
12 lib/faraday/oauth2.rb
@@ -5,16 +5,16 @@ module FaradayMiddleware
# @private
class OAuth2 < Faraday::Middleware
def call(env)
-
if env[:method] == :get or env[:method] == :delete
- env[:url].query_values = {} if env[:url].query_values.nil?
+ query = Faraday::Utils.parse_query(env[:url].query)
- if @access_token and not env[:url].query_values["client_secret"]
- env[:url].query_values = env[:url].query_values.merge(:access_token => @access_token)
+ if @access_token and not query["client_secret"]
+ query.update(:access_token => @access_token)
env[:request_headers] = env[:request_headers].merge('Authorization' => "Token token=\"#{@access_token}\"")
elsif @client_id
- env[:url].query_values = env[:url].query_values.merge(:client_id => @client_id)
+ query.update(:client_id => @client_id)
end
+ env[:url].query = Faraday::Utils.build_query(query)
else
if @access_token and not env[:body] && env[:body][:client_secret]
env[:body] = {} if env[:body].nil?
@@ -25,7 +25,7 @@ def call(env)
end
end
- env[:url].query_values = nil if env[:url].query_values == {}
+ env[:url].query = nil if env[:url].query == ""
@app.call env
end
Please sign in to comment.
Something went wrong with that request. Please try again.