twitter_server 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/twitter_server.rb +5 -3
- data/test/helper.rb +0 -1
- data/test/sinatra/account_test.rb +3 -0
- data/twitter_server.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/twitter_server.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
+
require 'base64'
|
2
3
|
|
3
4
|
module TwitterServer
|
4
5
|
class << self
|
@@ -58,9 +59,10 @@ module Sinatra
|
|
58
59
|
|
59
60
|
def twitter_basic_auth
|
60
61
|
before do
|
61
|
-
base64 = env['HTTP_AUTHORIZATION']
|
62
|
-
|
63
|
-
|
62
|
+
if base64 = env['HTTP_AUTHORIZATION']
|
63
|
+
user, pass = Base64.decode64(base64.gsub(/Basic /, '')).split(":")
|
64
|
+
@auth = yield user, pass
|
65
|
+
end
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
data/test/helper.rb
CHANGED
@@ -4,6 +4,9 @@ class ApiAccountTest < TwitterServer::TestCase
|
|
4
4
|
class AccountApp < Sinatra::Base
|
5
5
|
register Sinatra::TwitterServer
|
6
6
|
|
7
|
+
twitter_basic_auth do |user, pass|
|
8
|
+
{:user => user, :pass => pass}
|
9
|
+
end
|
7
10
|
twitter_account_verify_credentials { {:id => 1} }
|
8
11
|
twitter_users_show { |params| {:id => 1, :screen_name => params.inspect, :status => {:text => 'holla'}} }
|
9
12
|
end
|
data/twitter_server.gemspec
CHANGED