Module: Vk::DSL::Users

Included in:
Vk::DSL
Defined in:
lib/vk/dsl/users.rb

Instance Method Summary collapse

Instance Method Details

#app_user?(user_id) ⇒ Boolean

Have user installed app?

Parameters:

  • user_id (String)

    user’s identifier

Returns:

  • (Boolean)

    does user installed app



10
11
12
# File 'lib/vk/dsl/users.rb', line 10

def app_user?(user_id)
  request('users.isAppUser', user_id: user_id) == '1'
end

#get_meVk::User

Returns:



29
30
31
# File 'lib/vk/dsl/users.rb', line 29

def get_me
  @me ||= Vk::User.new(request('users.get').first)
end

#get_user(user_id, options = {}) ⇒ Vk::User

Parameters:

  • user_id (String)
  • options (Hash) (defaults to: {})

Returns:



24
25
26
# File 'lib/vk/dsl/users.rb', line 24

def get_user(user_id, options = {})
  get_users(user_id, options).first
end

#get_users(user_ids, options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/vk/dsl/users.rb', line 14

def get_users(user_ids, options = {})
  options[:user_ids] = Array.wrap(user_ids).join(',')
  (request('users.get', options) || []).map do |user|
    Vk::User.new(user)
  end
end