Module: ZVK

Defined in:
lib/fetch-ships.rb

Class Method Summary collapse

Class Method Details

.dlog(*args) ⇒ Object



12
13
14
# File 'lib/fetch-ships.rb', line 12

def self.dlog(*args)
	STDERR.puts args
end

.users_friends(uids) ⇒ Object

для каждого айдишника подтягиваем друзей результат - хэш: айди->друзья(их айдишники)



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fetch-ships.rb', line 40

def self.users_friends(uids)
 dlog 'friends in: %s'%[uids]
 vk=VK::Application.new
 Hash[
		uids.map do |uid|
begin
  [uid, vk.friends.get(uid: uid)]
rescue =>err
end
		end 
 ]
end

.users_info(uids) ⇒ Object

получить инфу по пользователям uids

returns

хэш с инфой



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fetch-ships.rb', line 21

def self.users_info(uids)
 dlog 'infos in: %s'%[uids]
 vk=VK::Application.new
 res={}
 [uids].flatten.each_slice(10000) do |next_uids|
  begin
			uinfos=vk.users.get('user_ids'=>next_uids.join(','),
      fields: 'sex, bdate, city, country, photo_50, photo_100, photo_200_orig, photo_200, photo_400_orig, photo_max, photo_max_orig, online, online_mobile, lists, domain, has_mobile, contacts, connections, site, education, universities, schools, can_post, can_see_all_posts, can_see_audio, can_write_private_message, status, last_seen, relation, relatives, counters '.split(', '))
			uinfos.each do |uinfo|
res[uinfo['uid']]=uinfo.dup if uinfo['uid']
			end
  rescue => err
  end
 end
 res	     
end