mbleigh-twitter-auth 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/app/models/twitter_auth/generic_user.rb +2 -0
- data/generators/twitter_auth/templates/migration.rb +2 -0
- data/lib/twitter_auth/dispatcher/shared.rb +1 -1
- data/lib/twitter_auth.rb +7 -1
- data/spec/twitter_auth/dispatcher/basic_spec.rb +7 -2
- data/spec/twitter_auth/dispatcher/oauth_spec.rb +8 -3
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -27,6 +27,8 @@ class TwitterAuthMigration < ActiveRecord::Migration
|
|
27
27
|
t.string :profile_link_color
|
28
28
|
t.string :profile_sidebar_border_color
|
29
29
|
t.string :profile_text_color
|
30
|
+
t.string :profile_background_image_url
|
31
|
+
t.boolean :profile_background_tiled
|
30
32
|
t.integer :friends_count
|
31
33
|
t.integer :statuses_count
|
32
34
|
t.integer :followers_count
|
@@ -16,7 +16,7 @@ module TwitterAuth
|
|
16
16
|
response.body
|
17
17
|
end
|
18
18
|
when Net::HTTPUnauthorized
|
19
|
-
raise TwitterAuth::Dispatcher::
|
19
|
+
raise TwitterAuth::Dispatcher::Unauthorized, 'The credentials provided did not authorize the user.'
|
20
20
|
else
|
21
21
|
message = begin
|
22
22
|
JSON.parse(response.body)['error']
|
data/lib/twitter_auth.rb
CHANGED
@@ -78,4 +78,10 @@ require 'twitter_auth/dispatcher/oauth'
|
|
78
78
|
require 'twitter_auth/dispatcher/basic'
|
79
79
|
require 'twitter_auth/dispatcher/shared'
|
80
80
|
|
81
|
-
|
81
|
+
module TwitterAuth
|
82
|
+
module Dispatcher
|
83
|
+
class Error < StandardError; end
|
84
|
+
class Unauthorized < Error; end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
@@ -54,12 +54,17 @@ describe TwitterAuth::Dispatcher::Basic do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'should set the error message to the JSON message' do
|
57
|
-
FakeWeb.register_uri('https://twitter.com:443/bad_response.json', :string => {'error' => 'bad response'}.to_json, :status => ['
|
57
|
+
FakeWeb.register_uri('https://twitter.com:443/bad_response.json', :string => {'error' => 'bad response'}.to_json, :status => ['403', 'Forbidden'])
|
58
58
|
lambda{@dispatcher.request(:get, '/bad_response')}.should raise_error(TwitterAuth::Dispatcher::Error, 'bad response')
|
59
59
|
end
|
60
60
|
|
61
|
+
it 'should raise a TwitterAuth::Dispatcher::Unauthorized on 401' do
|
62
|
+
FakeWeb.register_uri('https://twitter.com:443/unauthenticated_response.xml', :string => "<hash>\n<request>/unauthenticated_response.xml</request>\n<error>bad response</error>\n</hash>", :status => ['401', 'Unauthorized'])
|
63
|
+
lambda{@dispatcher.request(:get, '/unauthenticated_response.xml')}.should raise_error(TwitterAuth::Dispatcher::Unauthorized)
|
64
|
+
end
|
65
|
+
|
61
66
|
it 'should set the error message to the XML message' do
|
62
|
-
FakeWeb.register_uri('https://twitter.com:443/bad_response.xml', :string => "<hash>\n<request>/bad_response.xml</request>\n<error>bad response</error>\n</hash>", :status => ['
|
67
|
+
FakeWeb.register_uri('https://twitter.com:443/bad_response.xml', :string => "<hash>\n<request>/bad_response.xml</request>\n<error>bad response</error>\n</hash>", :status => ['403', 'Forbidden'])
|
63
68
|
lambda{@dispatcher.request(:get, '/bad_response')}.should raise_error(TwitterAuth::Dispatcher::Error, 'bad response')
|
64
69
|
end
|
65
70
|
end
|
@@ -51,13 +51,18 @@ describe TwitterAuth::Dispatcher::Oauth do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should set the error message to the JSON message' do
|
54
|
-
FakeWeb.register_uri('https://twitter.com:443/bad_response.json', :string => {'error' => 'bad response'}.to_json, :status => ['
|
54
|
+
FakeWeb.register_uri('https://twitter.com:443/bad_response.json', :string => {'error' => 'bad response'}.to_json, :status => ['403', 'Forbidden'])
|
55
55
|
lambda{@dispatcher.request(:get, '/bad_response')}.should raise_error(TwitterAuth::Dispatcher::Error, 'bad response')
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should set the error message to the XML message' do
|
59
|
-
FakeWeb.register_uri('https://twitter.com:443/bad_response.xml', :string => "<hash>\n<request>/bad_response.xml</request>\n<error>bad response</error>\n</hash>", :status => ['
|
60
|
-
lambda{@dispatcher.request(:get, '/bad_response')}.should raise_error(TwitterAuth::Dispatcher::Error, 'bad response')
|
59
|
+
FakeWeb.register_uri('https://twitter.com:443/bad_response.xml', :string => "<hash>\n<request>/bad_response.xml</request>\n<error>bad response</error>\n</hash>", :status => ['403', 'Forbidden'])
|
60
|
+
lambda{@dispatcher.request(:get, '/bad_response.xml')}.should raise_error(TwitterAuth::Dispatcher::Error, 'bad response')
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should raise a TwitterAuth::Dispatcher::Unauthorized on 401' do
|
64
|
+
FakeWeb.register_uri('https://twitter.com:443/unauthenticated_response.xml', :string => "<hash>\n<request>/unauthenticated_response.xml</request>\n<error>bad response</error>\n</hash>", :status => ['401', 'Unauthorized'])
|
65
|
+
lambda{@dispatcher.request(:get, '/unauthenticated_response.xml')}.should raise_error(TwitterAuth::Dispatcher::Unauthorized)
|
61
66
|
end
|
62
67
|
|
63
68
|
it 'should work with verb methods' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mbleigh-twitter-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|