omniauth-vkontakte 1.4.0 → 1.6.1

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
- SHA1:
3
- metadata.gz: 1bbb5ebfe457fb2b2fa3c01baabc9fb69d6042fc
4
- data.tar.gz: 21bc7b86af4c1e5a6747b1cef1ca3de5f01849db
2
+ SHA256:
3
+ metadata.gz: 13aa87f9404267d06342ee9a10b702870eb028dc6f6723752ac89ffb9f4bff85
4
+ data.tar.gz: 3f305a40036e95cc43011325fcd0411c0687131109ccd4789d6d2a6146d3c97d
5
5
  SHA512:
6
- metadata.gz: 5dea88602f662ea0ca3f13807e1047970fd5778ba49149a9474a7c9259f9ce2932c56f34c93c43bee1b09508c0ca10cb31b3118b233af01e90db64bb5313ad05
7
- data.tar.gz: b5424f4bfb1e0aa035e5918cd75af5f991b62d0ad9f7978d8ccb1d672055b996c441c901d1e616a008d35deb938d4520f61c60632114e0c0b785f6381285b655
6
+ metadata.gz: 7fea2f768f4503eedb8d0f6675df790a5130f745434ef7de0093ee0a107a746d72e6e0f774e44be791e0f2f8590cc47ca66b35bfcfd6450750ffb85fe676dc40
7
+ data.tar.gz: d48097f8caf9163047a7bd6d0d93fdb8dbeebb58f3242d92079b73088ca95561d0314af9ca8d25d2162005bee6112e59e38d41c086694e10be5490bcec13da45
@@ -0,0 +1,23 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.6
20
+ - name: Install dependencies
21
+ run: bundle install
22
+ - name: Run tests
23
+ run: rspec
@@ -0,0 +1,14 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.6
4
+ Metrics/LineLength:
5
+ Max: 120
6
+ Metrics/MethodLength:
7
+ Enabled: false
8
+ Metrics/BlockLength:
9
+ Enabled: false
10
+ Metrics/ClassLength:
11
+ Max: 101
12
+ Naming/FileName:
13
+ Exclude:
14
+ - 'lib/omniauth-vkontakte.rb'
@@ -5,10 +5,9 @@ before_install:
5
5
  - gem update --system
6
6
  - gem --version
7
7
  rvm:
8
- - 2.4.0
9
- - 2.3.1
10
- - 2.2.6
11
- - 2.1
12
- - 2.0
13
- - 1.9.3
14
- - jruby-19mode
8
+ - 2.7.1
9
+ - 2.6.6
10
+ - jruby-head
11
+ script:
12
+ - bundle exec rspec
13
+ - bundle exec rubocop
data/Gemfile CHANGED
@@ -1,13 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- gem 'rake'
6
7
  gem 'rack', RUBY_VERSION < '2.2.2' ? '~> 1.6' : '>= 2.0'
8
+ gem 'rake'
9
+
10
+ group :development do
11
+ gem 'rubocop', require: false
12
+ end
7
13
 
8
14
  group :test do
9
- gem 'rspec', '~> 3.2'
10
15
  gem 'rack-test'
16
+ gem 'rspec'
11
17
  gem 'simplecov'
12
18
  gem 'webmock'
13
19
  end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2011-2020 Anton Maminov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # OmniAuth VKontakte
2
2
 
3
- [![Build Status][travis_badge]][travis]
3
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/149c0614deef469faa49e1e8ae384bd3)](https://app.codacy.com/app/mamantoha/omniauth-vkontakte?utm_source=github.com&utm_medium=referral&utm_content=mamantoha/omniauth-vkontakte&utm_campaign=Badge_Grade_Dashboard)
4
+ [![Build Status](https://travis-ci.org/mamantoha/omniauth-vkontakte.svg?branch=master)](https://travis-ci.org/mamantoha/omniauth-vkontakte)
4
5
  [![Gem Version][rubygems_badge]][rubygems]
5
- [![Code Climate][codeclimate_badge]][codeclimate]
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/1ea61cb860f9f6aafb4f/maintainability)](https://codeclimate.com/github/mamantoha/omniauth-vkontakte/maintainability)
6
7
 
7
8
  This is the unofficial [OmniAuth](https://github.com/intridea/omniauth) strategy for authenticating to VKontakte via OAuth.
8
9
  To use it, you'll need to sign up for an OAuth2 Application ID and Secret
@@ -26,13 +27,12 @@ Here's a quick example, adding the middleware to a Rails app in `config/initiali
26
27
 
27
28
  ```ruby
28
29
  Rails.application.config.middleware.use OmniAuth::Builder do
29
- provider :vkontakte, ENV['API_KEY'], ENV['API_SECRET']
30
+ provider :vkontakte, ENV['VK_API_ID'], ENV['VK_API_SECRET']
30
31
  end
31
32
  ```
32
33
 
33
34
  [See the example Sinatra app](https://github.com/mamantoha/omniauth-vkontakte/blob/master/examples/main.rb).
34
35
 
35
-
36
36
  ## Configuring
37
37
 
38
38
  You can configure several options, which you pass in to the `provider` method via a `Hash`:
@@ -50,14 +50,12 @@ Here's an example of a possible configuration:
50
50
 
51
51
  ```ruby
52
52
  use OmniAuth::Builder do
53
- provider :vkontakte, ENV['API_KEY'], ENV['API_SECRET'],
54
- {
55
- :scope => 'friends,audio,photos',
56
- :display => 'popup',
57
- :lang => 'en',
58
- :https => 1,
59
- :image_size => 'original'
60
- }
53
+ provider :vkontakte, ENV['VKONTAKTE_KEY'], ENV['VKONTAKTE_SECRET'],
54
+ scope: 'friends,audio,photos',
55
+ display: 'popup',
56
+ lang: 'en',
57
+ https: 1,
58
+ image_size: 'original'
61
59
  end
62
60
  ```
63
61
 
@@ -101,13 +99,12 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
101
99
 
102
100
  The precise information available may depend on the permissions which you request.
103
101
 
104
-
105
102
  ## Supported Rubies
106
103
 
107
104
  Tested with the following Ruby versions:
108
105
 
109
- - Ruby MRI (1.9.3+)
110
- - JRuby (1.9 mode)
106
+ - Ruby MRI (2.3.0+)
107
+ - JRuby
111
108
 
112
109
  ## Contributing to omniauth-vkontakte
113
110
 
@@ -115,20 +112,9 @@ Tested with the following Ruby versions:
115
112
 
116
113
  ## License
117
114
 
118
- Copyright (c) 2011-2017 Anton Maminov
119
-
120
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
121
-
122
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
115
+ Copyright: 2011-2020 Anton Maminov (anton.maminov@gmail.com)
123
116
 
124
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
125
-
126
- [travis_badge]: http://img.shields.io/travis/mamantoha/omniauth-vkontakte.svg?style=flat
127
- [travis]: https://travis-ci.org/mamantoha/omniauth-vkontakte
117
+ This library is distributed under the MIT license. Please see the LICENSE file.
128
118
 
129
119
  [rubygems_badge]: http://img.shields.io/gem/v/omniauth-vkontakte.svg?style=flat
130
120
  [rubygems]: http://rubygems.org/gems/omniauth-vkontakte
131
-
132
- [codeclimate_badge]: http://img.shields.io/codeclimate/github/mamantoha/omniauth-vkontakte.svg?style=flat
133
- [codeclimate]: https://codeclimate.com/github/mamantoha/omniauth-vkontakte
134
-
data/Rakefile CHANGED
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/gem_tasks'
3
5
  require 'rspec/core/rake_task'
4
6
 
5
- desc "Run specs"
7
+ desc 'Run specs'
6
8
  RSpec::Core::RakeTask.new
7
9
 
8
10
  desc 'Default: run specs.'
9
- task :default => :spec
11
+ task default: :spec
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
- gem 'sinatra'
5
+ gem 'omniauth-vkontakte', path: '../'
4
6
  gem 'puma'
5
- gem 'omniauth-vkontakte', :path => '../'
7
+ gem 'sinatra'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require_relative 'main'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pp'
2
4
  require 'sinatra'
3
5
  require 'omniauth'
@@ -10,13 +12,11 @@ SCOPE = 'friends,audio'
10
12
  use Rack::Session::Cookie
11
13
 
12
14
  use OmniAuth::Builder do
13
- provider :vkontakte, ENV['VKONTAKTE_KEY'], ENV['VKONTAKTE_SECRET']
14
- {
15
- scope: SCOPE,
16
- display: 'web',
17
- lang: 'en',
18
- image_size: 'original'
19
- }
15
+ provider :vkontakte, ENV['VKONTAKTE_KEY'], ENV['VKONTAKTE_SECRET'],
16
+ scope: SCOPE,
17
+ display: 'popup',
18
+ lang: 'en',
19
+ image_size: 'original'
20
20
  end
21
21
 
22
22
  get '/' do
@@ -1,9 +1,13 @@
1
- require "omniauth-vkontakte/version"
2
- require "omniauth"
1
+ # frozen_string_literal: true
3
2
 
3
+ require 'omniauth/vkontakte/version'
4
+ require 'omniauth'
5
+
6
+ # :nodoc:
4
7
  module OmniAuth
8
+ # :nodoc:
5
9
  module Strategies
6
- autoload :Vkontakte, 'omniauth/strategies/vkontakte'
10
+ autoload :Vkontakte, 'omniauth/strategies/vkontakte'
7
11
  end
8
12
  end
9
13
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth/strategies/oauth2'
2
4
 
3
5
  module OmniAuth
@@ -13,19 +15,18 @@ module OmniAuth
13
15
  class Vkontakte < OmniAuth::Strategies::OAuth2
14
16
  class NoRawData < StandardError; end
15
17
 
16
- API_VERSION = '5.8'
18
+ API_VERSION = '5.107'
17
19
 
18
20
  DEFAULT_SCOPE = ''
19
21
 
20
22
  option :name, 'vkontakte'
21
23
 
22
- option :client_options, {
23
- :site => 'https://api.vk.com/',
24
- :token_url => 'https://oauth.vk.com/access_token',
25
- :authorize_url => 'https://oauth.vk.com/authorize',
26
- }
24
+ option :client_options,
25
+ site: 'https://api.vk.com/',
26
+ token_url: 'https://oauth.vk.com/access_token',
27
+ authorize_url: 'https://oauth.vk.com/authorize'
27
28
 
28
- option :authorize_options, [:scope, :display]
29
+ option :authorize_options, %i[scope display]
29
30
 
30
31
  option :redirect_url, nil
31
32
 
@@ -34,16 +35,16 @@ module OmniAuth
34
35
  # https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema
35
36
  info do
36
37
  {
37
- :name => "#{raw_info['first_name']} #{raw_info['last_name']}".strip,
38
- :nickname => raw_info['nickname'],
39
- :email => access_token.params["email"],
40
- :first_name => raw_info['first_name'],
41
- :last_name => raw_info['last_name'],
42
- :image => image_url,
43
- :location => location,
44
- :urls => {
38
+ name: "#{raw_info['first_name']} #{raw_info['last_name']}".strip,
39
+ nickname: raw_info['nickname'],
40
+ email: access_token.params['email'],
41
+ first_name: raw_info['first_name'],
42
+ last_name: raw_info['last_name'],
43
+ image: image_url,
44
+ location: location,
45
+ urls: {
45
46
  'Vkontakte' => "http://vk.com/#{raw_info['screen_name']}"
46
- },
47
+ }
47
48
  }
48
49
  end
49
50
 
@@ -57,36 +58,30 @@ module OmniAuth
57
58
  access_token.options[:mode] = :query
58
59
  access_token.options[:param_name] = :access_token
59
60
  @raw_info ||= begin
60
- params = {
61
- :fields => info_options,
62
- :lang => lang_option,
63
- :https => https_option,
64
- :v => API_VERSION,
65
- }
61
+ result = access_token.get('/method/users.get', params: params).parsed['response']
66
62
 
67
- result = access_token.get('/method/users.get', :params => params).parsed["response"]
63
+ raise NoRawData, result unless result.is_a?(Array) && result.first
68
64
 
69
- raise NoRawData, result unless (result.is_a?(Array) and result.first)
70
65
  result.first
71
66
  end
72
67
  end
73
68
 
74
-
75
- # You can pass +display+ or +scope+ params to the auth request, if
76
- # you need to set them dynamically.
69
+ # You can pass +display+, +revoke+ or +scope+ params to the auth request,
70
+ # if you need to set them dynamically.
77
71
  #
78
72
  # http://vk.com/dev/oauth_dialog
79
73
  #
74
+ # +revoke+ revokes access and re-authorizes user.
80
75
  def authorize_params
81
76
  super.tap do |params|
82
77
  # just a copypaste from ominauth-facebook
83
- %w[display state scope].each do |v|
84
- if request.params[v]
85
- params[v.to_sym] = request.params[v]
78
+ %w[display state scope revoke].each do |v|
79
+ next unless request.params[v]
80
+
81
+ params[v.to_sym] = request.params[v]
86
82
 
87
- # to support omniauth-oauth2's auto csrf protection
88
- session['omniauth.state'] = params[:state] if v == 'state'
89
- end
83
+ # to support omniauth-oauth2's auto csrf protection
84
+ session['omniauth.state'] = params[:state] if v == 'state'
90
85
  end
91
86
 
92
87
  params[:scope] ||= DEFAULT_SCOPE
@@ -95,15 +90,27 @@ module OmniAuth
95
90
 
96
91
  private
97
92
 
93
+ def params
94
+ {
95
+ fields: info_options,
96
+ lang: lang_option,
97
+ https: https_option,
98
+ v: API_VERSION
99
+ }
100
+ end
101
+
98
102
  def callback_url
99
103
  options.redirect_url || (full_host + script_name + callback_path)
100
104
  end
101
105
 
102
106
  def info_options
103
107
  # http://vk.com/dev/fields
104
- fields = %w[nickname screen_name sex city country online bdate photo_50 photo_100 photo_200 photo_200_orig photo_400_orig]
108
+ fields = %w[
109
+ nickname screen_name sex city country online bdate
110
+ photo_50 photo_100 photo_200 photo_200_orig photo_400_orig
111
+ ]
105
112
  fields.concat(options[:info_fields].split(',')) if options[:info_fields]
106
- return fields.join(',')
113
+ fields.join(',')
107
114
  end
108
115
 
109
116
  def lang_option
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Vkontakte
5
+ VERSION = '1.6.1'
6
+ end
7
+ end
@@ -1,18 +1,21 @@
1
- require File.expand_path('../lib/omniauth-vkontakte/version', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('lib/omniauth/vkontakte/version', __dir__)
2
4
 
3
5
  Gem::Specification.new do |gem|
4
- gem.authors = ["Anton Maminov"]
5
- gem.email = ["anton.linux@gmail.com"]
6
- gem.description = %q{Unofficial VKontakte strategy for OmniAuth 1.0}
7
- gem.summary = %q{Unofficial VKontakte strategy for OmniAuth 1.0}
8
- gem.homepage = "https://github.com/mamantoha/omniauth-vkontakte"
6
+ gem.authors = ['Anton Maminov']
7
+ gem.email = ['anton.maminov@gmail.com']
8
+ gem.summary = 'Vkontakte OAuth2 Strategy for OmniAuth'
9
+ gem.homepage = 'https://github.com/mamantoha/omniauth-vkontakte'
10
+ gem.licenses = ['MIT']
9
11
 
10
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
11
13
  gem.files = `git ls-files`.split("\n")
12
14
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
- gem.name = "omniauth-vkontakte"
14
- gem.require_paths = ["lib"]
15
+ gem.name = 'omniauth-vkontakte'
16
+ gem.require_paths = ['lib']
15
17
  gem.version = OmniAuth::Vkontakte::VERSION
16
18
 
17
- gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
19
+ gem.required_ruby_version = '>= 2.6.0'
20
+ gem.add_runtime_dependency 'omniauth-oauth2', ['>= 1.5', '<= 1.7.0']
18
21
  end
@@ -1,14 +1,18 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
5
  describe OmniAuth::Strategies::Vkontakte do
6
- let(:request) { double('Request', :params => {}, :cookies => {}, :env => {}) }
6
+ let(:request) { double('Request', params: {}, cookies: {}, env: {}) }
7
7
 
8
8
  before do
9
9
  OmniAuth.config.test_mode = true
10
10
  end
11
11
 
12
+ it 'should have version' do
13
+ expect(OmniAuth::Vkontakte::VERSION).to_not be_nil
14
+ end
15
+
12
16
  subject do
13
17
  args = ['api_key', 'api_secret', @options || {}].compact
14
18
  obj = OmniAuth::Strategies::Vkontakte.new(*args).tap do |strategy|
@@ -19,7 +23,7 @@ describe OmniAuth::Strategies::Vkontakte do
19
23
  @access_token = double('OAuth2::AccessToken')
20
24
  allow(obj).to receive(:access_token).and_return(@access_token)
21
25
  allow(@access_token).to receive(:get).and_return(double('OAuth2::Response'))
22
- allow(@access_token).to receive(:params).and_return({ 'email' => raw_info_hash['email'] })
26
+ allow(@access_token).to receive(:params).and_return('email' => raw_info_hash['email'])
23
27
  obj
24
28
  end
25
29
 
@@ -78,40 +82,40 @@ describe OmniAuth::Strategies::Vkontakte do
78
82
  describe 'image_size option' do
79
83
  context 'when user has an image' do
80
84
  it 'should return image with size specified' do
81
- @options = { :image_size => 'original' }
85
+ @options = { image_size: 'original' }
82
86
  allow(subject).to receive(:raw_info).and_return(
83
- raw_info_hash.merge({ 'photo_200_orig' => img_url })
87
+ raw_info_hash.merge('photo_200_orig' => img_url)
84
88
  )
85
89
  expect(subject.info[:image]).to eq(img_url)
86
90
  end
87
91
 
88
92
  it 'should return image with size specified' do
89
- @options = { :image_size => 'original_x2' }
93
+ @options = { image_size: 'original_x2' }
90
94
  allow(subject).to receive(:raw_info).and_return(
91
- raw_info_hash.merge({ 'photo_400_orig' => img_url })
95
+ raw_info_hash.merge('photo_400_orig' => img_url)
92
96
  )
93
97
  expect(subject.info[:image]).to eq(img_url)
94
98
  end
95
99
 
96
100
  it 'should return bigger image when bigger size specified' do
97
- @options = { :image_size => 'bigger' }
101
+ @options = { image_size: 'bigger' }
98
102
  allow(subject).to receive(:raw_info).and_return(
99
- raw_info_hash.merge({ 'photo_100' => img_url })
103
+ raw_info_hash.merge('photo_100' => img_url)
100
104
  )
101
105
  expect(subject.info[:image]).to eq(img_url)
102
106
  end
103
107
 
104
108
  it 'should return mini image when mini size specified' do
105
- @options = { :image_size => 'mini' }
109
+ @options = { image_size: 'mini' }
106
110
  allow(subject).to receive(:raw_info).and_return(
107
- raw_info_hash.merge({ 'photo_50' => img_url })
111
+ raw_info_hash.merge('photo_50' => img_url)
108
112
  )
109
113
  expect(subject.info[:image]).to eq(img_url)
110
114
  end
111
115
 
112
116
  it 'should return normal image by default' do
113
117
  allow(subject).to receive(:raw_info).and_return(
114
- raw_info_hash.merge({ 'photo_50' => img_url })
118
+ raw_info_hash.merge('photo_50' => img_url)
115
119
  )
116
120
  expect(subject.info[:image]).to eq(img_url)
117
121
  end
@@ -121,8 +125,8 @@ describe OmniAuth::Strategies::Vkontakte do
121
125
  describe 'skip_info option' do
122
126
  context 'when skip info option is enabled' do
123
127
  it 'should not include raw_info in extras hash' do
124
- @options = { :skip_info => true }
125
- allow(subject).to receive(:raw_info).and_return({:foo => 'bar'})
128
+ @options = { skip_info: true }
129
+ allow(subject).to receive(:raw_info).and_return(foo: 'bar')
126
130
  expect(subject.extra[:raw_info]).to eq(nil)
127
131
  end
128
132
  end
@@ -131,12 +135,12 @@ describe OmniAuth::Strategies::Vkontakte do
131
135
  describe 'request_phase' do
132
136
  context 'with no request params set and redirect_url specified' do
133
137
  before do
134
- @options = { :redirect_url => 'http://www.example.com/auth/vkontakte/callback' }
138
+ @options = { redirect_url: 'http://www.example.com/auth/vkontakte/callback' }
135
139
  allow(subject).to receive(:env).and_return({})
136
140
  allow(subject).to receive(:request).and_return(
137
- double('Request', {:params => {}, :scheme => 'https',
138
- :url => 'https://oauth.vk.com/authorize',
139
- :cookies => {}, :env => {}})
141
+ double('Request', params: {}, scheme: 'https',
142
+ url: 'https://oauth.vk.com/authorize',
143
+ cookies: {}, env: {})
140
144
  )
141
145
  allow(subject).to receive(:request_phase).and_return(:whatever)
142
146
  end
@@ -1,5 +1,7 @@
1
- $:.unshift File.expand_path('..', __FILE__)
2
- $:.unshift File.expand_path('../../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path(__dir__)
4
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
3
5
  require 'simplecov'
4
6
  SimpleCov.start
5
7
  require 'rspec'
@@ -11,7 +13,7 @@ require 'omniauth-vkontakte'
11
13
  RSpec.configure do |config|
12
14
  config.include WebMock::API
13
15
  config.include Rack::Test::Methods
14
- config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
16
+ config.extend OmniAuth::Test::StrategyMacros, type: :strategy
15
17
  config.expect_with :rspec do |c|
16
18
  c.syntax = :expect
17
19
  end
metadata CHANGED
@@ -1,40 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-vkontakte
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Maminov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-15 00:00:00.000000000 Z
11
+ date: 2020-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.2'
19
+ version: '1.5'
20
+ - - "<="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.7.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '1.5'
30
+ - - "<="
25
31
  - !ruby/object:Gem::Version
26
- version: '1.2'
27
- description: Unofficial VKontakte strategy for OmniAuth 1.0
32
+ version: 1.7.0
33
+ description:
28
34
  email:
29
- - anton.linux@gmail.com
35
+ - anton.maminov@gmail.com
30
36
  executables: []
31
37
  extensions: []
32
38
  extra_rdoc_files: []
33
39
  files:
40
+ - ".github/workflows/ruby.yml"
34
41
  - ".gitignore"
35
42
  - ".rspec"
43
+ - ".rubocop.yml"
36
44
  - ".travis.yml"
37
45
  - Gemfile
46
+ - LICENSE
38
47
  - README.md
39
48
  - Rakefile
40
49
  - examples/.env.example
@@ -43,13 +52,14 @@ files:
43
52
  - examples/config.ru
44
53
  - examples/main.rb
45
54
  - lib/omniauth-vkontakte.rb
46
- - lib/omniauth-vkontakte/version.rb
47
55
  - lib/omniauth/strategies/vkontakte.rb
56
+ - lib/omniauth/vkontakte/version.rb
48
57
  - omniauth-vkontakte.gemspec
49
58
  - spec/omniauth/strategies/vkontakte_spec.rb
50
59
  - spec/spec_helper.rb
51
60
  homepage: https://github.com/mamantoha/omniauth-vkontakte
52
- licenses: []
61
+ licenses:
62
+ - MIT
53
63
  metadata: {}
54
64
  post_install_message:
55
65
  rdoc_options: []
@@ -59,18 +69,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
69
  requirements:
60
70
  - - ">="
61
71
  - !ruby/object:Gem::Version
62
- version: '0'
72
+ version: 2.6.0
63
73
  required_rubygems_version: !ruby/object:Gem::Requirement
64
74
  requirements:
65
75
  - - ">="
66
76
  - !ruby/object:Gem::Version
67
77
  version: '0'
68
78
  requirements: []
69
- rubyforge_project:
70
- rubygems_version: 2.5.2
79
+ rubygems_version: 3.0.3
71
80
  signing_key:
72
81
  specification_version: 4
73
- summary: Unofficial VKontakte strategy for OmniAuth 1.0
74
- test_files:
75
- - spec/omniauth/strategies/vkontakte_spec.rb
76
- - spec/spec_helper.rb
82
+ summary: Vkontakte OAuth2 Strategy for OmniAuth
83
+ test_files: []
@@ -1,5 +0,0 @@
1
- module OmniAuth
2
- module Vkontakte
3
- VERSION = "1.4.0"
4
- end
5
- end