omniauth-twitter 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/Gemfile +10 -3
- data/README.md +2 -2
- data/lib/omniauth-twitter/version.rb +1 -1
- data/lib/omniauth/strategies/twitter.rb +3 -3
- data/omniauth-twitter.gemspec +4 -9
- data/spec/omniauth/strategies/twitter_spec.rb +35 -4
- data/spec/spec_helper.rb +3 -1
- metadata +21 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35bac2bf2b4cec7b70d9652d5aa2a4c74abb2fe2
|
4
|
+
data.tar.gz: fbb4d0287de2e3bc2fdcf0fba42daaa4bca1be94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8b0a40dd9df0bcdbbc3d30f3b87bc818e6c3a4b906b19bd86eccf634bb7161d64c73dba0a5fc957d62c0bf4762bc3315a9263be74786742646be631a29706aa
|
7
|
+
data.tar.gz: d13034c4b1c453f9b5f41eeb3ae6ed7d1fa98484ed51351630823ef6e48a41bebbe8d5db8d5da98e02e79e2cd560d5ca416f728533b7aeedcbbb934d80813fb0
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'rake'
|
4
|
-
# Specify your gem's dependencies in omniauth-twitter.gemspec
|
5
3
|
gemspec
|
4
|
+
|
5
|
+
gem 'rake'
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem 'rspec', '~> 3.2'
|
9
|
+
gem 'rack-test'
|
10
|
+
gem 'simplecov'
|
11
|
+
gem 'webmock'
|
12
|
+
end
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Twitter uses OAuth 1.0a. Twitter's developer area contains ample documentation o
|
|
14
14
|
|
15
15
|
You should have already installed OmniAuth into your app; if not, read the [OmniAuth README](https://github.com/intridea/omniauth) to get started.
|
16
16
|
|
17
|
-
Now sign in into the [Twitter developer area](https://dev.twitter.com) and create an application. Take note of your API Key and API Secret (not the Access Token and Access Token Secret) because that is what your web application will use to authenticate against the Twitter API. Make sure to set a callback URL or else you may get authentication errors. (It doesn't matter what it is, just that it is set.)
|
17
|
+
Now sign in into the [Twitter developer area](https://dev.twitter.com/apps) and create an application. Take note of your API Key and API Secret (not the Access Token and Access Token Secret) because that is what your web application will use to authenticate against the Twitter API. Make sure to set a callback URL or else you may get authentication errors. (It doesn't matter what it is, just that it is set.)
|
18
18
|
|
19
19
|
## Using This Strategy
|
20
20
|
|
@@ -156,7 +156,7 @@ Ryan Bates has put together an excellent RailsCast on OmniAuth:
|
|
156
156
|
|
157
157
|
## Supported Rubies
|
158
158
|
|
159
|
-
OmniAuth Twitter is tested under 1.9.3, 2.0.0, 2.1.
|
159
|
+
OmniAuth Twitter is tested under 1.9.3, 2.0.0, 2.1.x, 2.2.x, JRuby, and Rubinius.
|
160
160
|
|
161
161
|
## Contributing
|
162
162
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'omniauth-oauth'
|
2
|
-
require '
|
2
|
+
require 'json'
|
3
3
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
@@ -27,11 +27,11 @@ module OmniAuth
|
|
27
27
|
end
|
28
28
|
|
29
29
|
extra do
|
30
|
-
{ :raw_info => raw_info }
|
30
|
+
skip_info? ? {} : { :raw_info => raw_info }
|
31
31
|
end
|
32
32
|
|
33
33
|
def raw_info
|
34
|
-
@raw_info ||=
|
34
|
+
@raw_info ||= JSON.load(access_token.get('/1.1/account/verify_credentials.json?include_entities=false&skip_status=true').body)
|
35
35
|
rescue ::Errno::ETIMEDOUT
|
36
36
|
raise ::Timeout::Error
|
37
37
|
end
|
data/omniauth-twitter.gemspec
CHANGED
@@ -8,21 +8,16 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Arun Agrawal"]
|
9
9
|
s.email = ["arunagw@gmail.com"]
|
10
10
|
s.homepage = "https://github.com/arunagw/omniauth-twitter"
|
11
|
-
s.summary = %q{OmniAuth strategy for Twitter}
|
12
11
|
s.description = %q{OmniAuth strategy for Twitter}
|
12
|
+
s.summary = s.description
|
13
13
|
s.license = "MIT"
|
14
14
|
|
15
|
-
s.rubyforge_project = "omniauth-twitter"
|
16
|
-
|
17
15
|
s.files = `git ls-files`.split("\n")
|
18
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
18
|
s.require_paths = ["lib"]
|
21
19
|
|
22
|
-
s.add_dependency '
|
23
|
-
s.
|
24
|
-
s.add_development_dependency '
|
25
|
-
s.add_development_dependency 'rack-test'
|
26
|
-
s.add_development_dependency 'simplecov'
|
27
|
-
s.add_development_dependency 'webmock'
|
20
|
+
s.add_dependency 'json', '~> 1.3'
|
21
|
+
s.add_dependency 'omniauth-oauth', '~> 1.1'
|
22
|
+
s.add_development_dependency 'bundler', '~> 1.0'
|
28
23
|
end
|
@@ -36,6 +36,14 @@ describe OmniAuth::Strategies::Twitter do
|
|
36
36
|
expect(subject.info[:image]).to eq('http://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0.png')
|
37
37
|
end
|
38
38
|
|
39
|
+
it 'should return bigger image when bigger size specified' do
|
40
|
+
@options = { :image_size => 'bigger' }
|
41
|
+
allow(subject).to receive(:raw_info).and_return(
|
42
|
+
{ 'profile_image_url' => 'http://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0_normal.png' }
|
43
|
+
)
|
44
|
+
expect(subject.info[:image]).to eq('http://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0_bigger.png')
|
45
|
+
end
|
46
|
+
|
39
47
|
it 'should return secure image with size specified' do
|
40
48
|
@options = { :secure_image_url => 'true', :image_size => 'mini' }
|
41
49
|
allow(subject).to receive(:raw_info).and_return(
|
@@ -53,6 +61,16 @@ describe OmniAuth::Strategies::Twitter do
|
|
53
61
|
end
|
54
62
|
end
|
55
63
|
|
64
|
+
describe 'skip_info option' do
|
65
|
+
context 'when skip info option is enabled' do
|
66
|
+
it 'should not include raw_info in extras hash' do
|
67
|
+
@options = { :skip_info => true }
|
68
|
+
allow(subject).to receive(:raw_info).and_return({:foo => 'bar'})
|
69
|
+
expect(subject.extra[:raw_info]).to eq(nil)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
56
74
|
describe 'request_phase' do
|
57
75
|
context 'with no request params set and x_auth_access_type specified' do
|
58
76
|
before do
|
@@ -70,15 +88,28 @@ describe OmniAuth::Strategies::Twitter do
|
|
70
88
|
context "with no request params set and use_authorize options provided" do
|
71
89
|
before do
|
72
90
|
@options = { :use_authorize => true }
|
73
|
-
subject.
|
74
|
-
double('Request', {:params => {}})
|
75
|
-
|
76
|
-
subject.
|
91
|
+
allow(subject).to receive(:request) do
|
92
|
+
double('Request', {:params => {} })
|
93
|
+
end
|
94
|
+
allow(subject).to receive(:old_request_phase) { :whatever }
|
77
95
|
end
|
78
96
|
|
79
97
|
it "should switch authorize_path from authenticate to authorize" do
|
80
98
|
expect { subject.request_phase }.to change { subject.options.client_options.authorize_path }.from('/oauth/authenticate').to('/oauth/authorize')
|
81
99
|
end
|
82
100
|
end
|
101
|
+
|
102
|
+
context "with no request params set and force_login specified" do
|
103
|
+
before do
|
104
|
+
allow(subject).to receive(:request) do
|
105
|
+
double('Request', {:params => { 'force_login' => true } })
|
106
|
+
end
|
107
|
+
allow(subject).to receive(:old_request_phase) { :whatever }
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should change add force_login=true to authorize_params" do
|
111
|
+
expect { subject.request_phase }.to change {subject.options.authorize_params.force_login}.from(nil).to(true)
|
112
|
+
end
|
113
|
+
end
|
83
114
|
end
|
84
115
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,99 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arun Agrawal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: omniauth-oauth
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2.7'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
38
|
+
- - ~>
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
40
|
+
version: '1.1'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: bundler
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
45
|
+
- - ~>
|
67
46
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: simplecov
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: webmock
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
47
|
+
version: '1.0'
|
90
48
|
type: :development
|
91
49
|
prerelease: false
|
92
50
|
version_requirements: !ruby/object:Gem::Requirement
|
93
51
|
requirements:
|
94
|
-
- -
|
52
|
+
- - ~>
|
95
53
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
54
|
+
version: '1.0'
|
97
55
|
description: OmniAuth strategy for Twitter
|
98
56
|
email:
|
99
57
|
- arunagw@gmail.com
|
@@ -101,9 +59,9 @@ executables: []
|
|
101
59
|
extensions: []
|
102
60
|
extra_rdoc_files: []
|
103
61
|
files:
|
104
|
-
-
|
105
|
-
-
|
106
|
-
-
|
62
|
+
- .gitignore
|
63
|
+
- .rspec
|
64
|
+
- .travis.yml
|
107
65
|
- CONTRIBUTING.md
|
108
66
|
- Gemfile
|
109
67
|
- README.md
|
@@ -124,17 +82,17 @@ require_paths:
|
|
124
82
|
- lib
|
125
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
84
|
requirements:
|
127
|
-
- -
|
85
|
+
- - '>='
|
128
86
|
- !ruby/object:Gem::Version
|
129
87
|
version: '0'
|
130
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
89
|
requirements:
|
132
|
-
- -
|
90
|
+
- - '>='
|
133
91
|
- !ruby/object:Gem::Version
|
134
92
|
version: '0'
|
135
93
|
requirements: []
|
136
|
-
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.0.14
|
138
96
|
signing_key:
|
139
97
|
specification_version: 4
|
140
98
|
summary: OmniAuth strategy for Twitter
|