Browse files

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

…t require query variables on the URL.
  • Loading branch information...
1 parent 1019485 commit 28f9b723f2c73be68dee94630c62c65031a52139 @laserlemon laserlemon committed Oct 9, 2010
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/twitter/base.rb
View
12 lib/twitter/base.rb
@@ -468,43 +468,43 @@ 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
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
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

0 comments on commit 28f9b72

Please sign in to comment.