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 CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -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'].gsub(/Basic /, '')
62
- user, pass = Base64.decode64(base64).split(":")
63
- @auth = yield user, pass
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
@@ -1,6 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'context'
3
- require 'base64'
4
3
 
5
4
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
5
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{twitter_server}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["technoweenie"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - technoweenie