omniauth-odnoklassniki 0.0.4 → 0.0.9

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
- SHA1:
3
- metadata.gz: b9f66d9ad84a060a92fcadee0e6240da7286488c
4
- data.tar.gz: 978167e78ec1b57e75b95dc8d0f70cb14a01b305
2
+ SHA256:
3
+ metadata.gz: aff0aa18fadfddcd5a46128dc2ffcf2bd31673b20949054c0f9f31bd2794bf3d
4
+ data.tar.gz: 9ca8e8fd98b137139309d78f0ce401ff374f8ecf38a85eed68dbd0f06a538b16
5
5
  SHA512:
6
- metadata.gz: 9769bbe8cac5453ce611e836b53a8f013ba070b47d880fb7751b7d0c1e06f83a870c5a2747886bafbe8cef98ca65605ca5afa6bfcf62674cf2a5999da266db0f
7
- data.tar.gz: 20fddb909a46ed2d203596512c0ed4af89601339013d582604be9aef860762b2e4413e86b29415693afe74af3d9ab97c15913ed640315bce09616a81a1df4063
6
+ metadata.gz: e3ef7b9030dbea012a0fdb871c5ccdc5abf778f8086a38d91d0ff10331e3a1c64a082e340a3db0a6167dd4540ab007d346b0ed5919d351e28c4bfef481b22816
7
+ data.tar.gz: 26698d4aa657569787fb95136267f5b2b7edd4535973c7fe9bb7bbf0620c7d5003d48249df35141eeb081c637bd2b2eb40f12ddf6f77bf27c7f41a185b62dc48
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # OmniAuth Odnoklassniki.ru
2
2
 
3
3
  This is the unofficial OmniAuth strategy for authenticating to Odnoklassniki.ru via OAuth.
4
- To use it, you'll need to sign up for an [OAuth2](http://dev.odnoklassniki.ru/wiki/pages/viewpage.action?pageId=12878032) Application ID and Keys
5
- on the [Odnoklassniki Developers Page](http://dev.odnoklassniki.ru/wiki/pages/viewpage.action?pageId=13992188).
4
+ To use it, you'll need to sign up for an [OAuth2](http://www.odnoklassniki.ru/devaccess) Application ID and Keys
5
+ on the [Odnoklassniki Developers Page](http://apiok.ru/wiki/pages/viewpage.action?pageId=42476652).
6
6
 
7
7
  ## Basic Usage
8
8
 
@@ -15,7 +15,7 @@ end
15
15
  ## Configuring
16
16
  You can configure several options, which you pass in to the `provider` method via a `Hash`:
17
17
 
18
- * `scope`: A list of permissions you want to request from the user. [Read the Odnoklassniki docs for more details](http://dev.odnoklassniki.ru/wiki/pages/viewpage.action?pageId=12878032)
18
+ * `scope`: A list of permissions you want to request from the user. [Read the Odnoklassniki docs for more details](http://apiok.ru/wiki/pages/viewpage.action?pageId=42476652)
19
19
 
20
20
  For example, to get `VALUABLE_ACCESS` permissions:
21
21
 
@@ -26,6 +26,41 @@ use OmniAuth::Builder do
26
26
  end
27
27
  ```
28
28
 
29
+ ## Authentication Hash
30
+ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
31
+
32
+ ```ruby
33
+ {"provider"=>"odnoklassniki",
34
+ "uid"=>"156210383106",
35
+ "info"=>
36
+ {"name"=>"Тимур Козьменко",
37
+ "first_name"=>"Тимур",
38
+ "last_name"=>"Козьменко",
39
+ "image"=>"http://i500.mycdn.me/getImage?photoId=182400752898&photoType=4&viewToken=NdMoSjCY43Do55GMC9dcSw",
40
+ "urls"=>{"Odnoklassniki"=>"http://www.odnoklassniki.ru/profile/156210383106"}},
41
+ "credentials"=>
42
+ {"token"=>"7.ipa228300y1o3o2ms683k5tsrvk16364", "refresh_token"=>"093ef4a51932db6e22834fb83eab95fdb83_156210383106_141603572", "expires_at"=>1416037593, "expires"=>true},
43
+ "extra"=>
44
+ {"raw_info"=>
45
+ {"uid"=>"156210383106",
46
+ "birthday"=>"1989-01-18",
47
+ "age"=>25,
48
+ "first_name"=>"Тимур",
49
+ "last_name"=>"Козьменко",
50
+ "name"=>"Тимур Козьменко",
51
+ "locale"=>"ru",
52
+ "gender"=>"male",
53
+ "has_email"=>true,
54
+ "location"=>{"city"=>"Владивосток", "country"=>"RUSSIAN_FEDERATION", "countryCode"=>"RU", "countryName"=>"Россия"},
55
+ "current_status"=>"test test",
56
+ "current_status_id"=>"527194803202",
57
+ "current_status_date"=>"1970-01-01 03:00:00",
58
+ "online"=>"web",
59
+ "photo_id"=>"182400752898",
60
+ "pic_1"=>"http://i500.mycdn.me/getImage?photoId=182400752898&photoType=4&viewToken=NdMoSjCY43Do55GMC9dcSw",
61
+ "pic_2"=>"http://usd1.mycdn.me/getImage?photoId=182400752898&photoType=2&viewToken=NdMoSjCY43Do55GMC9dcSw"}}}
62
+ ```
63
+
29
64
  ## License
30
65
 
31
66
  Copyright (c) 2011 Alexander Logvinov.
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Odnoklassniki
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -7,8 +7,8 @@ module OmniAuth
7
7
  option :name, 'odnoklassniki'
8
8
 
9
9
  option :client_options, {
10
- :site => 'http://www.odnoklassniki.ru/',
11
- :token_url => 'https://api.odnoklassniki.ru/oauth/token.do',
10
+ :site => 'https://connect.ok.ru',
11
+ :token_url => 'https://api.ok.ru/oauth/token.do',
12
12
  :authorize_url => '/oauth/authorize'
13
13
  }
14
14
 
@@ -30,9 +30,11 @@ module OmniAuth
30
30
  :last_name => raw_info['last_name'],
31
31
  :image => raw_info['pic_1'],
32
32
  :urls => {
33
- 'Odnoklassniki' => "http://www.odnoklassniki.ru/profile/#{uid}",
33
+ 'Odnoklassniki' => "https://ok.ru/profile/#{uid}",
34
34
  }
35
- }
35
+ }.tap do |info|
36
+ info[:email] = raw_info['email'] if raw_info['email']
37
+ end
36
38
  end
37
39
 
38
40
  extra do
@@ -40,11 +42,7 @@ module OmniAuth
40
42
  end
41
43
 
42
44
  def callback_url
43
- if options.authorize_options.respond_to? :callback_url
44
- options.authorize_options.callback_url
45
- else
46
- super
47
- end
45
+ options.redirect_url || (full_host + script_name + callback_path)
48
46
  end
49
47
 
50
48
  def build_access_token
@@ -66,8 +64,9 @@ module OmniAuth
66
64
  'method' => 'users.getCurrentUser',
67
65
  'application_key' => options.public_key
68
66
  }
67
+ params['fields'] = options[:info_fields] if options.key?(:info_fields)
69
68
  params['sig'] = calculate_signature(params)
70
- result = access_token.get('http://api.odnoklassniki.ru/fb.do', :params => params).parsed
69
+ result = access_token.get('https://api.ok.ru/fb.do', :params => params).parsed
71
70
  raise CallbackError.new(nil, :invalid_response) if result['error_code'] || result['error_msg']
72
71
  result
73
72
  end
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_runtime_dependency "omniauth", "~> 1.0"
21
+ s.add_runtime_dependency "omniauth", [">= 1.9", "< 3"]
22
22
  s.add_runtime_dependency "omniauth-oauth2", "~> 1.0"
23
23
  end
metadata CHANGED
@@ -1,41 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-odnoklassniki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Logvinov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-03 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '1.0'
29
+ version: '1.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: omniauth-oauth2
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ~>
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
39
  version: '1.0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ~>
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
46
  version: '1.0'
41
47
  description: OmniAuth strategy for Odnoklassniki.ru
@@ -45,7 +51,7 @@ executables: []
45
51
  extensions: []
46
52
  extra_rdoc_files: []
47
53
  files:
48
- - .gitignore
54
+ - ".gitignore"
49
55
  - Gemfile
50
56
  - README.md
51
57
  - Rakefile
@@ -62,17 +68,16 @@ require_paths:
62
68
  - lib
63
69
  required_ruby_version: !ruby/object:Gem::Requirement
64
70
  requirements:
65
- - - '>='
71
+ - - ">="
66
72
  - !ruby/object:Gem::Version
67
73
  version: '0'
68
74
  required_rubygems_version: !ruby/object:Gem::Requirement
69
75
  requirements:
70
- - - '>='
76
+ - - ">="
71
77
  - !ruby/object:Gem::Version
72
78
  version: '0'
73
79
  requirements: []
74
- rubyforge_project: omniauth-odnoklassniki
75
- rubygems_version: 2.0.0
80
+ rubygems_version: 3.1.4
76
81
  signing_key:
77
82
  specification_version: 4
78
83
  summary: OmniAuth strategy for Odnoklassniki.ru