Sha256: feb6ab2c3ab766bf42da253a0073a8da00e9b28c4527e21e730c6bc509c4ddc9

Contents?: true

Size: 1007 Bytes

Versions: 2

Compression:

Stored size: 1007 Bytes

Contents

module Vkontakte
  module App
    # 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
    #
    class User < Base
      include Api::Photos
      include Api::Friends
      include Api::Groups
      include Api::Profile
      include Api::Wall
      include Api::Likes

      attr_reader :identifier

      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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vkontakte-0.0.5 lib/vkontakte/app/user.rb
vkontakte-0.0.4 lib/vkontakte/app/user.rb