omniauth-vkontakte 1.3.0 → 1.3.1
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.
- checksums.yaml +4 -4
- data/README.md +11 -5
- data/examples/sinatra.rb +7 -1
- data/lib/omniauth-vkontakte/version.rb +1 -1
- data/lib/omniauth/strategies/vkontakte.rb +24 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef1874496560d9ff3b43fb2c80a78790d204b41d
|
4
|
+
data.tar.gz: df6dc4e266969c9c14b559206b35b11fb161f8b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09ccbe1b867711010f1aecb57ede46f07945c0ee619cc3355972be37f489c7f2caf53ce52e72e9aebb1fc6af5cd25d531bcf070165558430027b8ca63461b5c4
|
7
|
+
data.tar.gz: 19278f224eeabe70370e7fc90d249e029b54eb58913d407266ad5dbe1e1e3b447d04fa21aeb5fa17f14df5231f7924e88989daa57c01775a521b37cb7f34c101
|
data/README.md
CHANGED
@@ -16,19 +16,25 @@ end
|
|
16
16
|
You can configure several options, which you pass in to the `provider` method via a `Hash`:
|
17
17
|
|
18
18
|
* `scope`: a comma-separated list of access permissions you want to request from the user. [Read the Vkontakte docs for more details](http://vk.com/dev/permissions)
|
19
|
-
* `display`: the display context to show the authentication page.
|
20
|
-
* `lang`: specifies the language. Optional options
|
19
|
+
* `display`: the display context to show the authentication page. Valid options include `page`, `popup` and `mobile`.
|
20
|
+
* `lang`: specifies the language. Optional options include `ru`, `ua`, `be`, `en`, `es`, `fi`, `de`, `it`.
|
21
|
+
* `image_size`: defines the size of the user's image. Valid options include `mini`(50x50), `bigger`(100x100) and `original`(200x200). Default is `mini`.
|
21
22
|
|
22
|
-
|
23
|
+
Here's an example of a possible configuration:
|
23
24
|
|
24
25
|
```ruby
|
25
26
|
use OmniAuth::Builder do
|
26
27
|
provider :vkontakte, ENV['API_KEY'], ENV['API_SECRET'],
|
27
|
-
|
28
|
+
{
|
29
|
+
:scope => 'friends,audio,photos',
|
30
|
+
:display => 'popup',
|
31
|
+
:lang => 'en',
|
32
|
+
:image_size => 'original'
|
33
|
+
}
|
28
34
|
end
|
29
35
|
```
|
30
36
|
|
31
|
-
##
|
37
|
+
## Authentication Hash
|
32
38
|
|
33
39
|
Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
34
40
|
|
data/examples/sinatra.rb
CHANGED
@@ -11,7 +11,13 @@ SCOPE = 'friends,audio'
|
|
11
11
|
use Rack::Session::Cookie
|
12
12
|
|
13
13
|
use OmniAuth::Builder do
|
14
|
-
provider :vkontakte, ENV['VKONTAKTE_KEY'], ENV['VKONTAKTE_SECRET']
|
14
|
+
provider :vkontakte, ENV['VKONTAKTE_KEY'], ENV['VKONTAKTE_SECRET']
|
15
|
+
{
|
16
|
+
:scope => SCOPE,
|
17
|
+
:display => 'mobile',
|
18
|
+
:lang => 'en',
|
19
|
+
:image_size => 'original'
|
20
|
+
}
|
15
21
|
end
|
16
22
|
|
17
23
|
get '/' do
|
@@ -35,7 +35,7 @@ module OmniAuth
|
|
35
35
|
:nickname => raw_info['nickname'],
|
36
36
|
:first_name => raw_info['first_name'],
|
37
37
|
:last_name => raw_info['last_name'],
|
38
|
-
:image =>
|
38
|
+
:image => image_url,
|
39
39
|
:location => location,
|
40
40
|
:urls => {
|
41
41
|
'Vkontakte' => "http://vk.com/#{raw_info['screen_name']}"
|
@@ -64,15 +64,6 @@ module OmniAuth
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def info_options
|
68
|
-
# http://vk.com/dev/fields
|
69
|
-
fields = ['nickname', 'screen_name', 'sex', 'city', 'country', 'online', 'bdate', 'photo', 'photo_big']
|
70
|
-
return fields.join(',')
|
71
|
-
end
|
72
|
-
|
73
|
-
def lang_option
|
74
|
-
options[:lang] || ''
|
75
|
-
end
|
76
67
|
|
77
68
|
# You can pass +display+ or +scope+ params to the auth request, if
|
78
69
|
# you need to set them dynamically.
|
@@ -97,6 +88,29 @@ module OmniAuth
|
|
97
88
|
|
98
89
|
private
|
99
90
|
|
91
|
+
def info_options
|
92
|
+
# http://vk.com/dev/fields
|
93
|
+
fields = ['nickname', 'screen_name', 'sex', 'city', 'country', 'online', 'bdate', 'photo_50', 'photo_100', 'photo_200_orig']
|
94
|
+
return fields.join(',')
|
95
|
+
end
|
96
|
+
|
97
|
+
def lang_option
|
98
|
+
options[:lang] || ''
|
99
|
+
end
|
100
|
+
|
101
|
+
def image_url
|
102
|
+
case options[:image_size]
|
103
|
+
when 'mini'
|
104
|
+
raw_info['photo_50']
|
105
|
+
when 'bigger'
|
106
|
+
raw_info['photo_100']
|
107
|
+
when 'original'
|
108
|
+
raw_info['photo_200_orig']
|
109
|
+
else
|
110
|
+
raw_info['photo_50']
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
100
114
|
# http://vk.com/dev/database.getCountriesById
|
101
115
|
def get_country
|
102
116
|
if raw_info['country'] && raw_info['country'] != "0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-vkontakte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.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: 2013-10-
|
11
|
+
date: 2013-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|