Browse files

implement Galleries#create method

  • Loading branch information...
1 parent 534ff34 commit 680b9e4ee8677725c25b7c40837f01cbba9adc39 Torsten Schönebaum committed Jul 15, 2009
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/fotolia/galleries.rb
View
15 lib/fotolia/galleries.rb
@@ -4,15 +4,28 @@ def initialize(fotolia_client)
@fotolia = fotolia_client
end
+ #
+ # Returns public galleries in an array.
+ #
def find_all
rsp = @fotolia.remote_call('getGalleries', @fotolia.language.id)
rsp.collect{|g| Fotolia::Gallery.new(@fotolia, g)}
end
- # TODO:: implement function
+ #
+ # Creates a gallery for the logged in user.
+ #
+ # Requires an authenticated session, see Fotolia::Base#login.
+ #
+ # Not working with Partner API.
+ #
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
end
end

0 comments on commit 680b9e4

Please sign in to comment.