omniauth-twitter 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e6626f2d76da338cfcc7a60eb7881276193d59f
4
- data.tar.gz: 5a4b555f23c9bff6d3947d485d18b8f85ce9392f
3
+ metadata.gz: edfaab177e44aa04f7cfd4fa8068b019c76fbfe4
4
+ data.tar.gz: cfdf961107d830fd2e695c3a3970f934d0150fb6
5
5
  SHA512:
6
- metadata.gz: 35bced171375fac4f94231679e3707afbba5912a672cb284a30cc82f796736b2e67f32ee9fdbccfa8b41c2ad53f0e4f0e88a2ca9cd42aa787c13e0574da6a515
7
- data.tar.gz: 813b9096c7ed44a87530a4a7bdb162040809f4a4711baf5cd2cbab3af0ff16d09d5cdd5fdf1593627dfb40ebee6d004e5df64f3572cf1ecd62c7aed910b88a30
6
+ metadata.gz: 3c76675fc707da726fc34f00f7369856a39886668fe8e8627b9c8cb228136fdb3bcad02035ae911991f0bc7de3f5d8a84e3aa4810ffd8bef01a8743a6c360422
7
+ data.tar.gz: 84303d1f90d44ae137e70a1f5da8fdcdb82e3bcb258815f4723dd745ab6b7b3a4fee839d94fe0d39c84e972de870bde7690b3752fe51a1cc9f8fd72190144084
@@ -1,6 +1,6 @@
1
1
  rvm:
2
- - 1.8.7
3
- - 1.9.2
4
2
  - 1.9.3
5
- - ree
3
+ - 2.0.0
4
+ - 2.1.0
6
5
  - jruby
6
+ - rbx-2
@@ -0,0 +1,40 @@
1
+ # Contributing
2
+
3
+ For the best chance of having your changes merged, please:
4
+
5
+ * Fork the project.
6
+
7
+ * Make your feature addition or bug fix.
8
+
9
+ * Add tests for it. This is important so it is not accidentally broken in a future version.
10
+
11
+ * Commit, do not mess with rakefile, version, or history. (If you want to have your own version, that is fine but bump version in a commit by itself so it can be ignored when pulled).
12
+
13
+ * Send a pull request. Bonus points for topic branches.
14
+
15
+ If your proposed changes only affect documentation, include the following on a
16
+ new line in each of your commit messages:
17
+
18
+ ```
19
+ [ci skip]
20
+ ```
21
+
22
+ This will signal [Travis](https://travis-ci.org) that running the test suite is
23
+ not necessary for these changes.
24
+
25
+ # Reporting Bugs
26
+
27
+ If you are experiencing unexpected behavior and, after having read [omniauth](https://github.com/intridea/omniauth) and [omniauth-twitter](https://github.com/arunagw/omniauth-twitter)'s documentation, are convinced this behavior is a bug, please:
28
+
29
+ 1. [Search](https://github.com/arunagw/omniauth-twitter/issues) existing issues.
30
+ 2. Collect enough information to reproduce the issue:
31
+
32
+ * omniauth-twitter version
33
+
34
+ * Ruby version
35
+
36
+ * Specific setup conditions
37
+
38
+ * Description of expected behavior
39
+
40
+ * Description of actual behavior
data/README.md CHANGED
@@ -1,16 +1,20 @@
1
1
  # OmniAuth Twitter
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/omniauth-twitter.svg)](http://badge.fury.io/rb/omniauth-twitter)
4
+ [![CI Build Status](https://secure.travis-ci.org/arunagw/omniauth-twitter.svg?branch=master)](http://travis-ci.org/arunagw/omniauth-twitter)
5
+ [![Code Climate](https://codeclimate.com/github/arunagw/omniauth-twitter.png)](https://codeclimate.com/github/arunagw/omniauth-twitter)
6
+
3
7
  This gem contains the Twitter strategy for OmniAuth.
4
8
 
5
9
  Twitter offers a few different methods of integration. This strategy implements the browser variant of the "[Sign in with Twitter](https://dev.twitter.com/docs/auth/implementing-sign-twitter)" flow.
6
10
 
7
- Twitter uses OAuth 1.0a. Twitter's developer area contains ample documentation on how it implements this, so if you are really interested in the details, go check that out for more.
11
+ Twitter uses OAuth 1.0a. Twitter's developer area contains ample documentation on how it implements this, so check that out if you are really interested in the details.
8
12
 
9
13
  ## Before You Begin
10
14
 
11
15
  You should have already installed OmniAuth into your app; if not, read the [OmniAuth README](https://github.com/intridea/omniauth) to get started.
12
16
 
13
- Now sign in into the [Twitter developer area](http://dev.twitter.com) and create an application. Take note of your Consumer Key and Consumer Secret (not the Access Token and 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) 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.)
14
18
 
15
19
  ## Using This Strategy
16
20
 
@@ -30,11 +34,11 @@ Next, tell OmniAuth about this provider. For a Rails app, your `config/initializ
30
34
 
31
35
  ```ruby
32
36
  Rails.application.config.middleware.use OmniAuth::Builder do
33
- provider :twitter, "CONSUMER_KEY", "CONSUMER_SECRET"
37
+ provider :twitter, "API_KEY", "API_SECRET"
34
38
  end
35
39
  ```
36
40
 
37
- Replace CONSUMER_KEY and CONSUMER_SECRET with the appropriate values you obtained from dev.twitter.com earlier.
41
+ Replace `"API_KEY"` and `"API_SECRET"` with the appropriate values you obtained [earlier](https://apps.twitter.com).
38
42
 
39
43
  ## Authentication Options
40
44
 
@@ -60,7 +64,7 @@ Here's an example of a possible configuration where the the user's original prof
60
64
 
61
65
  ```ruby
62
66
  Rails.application.config.middleware.use OmniAuth::Builder do
63
- provider :twitter, ENV["TWITTER_KEY"], ENV["TWITTER_SECRET"],
67
+ provider :twitter, "API_KEY", "API_SECRET",
64
68
  {
65
69
  :secure_image_url => 'true',
66
70
  :image_size => 'original',
@@ -98,8 +102,8 @@ An example auth hash available in `request.env['omniauth.auth']`:
98
102
  :access_token => "", # An OAuth::AccessToken object
99
103
  :raw_info => {
100
104
  :name => "John Q Public",
101
- :listed_count" => 0,
102
- :profile_sidebar_border_color" => "181A1E",
105
+ :listed_count => 0,
106
+ :profile_sidebar_border_color => "181A1E",
103
107
  :url => nil,
104
108
  :lang => "en",
105
109
  :statuses_count => 129,
@@ -152,18 +156,11 @@ Ryan Bates has put together an excellent RailsCast on OmniAuth:
152
156
 
153
157
  ## Supported Rubies
154
158
 
155
- OmniAuth Twitter is tested under 1.8.7, 1.9.2, 1.9.3 and Ruby Enterprise Edition.
156
-
157
- [![CI Build
158
- Status](https://secure.travis-ci.org/arunagw/omniauth-twitter.png)](http://travis-ci.org/arunagw/omniauth-twitter)
159
+ OmniAuth Twitter is tested under 1.9.3, 2.0.0, 2.1.0, JRuby, and Rubinius.
159
160
 
160
- ## Note on Patches/Pull Requests
161
+ ## Contributing
161
162
 
162
- - Fork the project.
163
- - Make your feature addition or bug fix.
164
- - Add tests for it. This is important so I don’t break it in a future version unintentionally.
165
- - Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
166
- - Send me a pull request. Bonus points for topic branches.
163
+ Please read the [contribution guidelines](CONTRIBUTING.md) for some information on how to get started. No contribution is too small.
167
164
 
168
165
  ## License
169
166
 
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Twitter
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -51,7 +51,7 @@ module OmniAuth
51
51
  end
52
52
  end
53
53
 
54
- if request.params['use_authorize'] == 'true'
54
+ if options[:use_authorize] || request.params['use_authorize'] == 'true'
55
55
  options[:client_options][:authorize_path] = '/oauth/authorize'
56
56
  else
57
57
  options[:client_options][:authorize_path] = '/oauth/authenticate'
@@ -6,7 +6,7 @@ describe OmniAuth::Strategies::Twitter do
6
6
  subject do
7
7
  args = ['appid', 'secret', @options || {}].compact
8
8
  OmniAuth::Strategies::Twitter.new(*args).tap do |strategy|
9
- strategy.stub(:request) {
9
+ allow(strategy).to receive(:request) {
10
10
  request
11
11
  }
12
12
  end
@@ -30,7 +30,7 @@ describe OmniAuth::Strategies::Twitter do
30
30
  context 'when user has an image' do
31
31
  it 'should return image with size specified' do
32
32
  @options = { :image_size => 'original' }
33
- subject.stub(:raw_info).and_return(
33
+ allow(subject).to receive(:raw_info).and_return(
34
34
  { 'profile_image_url' => 'http://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0_normal.png' }
35
35
  )
36
36
  expect(subject.info[:image]).to eq('http://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0.png')
@@ -38,14 +38,14 @@ describe OmniAuth::Strategies::Twitter do
38
38
 
39
39
  it 'should return secure image with size specified' do
40
40
  @options = { :secure_image_url => 'true', :image_size => 'mini' }
41
- subject.stub(:raw_info).and_return(
41
+ allow(subject).to receive(:raw_info).and_return(
42
42
  { 'profile_image_url_https' => 'https://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0_normal.png' }
43
43
  )
44
44
  expect(subject.info[:image]).to eq('https://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0_mini.png')
45
45
  end
46
46
 
47
47
  it 'should return normal image by default' do
48
- subject.stub(:raw_info).and_return(
48
+ allow(subject).to receive(:raw_info).and_return(
49
49
  { 'profile_image_url' => 'http://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0_normal.png' }
50
50
  )
51
51
  expect(subject.info[:image]).to eq('http://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_0_normal.png')
@@ -56,15 +56,29 @@ describe OmniAuth::Strategies::Twitter do
56
56
  describe 'request_phase' do
57
57
  context 'with no request params set and x_auth_access_type specified' do
58
58
  before do
59
- subject.stub(:request).and_return(
59
+ allow(subject).to receive(:request).and_return(
60
60
  double('Request', {:params => {'x_auth_access_type' => 'read'}})
61
61
  )
62
- subject.stub(:old_request_phase).and_return(:whatever)
62
+ allow(subject).to receive(:old_request_phase).and_return(:whatever)
63
63
  end
64
64
 
65
65
  it 'should not break' do
66
66
  expect { subject.request_phase }.not_to raise_error
67
67
  end
68
68
  end
69
+
70
+ context "with no request params set and use_authorize options provided" do
71
+ before do
72
+ @options = { :use_authorize => true }
73
+ subject.stub(:request).and_return(
74
+ double('Request', {:params => {}})
75
+ )
76
+ subject.stub(:old_request_phase).and_return(:whatever)
77
+ end
78
+
79
+ it "should switch authorize_path from authenticate to authorize" do
80
+ expect { subject.request_phase }.to change { subject.options.client_options.authorize_path }.from('/oauth/authenticate').to('/oauth/authorize')
81
+ end
82
+ end
69
83
  end
70
84
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.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: 2013-10-04 00:00:00.000000000 Z
11
+ date: 2014-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_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
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.7'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.7'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack-test
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: OmniAuth strategy for Twitter
@@ -101,9 +101,10 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .rspec
106
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - CONTRIBUTING.md
107
108
  - Gemfile
108
109
  - README.md
109
110
  - Rakefile
@@ -123,17 +124,17 @@ require_paths:
123
124
  - lib
124
125
  required_ruby_version: !ruby/object:Gem::Requirement
125
126
  requirements:
126
- - - '>='
127
+ - - ">="
127
128
  - !ruby/object:Gem::Version
128
129
  version: '0'
129
130
  required_rubygems_version: !ruby/object:Gem::Requirement
130
131
  requirements:
131
- - - '>='
132
+ - - ">="
132
133
  - !ruby/object:Gem::Version
133
134
  version: '0'
134
135
  requirements: []
135
136
  rubyforge_project: omniauth-twitter
136
- rubygems_version: 2.0.6
137
+ rubygems_version: 2.2.2
137
138
  signing_key:
138
139
  specification_version: 4
139
140
  summary: OmniAuth strategy for Twitter