Module: Vk::DSL::Photos

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

Instance Method Summary collapse

Instance Method Details

#get_album(owner_id, album_id, options = {}) ⇒ Vk::Album

Returns:



22
23
24
25
# File 'lib/vk/dsl/photos.rb', line 22

def get_album(owner_id, album_id, options = {})
  options[:album_ids] = album_id
  get_albums(owner_id, options).all.first
end

#get_albums(owner_id, options = {}) ⇒ Vk::Result<Vk::Album>

Parameters:

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

Options Hash (options):

  • :offset (Fixnum)

    offset for loaded countries

  • :count (Fixnum) — default: 100

    amount of countries to load

Returns:



11
12
13
14
15
16
17
18
19
# File 'lib/vk/dsl/photos.rb', line 11

def get_albums(owner_id, options = {})
  options[:owner_id] = owner_id
  options[:need_system] = !!options[:need_system] ? 1 : 0 if options.key?(:need_system)
  options[:photo_sizes] = !!options[:photo_sizes] ? 1 : 0 if options.key?(:photo_sizes)
  options[:need_covers] = !!options[:need_covers] ? 1 : 0 if options.key?(:need_covers)
  options[:album_ids] = Array(options[:album_ids]).map(&:to_s).join(',') if options.key?(:album_ids)
  require 'vk/album'
  Vk::Result.new('photos.getAlbums', Vk::Album, options)
end

#get_photos(owner_id, album_id, options = {}) ⇒ Vk::Result<Vk::Photo>

Returns:



28
29
30
31
32
33
# File 'lib/vk/dsl/photos.rb', line 28

def get_photos(owner_id, album_id, options = {})
  options[:owner_id] = owner_id
  options[:album_id] = album_id
  require 'vk/photo'
  Vk::Result.new('photos.get', Vk::Photo, options)
end