oa-vkontakte 0.1.4 → 0.2.0

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.
@@ -9,7 +9,7 @@
9
9
  Добавить в config/initializers/omniauth.rb:
10
10
 
11
11
  Rails.application.config.middleware.use OmniAuth::Builder do
12
- provider :vkontakte_open_api, <ID приложения>, <Защищенный ключ приложения>
12
+ provider :vkontakte, <ID приложения>, <Защищенный ключ приложения>
13
13
  end
14
14
 
15
15
  Если ещё не определен, добавить путь в config/routes.rb:
@@ -42,6 +42,21 @@
42
42
  }
43
43
  }
44
44
 
45
+ == Интеграция с Devise
46
+
47
+ Devise с версии 1.2.rc интегрирован с OmniAuth. Подключить к нему <tt>oa-vkontakte</tt> достаточно просто, дописав в <tt>config/initializers/devise.rb</tt>:
48
+ config.omniauth :vkontakte, <ID приложения>, <Защищенный ключ приложения>
49
+ Callback будет приходить действию Devise::OmniauthCallbacks#vkontakte, так что придется озаботиться его наличием. Это удобно сделать, поменяв контроллер для callback'ов OmniAuth в <tt>routes.rb</tt>:
50
+ devise_for :users, :controllers => { :omniauth_callbacks => "authentications" }
51
+ AuthenticationsController в этом случае выглядит как-то так:
52
+ class AuthenticationsController < Devise::OmniauthCallbacksController
53
+ def vkontakte
54
+ omniauth = request.env["omniauth.auth"]
55
+ # создание или аутентификация пользователя
56
+ ...
57
+ end
58
+ end
59
+
45
60
  == Ссылки
46
61
 
47
62
  OmniAuth: http://github.com/intridea/omniauth
@@ -6,5 +6,5 @@ module Oa
6
6
  end
7
7
 
8
8
  if defined?(Rails)
9
- ActionController::Base.helper OmniAuth::Strategies::VkontakteOpenApi::ViewHelper::PageHelper
9
+ ActionController::Base.helper OmniAuth::Strategies::Vkontakte::ViewHelper::PageHelper
10
10
  end
@@ -1,5 +1,5 @@
1
1
  module Oa
2
2
  module Vkontakte
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  require 'omniauth/vkontakte'
2
- require 'omniauth/strategies/vkontakte_open_api/view_helper'
2
+ require 'omniauth/strategies/vkontakte/view_helper'
3
3
 
4
4
  module OmniAuth
5
5
  class Configuration
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  module OmniAuth
12
12
  module Strategies
13
- class VkontakteOpenApi
13
+ class Vkontakte
14
14
  include OmniAuth::Strategy
15
15
  include ViewHelper::PageHelper
16
16
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  module OmniAuth
3
3
  module Strategies
4
- class VkontakteOpenApi
4
+ class Vkontakte
5
5
  class ViewHelper
6
6
  module PageHelper
7
7
  def vkontakte_login_page
@@ -114,7 +114,7 @@ HEADER
114
114
  document.getElementById("vk_api_transport").appendChild(el);
115
115
  }());
116
116
  </script>
117
- <div id="vk_login" style="margin: 0 auto 20px auto;" onclick="vkLogin.doLogin();"></div>
117
+ <div id="vk_login" onclick="vkLogin.doLogin();"></div>
118
118
  BUTTON
119
119
  end
120
120
 
@@ -2,7 +2,7 @@ require 'omniauth/core'
2
2
 
3
3
  module OmniAuth
4
4
  module Strategies
5
- autoload :VkontakteOpenApi, 'omniauth/strategies/vkontakte_open_api'
5
+ autoload :Vkontakte, 'omniauth/strategies/vkontakte'
6
6
  end
7
7
  end
8
8
 
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.homepage = %q{http://github.com/oruen/oa-vkontakte}
13
13
  s.rubyforge_project = %q{oa-vkontakte}
14
14
 
15
- s.add_dependency(%q<oa-core>, ["~> 0.1.4"])
15
+ s.add_dependency(%q<oa-core>, [">= 0.1.6"])
16
16
  s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
17
17
  s.add_development_dependency(%q<yard>, [">= 0"])
18
18
  s.add_development_dependency(%q<rack-test>, ["~> 0.5.6"])
@@ -1,11 +1,11 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
2
 
3
- describe OmniAuth::Strategies::VkontakteOpenApi, :type => :strategy do
3
+ describe OmniAuth::Strategies::Vkontakte, :type => :strategy do
4
4
 
5
5
  include OmniAuth::Test::StrategyTestCase
6
6
 
7
7
  def strategy
8
- [OmniAuth::Strategies::VkontakteOpenApi, 1983892, '6FF1PUlZfEyutJxctvtd']
8
+ [OmniAuth::Strategies::Vkontakte, 1983892, '6FF1PUlZfEyutJxctvtd']
9
9
  end
10
10
 
11
11
  describe 'POST /auth/vkontakte_open_api/callback с логином и паролем' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oa-vkontakte
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 4
10
- version: 0.1.4
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nick Recobra
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-27 00:00:00 +03:00
18
+ date: 2011-01-26 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,14 +24,14 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 19
29
+ hash: 23
30
30
  segments:
31
31
  - 0
32
32
  - 1
33
- - 4
34
- version: 0.1.4
33
+ - 6
34
+ version: 0.1.6
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -96,12 +96,12 @@ files:
96
96
  - Rakefile
97
97
  - lib/oa-vkontakte.rb
98
98
  - lib/oa-vkontakte/version.rb
99
- - lib/omniauth/strategies/vkontakte_open_api.rb
100
- - lib/omniauth/strategies/vkontakte_open_api/view_helper.rb
99
+ - lib/omniauth/strategies/vkontakte.rb
100
+ - lib/omniauth/strategies/vkontakte/view_helper.rb
101
101
  - lib/omniauth/vkontakte.rb
102
102
  - oa-vkontakte.gemspec
103
103
  - spec/oa-vkontakte_spec.rb
104
- - spec/omniauth/strategires/vkontakte_open_api_spec.rb
104
+ - spec/omniauth/strategires/vkontakte_spec.rb
105
105
  - spec/spec_helper.rb
106
106
  has_rdoc: true
107
107
  homepage: http://github.com/oruen/oa-vkontakte
@@ -139,5 +139,5 @@ specification_version: 3
139
139
  summary: OmniAuth extension for vkontakte.ru authentication
140
140
  test_files:
141
141
  - spec/oa-vkontakte_spec.rb
142
- - spec/omniauth/strategires/vkontakte_open_api_spec.rb
142
+ - spec/omniauth/strategires/vkontakte_spec.rb
143
143
  - spec/spec_helper.rb