Class: Vkontakte::App::User

Inherits:
Base
  • Object
show all
Includes:
Vkontakte::Api::Friends, Vkontakte::Api::Groups, Vkontakte::Api::Likes, Vkontakte::Api::Photos, Vkontakte::Api::Profile, Vkontakte::Api::Wall
Defined in:
lib/vkontakte/app/user.rb

Overview

Vkontakte user

user = Vkontakte::App::User.fetch(uid, :access_token => ACCESS_TOKEN)

or

user = Vkontakte::App::User.new(uid, :access_token => ACCESS_TOKEN)
user.fetch

Instance Attribute Summary collapse

Attributes inherited from Base

#auth

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Vkontakte::Api::Likes

included

Methods included from Vkontakte::Api::Wall

included

Methods included from Vkontakte::Api::Profile

included

Methods included from Vkontakte::Api::Groups

included

Methods included from Vkontakte::Api::Friends

included

Methods included from Vkontakte::Api::Photos

included

Methods inherited from Base

#authorize, #authorized?, #call

Constructor Details

#initialize(identifier, options = {}) ⇒ User

Returns a new instance of User.



22
23
24
25
26
27
# File 'lib/vkontakte/app/user.rb', line 22

def initialize(identifier, options = {})
  super(options[:app_id], options[:app_secret])
  @identifier = identifier
  @auth = { 'access_token' => options[:access_token] } if options.has_key?(:access_token)
  photos.default_params = { :uid => @identifier }
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



20
21
22
# File 'lib/vkontakte/app/user.rb', line 20

def identifier
  @identifier
end

Class Method Details

.fetch(identifier, options = {}) ⇒ Object



44
45
46
# File 'lib/vkontakte/app/user.rb', line 44

def self.fetch(identifier, options = {})
  new(identifier, options).fetch
end

Instance Method Details

#fetch(options = {}) ⇒ Object



29
30
31
32
# File 'lib/vkontakte/app/user.rb', line 29

def fetch(options = {})
  options = { :uids => @identifier }.merge(options)
  profile.get( options )
end

#fetch_followers(options = {}) ⇒ Object



34
35
36
37
# File 'lib/vkontakte/app/user.rb', line 34

def fetch_followers(options = {})
  options = { :user_id => @identifier }.merge(options)
  profile.getFollowers(options)
end

#fetch_friends(options = {}) ⇒ Object



39
40
41
42
# File 'lib/vkontakte/app/user.rb', line 39

def fetch_friends(options = {})
  options = { :user_id => @identifier }.merge(options)
  friends.get(options)
end