Module: Vk::DSL::Groups

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

Instance Method Summary collapse

Instance Method Details

#get_group_by_id(group_id, options = {}) ⇒ Object Also known as: get_group

Parameters:

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

Options Hash (options):

  • :fields (<:city, :country, :place, :description, :wiki_page, :members_count, :counters, :start_date, :end_date, :can_post, :can_see_all_posts, :activity, :status, :contacts, :links, :fixed_post, :verified, :site, :can_create_topic>)


34
35
36
# File 'lib/vk/dsl/groups.rb', line 34

def get_group_by_id(group_id, options = {})
  get_groups_by_id(group_id, options).first
end

#get_groups(user_id, options = {}) ⇒ Array

Identifiers of groups in which user participates

Parameters:

  • user_id (Integer)

    user’s identifier

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

Options Hash (options):

  • :extended (Boolean) — default: 0
  • :filter (<:admin, :editor, :moder, :groups, :publics, :events>)
  • :fields (<:city, :country, :place, :description, :wiki_page, :members_count, :counters, :start_date, :end_date, :can_post, :can_see_all_posts, :activity, :status, :contacts, :links, :fixed_post, :verified, :site, :can_create_topic>)
  • :offset (Fixnum)
  • :count (Fixnum)

Returns:

  • (Array)

    array of group identifiers



15
16
17
18
19
20
21
# File 'lib/vk/dsl/groups.rb', line 15

def get_groups(user_id, options = {})
  options[:user_id] = user_id
  options[:extended] = !!options[:extended] ? 1 : 0 if options[:extended]
  options[:filter] = options[:filter].map(&:to_s).join(',') if options[:filter]
  options[:fields] = options[:fields].map(&:to_s).join(',') if options[:fields]
  Vk::Result.new('groups.get', Vk::Group, options)
end

#get_groups_by_id(group_ids, options = {}) ⇒ Object

Parameters:

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

Options Hash (options):

  • :fields (<:city, :country, :place, :description, :wiki_page, :members_count, :counters, :start_date, :end_date, :can_post, :can_see_all_posts, :activity, :status, :contacts, :links, :fixed_post, :verified, :site, :can_create_topic>)


26
27
28
29
# File 'lib/vk/dsl/groups.rb', line 26

def get_groups_by_id(group_ids, options = {})
  options[:group_ids] = Array(group_ids).join(',')
  (request('groups.getById', options) || []).map { |group| Vk::Group.new(group) }
end