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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82e2d058974ed802c866153a8248be53642069cc
4
- data.tar.gz: 9f4b0fdc8a55fe501046821b0b91072028b14cbf
3
+ metadata.gz: ef1874496560d9ff3b43fb2c80a78790d204b41d
4
+ data.tar.gz: df6dc4e266969c9c14b559206b35b11fb161f8b0
5
5
  SHA512:
6
- metadata.gz: d513abcb0d1ddcff85a9ca4fbcf6108fddc560d414c5c85fe4a8f7cc192bd852850ce43c1852ee25038e9e0abbc889753cdf0cbffba6c5800971cced60cb9d01
7
- data.tar.gz: 58492ea8f0a56bf9b1d324b5be67942b8d9e973c34a50075ca974c67517a67ab38a0af2c4de23bb7fdd406875ef2cbe576ed59b6b986398518f0e55a74d5d17b
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. Options are: `page`, `popup` and `mobile`.
20
- * `lang`: specifies the language. Optional options are: `ru`, `ua`, `be`, `en`, `es`, `fi`, `de`, `it`.
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
- For example, to request `friends`, `audio` and `photos` permissions and display the authentication page in a popup window:
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
- :scope => 'friends,audio,photos', :display => 'popup', :lang => 'en'
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
- ## Auth Hash
37
+ ## Authentication Hash
32
38
 
33
39
  Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
34
40
 
@@ -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'], :scope => SCOPE, :display => 'popup', :lang => 'en'
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
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Vkontakte
3
- VERSION = "1.3.0"
3
+ VERSION = "1.3.1"
4
4
  end
5
5
  end
@@ -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 => raw_info['photo'],
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.0
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-14 00:00:00.000000000 Z
11
+ date: 2013-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth