Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Building an OAuth header requires knowing the HTTP method and does no…

…t require query variables on the URL.
  • Loading branch information...
commit 28f9b723f2c73be68dee94630c62c65031a52139 1 parent 1019485
@laserlemon laserlemon authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/twitter/base.rb
View
12 lib/twitter/base.rb
@@ -468,20 +468,20 @@ def connection_with_builders(builders)
@connection
end
- def oauth_header(path, options)
+ def oauth_header(path, options, method)
oauth_params = {
:consumer_key => self.consumer_key,
:consumer_secret => self.consumer_secret,
:access_key => self.access_key,
:access_secret => self.access_secret
}
- ROAuth.header(oauth_params, connection.build_url(path, options), options)
+ ROAuth.header(oauth_params, connection.build_url(path), options, method)
end
def perform_get(path, options={})
results = connection.get do |request|
request.url path, options
- request['Authorization'] = oauth_header(path, options)
+ request['Authorization'] = oauth_header(path, options, :get)
end.body
end
@@ -489,7 +489,7 @@ def perform_post(path, options={})
results = connection.post do |request|
request.path = path
request.body = options
- request['Authorization'] = oauth_header(path, {})
+ request['Authorization'] = oauth_header(path, options, :post)
end.body
end
@@ -497,14 +497,14 @@ def perform_put(path, options={})
results = connection.put do |request|
request.path = path
request.body = options
- request['Authorization'] = oauth_header(path, options)
+ request['Authorization'] = oauth_header(path, options, :put)
end.body
end
def perform_delete(path, options={})
results = connection.delete do |request|
request.url path, options
- request['Authorization'] = oauth_header(path, options)
+ request['Authorization'] = oauth_header(path, options, :delete)
end.body
end
Please sign in to comment.
Something went wrong with that request. Please try again.