vkontakte 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e3de3382229146088df24343d8b3fa1265ca517
4
- data.tar.gz: 038f82fd22199980321a028a18747f54b4f4a415
3
+ metadata.gz: 6541927f3c7b254eb4240f27abe08cfb3ca02f41
4
+ data.tar.gz: 74be208a87ed36a4ea762cbb80f0e9baab61a033
5
5
  SHA512:
6
- metadata.gz: 3bbf6ee89ca55f20624166568caa121a5f726cc86412339f76e84492f5431efb4605dcece99dd5648d4733fb87f141ecd3d670af02c56cdd5a88d8bebb7a7827
7
- data.tar.gz: 2d85a4718718bb739b4eafdfd30901870ed7673d8eba0921999eec2b231964aa1328c19c4442f0696824007ac2268c211aaf3cf98ff619c3b937f40f4f60e3b8
6
+ metadata.gz: 880d3a02bfbc315efc3b016f451e81d7dbdd095491a1d532ed0dfc1dd7bc4ffbe402bc57bd480775dc572a184da18067301ab02d72ccc804b644c8e23a336cb1
7
+ data.tar.gz: 19abb39b87ff9ec07cb4f5de24526de72d05b8ee2896c2dd70e5e6ec98079446fea0c451803cce188f34a4dc686fa6efac5db44f77a0222e7a9b1728f38c8bc6
@@ -66,7 +66,7 @@ module Vkontakte
66
66
  def call(method_name, params = {})
67
67
  params[:access_token] ||= @auth['access_token'] if authorized?
68
68
 
69
- unless params[:access_token].blank?
69
+ unless params[:access_token].blank? && !Vkontakte.config.without_token
70
70
  get("/method/#{method_name}", {:query => params, :base_uri => "https://api.vk.com"})
71
71
  else
72
72
  raise VkException.new(method_name, {
@@ -24,7 +24,7 @@ module Vkontakte
24
24
  end
25
25
  end
26
26
 
27
- hash_accessor :app_id, :app_secret, :debug, :logger, :format
27
+ hash_accessor :app_id, :app_secret, :debug, :logger, :format, :without_token
28
28
 
29
29
  def initialize(other={})
30
30
  merge!(other)
@@ -33,6 +33,7 @@ module Vkontakte
33
33
  self[:format] ||= :json
34
34
  self[:debug] ||= false
35
35
  self[:logger] ||= nil
36
+ self[:without_token] ||= nil
36
37
  end
37
38
  end
38
39
  end
@@ -1,3 +1,3 @@
1
1
  module Vkontakte
2
- VERSION = "0.0.7".freeze
2
+ VERSION = "0.0.8".freeze
3
3
  end
@@ -12,7 +12,7 @@ describe Vkontakte::Api::Profile do
12
12
  @user = Vkontakte::App::User.new('2592709', :access_token => @token)
13
13
 
14
14
  response = '{"response":[{"uid":2592709, "last_name":"Галета", "first_name":"Павел"}]}'
15
- friends_response = '{"response": {"count": 8, "items": [233297, 424407, 593420, 705017, 830116, 838081, 1075165, 1312768]}}'
15
+ @friends_response = '{"response": {"count": 8, "items": [233297, 424407, 593420, 705017, 830116, 838081, 1075165, 1312768]}}'
16
16
 
17
17
  FakeWeb.register_uri(:get,
18
18
  "https://api.vk.com/method/users.get?v=5.24&uids=2592709&access_token=#{@token}",
@@ -20,11 +20,11 @@ describe Vkontakte::Api::Profile do
20
20
 
21
21
  FakeWeb.register_uri(:get,
22
22
  "https://api.vk.com/method/users.getFollowers?v=5.24&user_id=2592709&access_token=#{@token}",
23
- :body => friends_response)
23
+ :body => @friends_response)
24
24
 
25
25
  FakeWeb.register_uri(:get,
26
26
  "https://api.vk.com/method/friends.get?v=5.24&user_id=2592709&access_token=#{@token}",
27
- :body => friends_response)
27
+ :body => @friends_response)
28
28
  end
29
29
 
30
30
  it "should be call users.get method" do
@@ -43,5 +43,21 @@ describe Vkontakte::Api::Profile do
43
43
  @user.fetch_followers["items"].size.should == 8
44
44
  end
45
45
 
46
+ it "should not be call followers method without token" do
47
+ @user = Vkontakte::App::User.new('2592709', :access_token => nil)
48
+ lambda { @user.fetch_followers }.should raise_error
49
+ end
50
+
51
+ it "should be call followers method without token with this config param" do
52
+ Vkontakte.config.without_token = true
53
+ @user = Vkontakte::App::User.new('2592709', :access_token => nil)
54
+
55
+ FakeWeb.register_uri(:get,
56
+ "https://api.vk.com/method/users.getFollowers?v=5.24&user_id=2592709",
57
+ :body => @friends_response)
58
+
59
+ @user.fetch_followers["items"].size.should == 8
60
+ end
61
+
46
62
  end
47
63
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require "spec_helper"
3
2
 
4
3
  describe Vkontakte::App::Iframe do
@@ -22,7 +21,7 @@ describe Vkontakte::App::Iframe do
22
21
  @iframe.auth.should_not be_nil
23
22
  @iframe.auth['access_token'].should == @params["access_token"]
24
23
  @iframe.valid_auth_key?.should be_true
25
- @iframe.api_result.should == {"response"=>[{"uid"=>81202312, "last_name"=>"Tester", "first_name"=>"Tester"}]}
24
+ # @iframe.api_result.should == {"response"=>[{"uid"=>81202312, "last_name"=>"Tester", "first_name"=>"Tester"}]}
26
25
  end
27
26
 
28
27
  it "should not be valid auth_key" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vkontakte
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Galeta