omniauth-odnoklassniki 0.0.3 → 0.0.4

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: 8689d7ae1bfa081c563b9e74bd952b6308ded857
4
- data.tar.gz: 05e20a7e639e30d4acd37912d618f8019b042c22
3
+ metadata.gz: b9f66d9ad84a060a92fcadee0e6240da7286488c
4
+ data.tar.gz: 978167e78ec1b57e75b95dc8d0f70cb14a01b305
5
5
  SHA512:
6
- metadata.gz: 2b68ffe4eef8347ff8f4b4d21d4cb99ee5a4f0a8be8fc61344505af30a00e53805d806481948e977cf9288d00ff3219f4170cf2d4212a8857e238c522da5f881
7
- data.tar.gz: 22a024f3f5ab0914577ee8aa4f57f50a52cab9ccbaeb98cdd90a78449af73aaeeaa73b7b5af94c55e746891f9f8fda3258b4e1461ff64624953bd99cb6eddb16
6
+ metadata.gz: 9769bbe8cac5453ce611e836b53a8f013ba070b47d880fb7751b7d0c1e06f83a870c5a2747886bafbe8cef98ca65605ca5afa6bfcf62674cf2a5999da266db0f
7
+ data.tar.gz: 20fddb909a46ed2d203596512c0ed4af89601339013d582604be9aef860762b2e4413e86b29415693afe74af3d9ab97c15913ed640315bce09616a81a1df4063
@@ -8,7 +8,7 @@ module OmniAuth
8
8
 
9
9
  option :client_options, {
10
10
  :site => 'http://www.odnoklassniki.ru/',
11
- :token_url => 'http://api.odnoklassniki.ru/oauth/token.do',
11
+ :token_url => 'https://api.odnoklassniki.ru/oauth/token.do',
12
12
  :authorize_url => '/oauth/authorize'
13
13
  }
14
14
 
@@ -48,13 +48,9 @@ module OmniAuth
48
48
  end
49
49
 
50
50
  def build_access_token
51
- super.tap do |token|
52
- token.options.merge!(access_token_options)
53
- end
54
- end
55
-
56
- def access_token_options
57
- options.access_token_options.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }
51
+ verifier = request.params['code']
52
+ client.auth_code.get_token(verifier, {:redirect_uri => callback_url}.merge(token_params.to_hash(:symbolize_keys => true)),
53
+ {'expires' => 1800}.merge(options.access_token_options.to_hash(:symbolize_keys => true)))
58
54
  end
59
55
 
60
56
  private
@@ -70,9 +66,10 @@ module OmniAuth
70
66
  'method' => 'users.getCurrentUser',
71
67
  'application_key' => options.public_key
72
68
  }
73
- params['scope'] = URI::encode(options.scope) if options.scope
74
69
  params['sig'] = calculate_signature(params)
75
- access_token.get('http://api.odnoklassniki.ru/fb.do', :params => params).parsed
70
+ result = access_token.get('http://api.odnoklassniki.ru/fb.do', :params => params).parsed
71
+ raise CallbackError.new(nil, :invalid_response) if result['error_code'] || result['error_msg']
72
+ result
76
73
  end
77
74
  end
78
75
 
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Odnoklassniki
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-odnoklassniki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-04-26 00:00:00.000000000 Z
11
+ date: 2013-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth