Module: Picasa::Photo
- Includes:
- Missing
- Defined in:
- lib/picasa/photo.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
-
#album ⇒ Object
Returns the value of attribute album.
-
#albumid ⇒ Object
readonly
Returns the value of attribute albumid.
-
#comment_count ⇒ Object
readonly
Returns the value of attribute comment_count.
-
#description ⇒ Object
Returns the value of attribute description.
-
#file ⇒ Object
Returns the value of attribute file.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#media_content_url ⇒ Object
readonly
Returns the value of attribute media_content_url.
-
#media_thumbnail_url1 ⇒ Object
readonly
Returns the value of attribute media_thumbnail_url1.
-
#media_thumbnail_url2 ⇒ Object
readonly
Returns the value of attribute media_thumbnail_url2.
-
#media_thumbnail_url3 ⇒ Object
readonly
Returns the value of attribute media_thumbnail_url3.
-
#media_title ⇒ Object
readonly
Returns the value of attribute media_title.
-
#picasa_id ⇒ Object
readonly
Returns the value of attribute picasa_id.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
-
#destroy ⇒ Object
Delete the current photo from album.
-
#destroy! ⇒ Object
Delete the current photo from album.
-
#picasa_save ⇒ Object
Post a photo into a picasa album.
-
#picasa_save! ⇒ Object
Post a photo into a picasa album.
-
#picasa_update ⇒ Object
Update photo’s file and metadata.
-
#picasa_update! ⇒ Object
Update photo’s file and metadata.
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
#album ⇒ Object
Returns the value of attribute album.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def album @album end |
#albumid ⇒ Object (readonly)
Returns the value of attribute albumid.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def albumid @albumid end |
#comment_count ⇒ Object (readonly)
Returns the value of attribute comment_count.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def comment_count @comment_count end |
#description ⇒ Object
Returns the value of attribute description.
73 74 75 |
# File 'lib/picasa/photo.rb', line 73 def description @description end |
#file ⇒ Object
Returns the value of attribute file.
73 74 75 |
# File 'lib/picasa/photo.rb', line 73 def file @file end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def height @height end |
#media_content_url ⇒ Object (readonly)
Returns the value of attribute media_content_url.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def media_content_url @media_content_url end |
#media_thumbnail_url1 ⇒ Object (readonly)
Returns the value of attribute media_thumbnail_url1.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def media_thumbnail_url1 @media_thumbnail_url1 end |
#media_thumbnail_url2 ⇒ Object (readonly)
Returns the value of attribute media_thumbnail_url2.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def media_thumbnail_url2 @media_thumbnail_url2 end |
#media_thumbnail_url3 ⇒ Object (readonly)
Returns the value of attribute media_thumbnail_url3.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def media_thumbnail_url3 @media_thumbnail_url3 end |
#media_title ⇒ Object (readonly)
Returns the value of attribute media_title.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def media_title @media_title end |
#picasa_id ⇒ Object (readonly)
Returns the value of attribute picasa_id.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def picasa_id @picasa_id end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def size @size end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def @timestamp end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
68 69 70 |
# File 'lib/picasa/photo.rb', line 68 def width @width end |
Class Method Details
.included(base) ⇒ Object
64 65 66 |
# File 'lib/picasa/photo.rb', line 64 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#destroy ⇒ Object
Delete the current photo from album. If cannot delete, an exception is raised.
139 140 141 142 143 |
# File 'lib/picasa/photo.rb', line 139 def destroy raise_exception? do self.destroy end end |
#destroy! ⇒ Object
Delete the current photo from album. If cannot delete, an exception is raised.
128 129 130 131 132 133 134 |
# File 'lib/picasa/photo.rb', line 128 def destroy! resp, data = Picasa::HTTP::Photo.delete_photo user_id, album_id, picasa_id, auth_token if resp.code != "200" or resp. != "OK" raise Exception, "Error destroying photo: #{resp.}." end end |
#picasa_save ⇒ Object
Post a photo into a picasa album. If cannot post, returns false.
95 96 97 98 99 |
# File 'lib/picasa/photo.rb', line 95 def picasa_save raise_exception? do self.picasa_save! end end |
#picasa_save! ⇒ Object
Post a photo into a picasa album. If cannot post, an exception is raised.
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/picasa/photo.rb', line 78 def picasa_save! if self.picasa_id and self.picasa_id.length > 0 return picasa_update! end resp, data = Picasa::HTTP::Photo.post_photo user_id, album_id, auth_token, description, file if resp.code != "201" or resp. != "Created" raise Exception, "Error posting photo: #{resp.}." end populate_attributes_from_xml data end |
#picasa_update ⇒ Object
Update photo’s file and metadata. If cannot update, returns false.
119 120 121 122 123 |
# File 'lib/picasa/photo.rb', line 119 def picasa_update raise_exception? do self.picasa_update! end end |
#picasa_update! ⇒ Object
Update photo’s file and metadata. If cannot update, an exception is raised.
104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/picasa/photo.rb', line 104 def picasa_update! resp, data = Picasa::HTTP::Photo.update_photo( 'bandmanagertest', album_id, picasa_id, auth_token, description, file ) if resp.code != "200" or resp. != "OK" raise Exception, "Error updating photo: #{resp.}." end populate_attributes_from_xml data end |