Class: Fotolia::Galleries

Inherits:
Object
  • Object
show all
Defined in:
lib/fotolia/galleries.rb

Overview

Interface to galleries at Fotolia.

Use Fotolia::Base#galleries as shortcut to an instance of this class.

Instance Method Summary collapse

Constructor Details

#initialize(fotolia_client) ⇒ Galleries

Returns a new instance of Galleries.



8
9
10
# File 'lib/fotolia/galleries.rb', line 8

def initialize(fotolia_client)
  @fotolia = fotolia_client
end

Instance Method Details

#create(name) ⇒ Object

Creates a gallery for the logged in user.

Requires an authenticated session, see Fotolia::Base#login.

Not working with Partner API.



28
29
30
31
32
33
34
# File 'lib/fotolia/galleries.rb', line 28

def create(name)
  raise Fotolia::LoginRequiredError unless @fotolia.logged_in?

  res = @fotolia.remote_call('createUserGallery', @fotolia.session_id, name)

  Fotolia::Gallery.new(@fotolia, {'id' => res['id'], 'name' => name})
end

#find_allObject

Returns public galleries in an array (of Fotolia::Gallery objects).



15
16
17
18
19
# File 'lib/fotolia/galleries.rb', line 15

def find_all
  rsp = @fotolia.remote_call('getGalleries', @fotolia.language.id)

  rsp.collect{|g| Fotolia::Gallery.new(@fotolia, g)}
end