Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

version bump

  • Loading branch information...
commit 1da6eebdd182e1340fa49b78729a13118cf9d148 1 parent c65ff03
Andrew Zinenko authored
View
2  README.md
@@ -88,7 +88,7 @@ more details refer to the [documentation](http://vk.com/developers.php?oid=-1&p=
```.ruby
-app = VK::Application.new app_id: 222, app_secret: 'secret key'
+app = VK::Application.new app_id: 222, app_secret: 'secret key', redirect_uri: 'http://...'
app.authorize(type: :serverside, code: CODE) # => {"access_token":"533bacf01e11f55b536a565b57531ac114461ae8736d6506a3", "expires_in":43200, "user_id":6492}
View
3  lib/vk-ruby/core.rb
@@ -47,6 +47,8 @@ module Core
attr_configurable :app_secret
+ attr_configurable :redirect_uri
+
# Application settings(scope) that will be used to make authorize request.
# Default `'notify,friends,offline'`
# @method settings
@@ -226,6 +228,7 @@ def authorize(params = {})
client_id: self.app_id,
client_secret: self.app_secret,
code: params[:code],
+ redirect_uri: (params[:redirect_uri] || self.redirect_url),
verb: :get}
when :secure
{host: 'https://oauth.vk.com',
View
3  lib/vk-ruby/serverside.rb
@@ -18,7 +18,7 @@ def initialize(params={})
# @raise if app_secret attribute is nil.
# @raise [VK::AuthorizeException] if vk.com return json with key error.
- def authorize(code, auto_save = true)
+ def authorize(code, _redirect_uri, auto_save = true)
raise 'undefined application id' unless self.app_id
raise 'undefined application secret' unless self.app_secret
@@ -26,6 +26,7 @@ def authorize(code, auto_save = true)
client_id: self.app_id,
client_secret: self.app_secret,
code: code,
+ redirect_uri: (_redirect_uri || self.redirect_url),
verb: :get}
response = request("/access_token", params)
View
2  lib/vk-ruby/version.rb
@@ -1,5 +1,5 @@
# encoding: UTF-8
module VK
- VERSION = '0.9.0'
+ VERSION = '0.9.1'
end
View
2  tests/application_test.rb
@@ -29,7 +29,7 @@ def test_post_request_params
def test_authorization
params = {client_id: :test_id ,client_secret: :test_secret}
assert_equal @app.authorize(params.merge type: :secure) , {"client_id"=>"test_id", "client_secret"=>"test_secret", "grant_type"=>"client_credentials"}
- assert_equal @app.authorize(params.merge type: :serverside, code: :test_code) ,{"client_id"=>"test_id", "client_secret"=>"test_secret", "code"=>"test_code"}
+ assert_equal @app.authorize(params.merge type: :serverside, code: :test_code, redirect_uri: '--') ,{"client_id"=>"test_id", "client_secret"=>"test_secret", "code"=>"test_code", "redirect_uri" => '--'}
end
def test_bad_requests
Please sign in to comment.
Something went wrong with that request. Please try again.