Module: Picasa::Album
- Includes:
- Missing
- Defined in:
- lib/picasa/album.rb
Overview
Module that offers methods to do high level operations concerning a album within Picasa.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#access ⇒ Object
Returns the value of attribute access.
-
#author_name ⇒ Object
readonly
Returns the value of attribute author_name.
-
#author_uri ⇒ Object
readonly
Returns the value of attribute author_uri.
-
#comment_count ⇒ Object
readonly
Returns the value of attribute comment_count.
-
#commenting_enable ⇒ Object
readonly
Returns the value of attribute commenting_enable.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#link_edit ⇒ Object
readonly
Returns the value of attribute link_edit.
-
#location ⇒ Object
Returns the value of attribute location.
-
#media_content_url ⇒ Object
(also: #cover_url)
readonly
Returns the value of attribute media_content_url.
-
#media_thumbnail_url ⇒ Object
(also: #thumbnail_url)
readonly
Returns the value of attribute media_thumbnail_url.
-
#nickname ⇒ Object
readonly
Returns the value of attribute nickname.
-
#num_photos ⇒ Object
readonly
Returns the value of attribute num_photos.
-
#picasa_id ⇒ Object
readonly
Returns the value of attribute picasa_id.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#title ⇒ Object
Returns the value of attribute title.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
- #find_photo(photo_id) ⇒ Object
-
#photos(reload = false) ⇒ Object
Find all photos from the current album.
-
#picasa_destroy ⇒ Object
Destroy the current album and returns true.
-
#picasa_destroy! ⇒ Object
Destroy the current album.
-
#picasa_save ⇒ Object
Post an album into Picasa.
-
#picasa_save! ⇒ Object
Post an album into Picasa.
-
#picasa_update ⇒ Object
Update all attributes of the current album.
-
#picasa_update! ⇒ Object
Update all attributes of the current album.
-
#picasa_update_attributes(params) ⇒ Object
Update the attributes of the current album.
-
#picasa_update_attributes!(params) ⇒ Object
Update the attributes of the current album.
Methods included from Missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Picasa::Missing
Instance Attribute Details
#access ⇒ Object
Returns the value of attribute access.
89 90 91 |
# File 'lib/picasa/album.rb', line 89 def access @access end |
#author_name ⇒ Object (readonly)
Returns the value of attribute author_name.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def @author_name end |
#author_uri ⇒ Object (readonly)
Returns the value of attribute author_uri.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def @author_uri end |
#comment_count ⇒ Object (readonly)
Returns the value of attribute comment_count.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def comment_count @comment_count end |
#commenting_enable ⇒ Object (readonly)
Returns the value of attribute commenting_enable.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def commenting_enable @commenting_enable end |
#keywords ⇒ Object
Returns the value of attribute keywords.
89 90 91 |
# File 'lib/picasa/album.rb', line 89 def keywords @keywords end |
#link_edit ⇒ Object (readonly)
Returns the value of attribute link_edit.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def link_edit @link_edit end |
#location ⇒ Object
Returns the value of attribute location.
89 90 91 |
# File 'lib/picasa/album.rb', line 89 def location @location end |
#media_content_url ⇒ Object (readonly) Also known as: cover_url
Returns the value of attribute media_content_url.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def media_content_url @media_content_url end |
#media_thumbnail_url ⇒ Object (readonly) Also known as: thumbnail_url
Returns the value of attribute media_thumbnail_url.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def media_thumbnail_url @media_thumbnail_url end |
#nickname ⇒ Object (readonly)
Returns the value of attribute nickname.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def nickname @nickname end |
#num_photos ⇒ Object (readonly)
Returns the value of attribute num_photos.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def num_photos @num_photos end |
#picasa_id ⇒ Object (readonly)
Returns the value of attribute picasa_id.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def picasa_id @picasa_id end |
#summary ⇒ Object
Returns the value of attribute summary.
89 90 91 |
# File 'lib/picasa/album.rb', line 89 def summary @summary end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def @timestamp end |
#title ⇒ Object
Returns the value of attribute title.
89 90 91 |
# File 'lib/picasa/album.rb', line 89 def title @title end |
#user ⇒ Object
Returns the value of attribute user.
85 86 87 |
# File 'lib/picasa/album.rb', line 85 def user @user end |
Class Method Details
.included(base) ⇒ Object
81 82 83 |
# File 'lib/picasa/album.rb', line 81 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#find_photo(photo_id) ⇒ Object
194 195 196 |
# File 'lib/picasa/album.rb', line 194 def find_photo photo_id photo_class.picasa_find user_id, picasa_id, photo_id, auth_token end |
#photos(reload = false) ⇒ Object
Find all photos from the current album. The operation is done only one time for an instance, if it it’s needed to do it to refresh the data you can pass the parameter true so it can be reloaded.
202 203 204 205 |
# File 'lib/picasa/album.rb', line 202 def photos(reload = false) @photos = photo_class.picasa_find_all user_id, picasa_id, auth_token if reload @photos ||= photo_class.picasa_find_all user_id, picasa_id, auth_token end |
#picasa_destroy ⇒ Object
Destroy the current album and returns true. If cannot destroy it, returns false.
188 189 190 191 192 |
# File 'lib/picasa/album.rb', line 188 def picasa_destroy raise_exception? do picasa_destroy! end end |
#picasa_destroy! ⇒ Object
Destroy the current album. If cannot destroy it, an exception is raised.
177 178 179 180 181 182 183 |
# File 'lib/picasa/album.rb', line 177 def picasa_destroy! resp, data = Picasa::HTTP::Album.delete_album user_id, self.picasa_id, auth_token if resp.code != "200" or resp. != "OK" raise Exception, "Error destroying album." end end |
#picasa_save ⇒ Object
Post an album into Picasa. If cannot create the album returns false.
123 124 125 126 127 |
# File 'lib/picasa/album.rb', line 123 def picasa_save raise_exception? do picasa_save! end end |
#picasa_save! ⇒ Object
Post an album into Picasa. If cannot create the album an exception is raised.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/picasa/album.rb', line 97 def picasa_save! if self.picasa_id and picasa_id.length > 0 return self.picasa_update! end params = { :title => title, :summary => summary, :location => location, :keywords => keywords, :access => access } resp, data = Picasa::HTTP::Album.post_album(user_id, auth_token, params) if resp.code != "201" or resp. != "Created" raise Exception, "Error creating album: #{resp.}." end populate_attributes_from_xml data self end |
#picasa_update ⇒ Object
Update all attributes of the current album. If cannot update, returns false.
167 168 169 170 171 |
# File 'lib/picasa/album.rb', line 167 def picasa_update raise_exception? do picasa_update! end end |
#picasa_update! ⇒ Object
Update all attributes of the current album. If cannot update, an exception is raised.
154 155 156 157 158 159 160 161 162 |
# File 'lib/picasa/album.rb', line 154 def picasa_update! params = { :title => title, :summary => summary, :location => location, :keywords => keywords } picasa_update_attributes! params end |
#picasa_update_attributes(params) ⇒ Object
Update the attributes of the current album. If cannot update, return false.
145 146 147 148 149 |
# File 'lib/picasa/album.rb', line 145 def picasa_update_attributes params raise_exception? do picasa_update_attributes! params end end |
#picasa_update_attributes!(params) ⇒ Object
Update the attributes of the current album. If cannot update, an exception is raised.
132 133 134 135 136 137 138 139 140 |
# File 'lib/picasa/album.rb', line 132 def picasa_update_attributes! params resp, data = Picasa::HTTP::Album.update_album user_id, self.picasa_id, auth_token, params if resp.code != "200" or resp. != "OK" raise Exception, "Error updating album." end populate_attributes_from_xml data end |