Class: Fotolia::Gallery
- Inherits:
-
Object
- Object
- Fotolia::Gallery
- Defined in:
- lib/fotolia/gallery.rb
Overview
Represents a gallery at Fotolia.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nb_media ⇒ Object
readonly
Returns the value of attribute nb_media.
-
#thumbnail_height ⇒ Object
readonly
Returns the value of attribute thumbnail_height.
-
#thumbnail_html_tag ⇒ Object
readonly
Returns the value of attribute thumbnail_html_tag.
-
#thumbnail_url ⇒ Object
readonly
Returns the value of attribute thumbnail_url.
-
#thumbnail_width ⇒ Object
readonly
Returns the value of attribute thumbnail_width.
Instance Method Summary collapse
-
#<<(medium) ⇒ Object
Add a medium to this gallery.
-
#delete ⇒ Object
Deletes the gallery.
-
#initialize(fotolia_client, attributes) ⇒ Gallery
constructor
Parameters fotolia_client:: A Fotolia::Base object.
-
#media(options = {}) ⇒ Object
Returns the media in this gallery.
Constructor Details
#initialize(fotolia_client, attributes) ⇒ Gallery
Parameters
- fotolia_client
-
A Fotolia::Base object.
- attributes
-
An hash containing the keys ‘name’, ‘id’, ‘nb_media’ and optional ‘thumbnail_width’, ‘thumbnail_height’, ‘thumbnail_html_tag’ and ‘thumbnail_url’.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fotolia/gallery.rb', line 16 def initialize(fotolia_client, attributes) @fotolia = fotolia_client @name = attributes['name'] @thumbnail_width = attributes['thumbnail_width'] if(attributes['thumbnail_width']) @thumbnail_html_tag = attributes['thumbnail_html_tag'] if(attributes['thumbnail_html_tag']) @id = attributes['id'] @nb_media = attributes['nb_media'] @thumbnail_height = attributes['thumbnail_height'] if(attributes['thumbnail_height']) @thumbnail_url = attributes['thumbnail_url'] if(attributes['thumbnail_url']) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/fotolia/gallery.rb', line 6 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/fotolia/gallery.rb', line 6 def name @name end |
#nb_media ⇒ Object (readonly)
Returns the value of attribute nb_media.
6 7 8 |
# File 'lib/fotolia/gallery.rb', line 6 def nb_media @nb_media end |
#thumbnail_height ⇒ Object (readonly)
Returns the value of attribute thumbnail_height.
6 7 8 |
# File 'lib/fotolia/gallery.rb', line 6 def thumbnail_height @thumbnail_height end |
#thumbnail_html_tag ⇒ Object (readonly)
Returns the value of attribute thumbnail_html_tag.
6 7 8 |
# File 'lib/fotolia/gallery.rb', line 6 def thumbnail_html_tag @thumbnail_html_tag end |
#thumbnail_url ⇒ Object (readonly)
Returns the value of attribute thumbnail_url.
6 7 8 |
# File 'lib/fotolia/gallery.rb', line 6 def thumbnail_url @thumbnail_url end |
#thumbnail_width ⇒ Object (readonly)
Returns the value of attribute thumbnail_width.
6 7 8 |
# File 'lib/fotolia/gallery.rb', line 6 def thumbnail_width @thumbnail_width end |
Instance Method Details
#<<(medium) ⇒ Object
Add a medium to this gallery. The gallery has to be owned by the logged in user, so this methods requires an authenticated session. See Fotolia::Base#login.
Not available in Partner API.
61 62 63 |
# File 'lib/fotolia/gallery.rb', line 61 def << (medium) medium.add_to_user_gallery(self) end |
#delete ⇒ Object
Deletes the gallery.
Requires an authenticated session. The logged in user has to be the owner of the gallery.
Not available in Partner API.
49 50 51 52 |
# File 'lib/fotolia/gallery.rb', line 49 def delete raise Fotolia::LoginRequiredError unless @fotolia.logged_in? @fotolia.remote_call('deleteUserGallery', @fotolia.session_id, self.id) end |
#media(options = {}) ⇒ Object
Returns the media in this gallery.
options hash
See Fotolia::Base#search
Returns
Fotolia::SearchResultSet
37 38 39 |
# File 'lib/fotolia/gallery.rb', line 37 def media( = {}) @fotolia.search(.merge({:gallery => self})) end |