micro_vkontakte 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/Rakefile +1 -1
- data/lib/micro_vkontakte/base.rb +0 -33
- data/lib/micro_vkontakte/session.rb +23 -0
- data/lib/micro_vkontakte.rb +11 -1
- data/micro_vkontakte.gemspec +2 -2
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('micro_vkontakte', '0.0.
|
5
|
+
Echoe.new('micro_vkontakte', '0.0.6') do |p|
|
6
6
|
p.description = "Vkontakte api tools."
|
7
7
|
p.url = "http://github.com/gvalmon/micro_vkontakte"
|
8
8
|
p.author = "Iskander Haziev"
|
data/lib/micro_vkontakte/base.rb
CHANGED
@@ -1,39 +1,6 @@
|
|
1
1
|
module MicroVkontakte
|
2
2
|
class Base
|
3
|
-
VK_METHODS = %w{
|
4
|
-
wall friends photos messages newsfeed status audio video places
|
5
|
-
secure language notes pages offers questions polls subscriptions
|
6
|
-
}
|
7
|
-
attr_accessor :base_session
|
8
|
-
attr_accessor :app_id, :api_secret
|
9
3
|
|
10
|
-
def initialize(app_id, api_secret, prefix = nil)
|
11
|
-
@app_id, @api_secret, @prefix = app_id, api_secret, prefix
|
12
|
-
self.base_session = MicroVkontakte::Session.new(app_id, api_secret, prefix)
|
13
|
-
end
|
14
|
-
|
15
|
-
def method_missing(name, *args)
|
16
|
-
self.base_session.send(name, *args)
|
17
|
-
end
|
18
|
-
|
19
|
-
class << self
|
20
|
-
def add_method(method)
|
21
|
-
self.class_eval do
|
22
|
-
define_method(method) do
|
23
|
-
variable = instance_variable_get("@#{method}")
|
24
|
-
unless variable
|
25
|
-
variable = MicroVkontakte::Session.new(app_id, api_secret, method)
|
26
|
-
instance_variable_set("@#{method}", variable)
|
27
|
-
end
|
28
|
-
variable
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
VK_METHODS.each do |method|
|
35
|
-
add_method(method)
|
36
|
-
end
|
37
4
|
end
|
38
5
|
|
39
6
|
class Error < ::StandardError
|
@@ -6,6 +6,10 @@ require 'ostruct'
|
|
6
6
|
|
7
7
|
module MicroVkontakte
|
8
8
|
class Session
|
9
|
+
VK_METHODS = %w{
|
10
|
+
wall friends photos messages newsfeed status audio video places
|
11
|
+
secure language notes pages offers questions polls subscriptions
|
12
|
+
}
|
9
13
|
VK_API_URL = 'http://api.vk.com/api.php'
|
10
14
|
attr_accessor :app_id, :api_secret
|
11
15
|
|
@@ -34,5 +38,24 @@ module MicroVkontakte
|
|
34
38
|
def method_missing(name, *args)
|
35
39
|
call(name, *args)
|
36
40
|
end
|
41
|
+
|
42
|
+
class << self
|
43
|
+
def add_method(method)
|
44
|
+
self.class_eval do
|
45
|
+
define_method(method) do
|
46
|
+
variable = instance_variable_get("@#{method}")
|
47
|
+
unless variable
|
48
|
+
variable = self.class.new(app_id, api_secret, method)
|
49
|
+
instance_variable_set("@#{method}", variable)
|
50
|
+
end
|
51
|
+
variable
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
VK_METHODS.each do |method|
|
58
|
+
add_method(method)
|
59
|
+
end
|
37
60
|
end
|
38
61
|
end
|
data/lib/micro_vkontakte.rb
CHANGED
@@ -3,4 +3,14 @@
|
|
3
3
|
# http://www.opensource.org/licenses/mit-license.php
|
4
4
|
|
5
5
|
require 'micro_vkontakte/base'
|
6
|
-
require 'micro_vkontakte/session'
|
6
|
+
require 'micro_vkontakte/session'
|
7
|
+
require 'omniauth/vkontakte'
|
8
|
+
|
9
|
+
module Oa
|
10
|
+
module Vkontakte
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
if defined?(Rails)
|
15
|
+
ActionController::Base.helper OmniAuth::Strategies::Vkontakte::ViewHelper::PageHelper
|
16
|
+
end
|
data/micro_vkontakte.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{micro_vkontakte}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Iskander Haziev"]
|
9
|
-
s.date = %q{2011-03-
|
9
|
+
s.date = %q{2011-03-06}
|
10
10
|
s.description = %q{Vkontakte api tools.}
|
11
11
|
s.email = %q{gvalmon@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/micro_vkontakte.rb", "lib/micro_vkontakte/base.rb", "lib/micro_vkontakte/session.rb"]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro_vkontakte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Iskander Haziev
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-06 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|