Module: Picasa::User
- Defined in:
- lib/picasa/user.rb
Overview
Module that offers methods to do high level operations concerning a google user within Picasa.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
Returns the value of attribute auth_token.
-
#password ⇒ Object
writeonly
Sets the attribute password.
-
#picasa_id ⇒ Object
Returns the value of attribute picasa_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#albums(reload = false) ⇒ Object
Find all albums from the current user.
-
#authenticate ⇒ Object
Authenticates user using the attributes of the instance.
-
#find_album(album_id) ⇒ Object
Find an album from the current user using the album_id.
Instance Attribute Details
#auth_token ⇒ Object
Returns the value of attribute auth_token.
27 28 29 |
# File 'lib/picasa/user.rb', line 27 def auth_token @auth_token end |
#password=(value) ⇒ Object (writeonly)
Sets the attribute password
28 29 30 |
# File 'lib/picasa/user.rb', line 28 def password=(value) @password = value end |
#picasa_id ⇒ Object
Returns the value of attribute picasa_id.
27 28 29 |
# File 'lib/picasa/user.rb', line 27 def picasa_id @picasa_id end |
Class Method Details
.included(base) ⇒ Object
22 23 24 25 |
# File 'lib/picasa/user.rb', line 22 def self.included(base) ClassMethods.extend Picasa::Util base.extend(ClassMethods) end |
Instance Method Details
#albums(reload = false) ⇒ Object
Find all albums from the current user. 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.
49 50 51 52 |
# File 'lib/picasa/user.rb', line 49 def albums(reload = false) @albums = album_class.picasa_find_all(picasa_id, auth_token) if reload @albums ||= album_class.picasa_find_all(picasa_id, auth_token) end |
#authenticate ⇒ Object
Authenticates user using the attributes of the instance. Returns the authentication token if the authentication succedes, otherwise an exception is raised.
34 35 36 |
# File 'lib/picasa/user.rb', line 34 def authenticate @auth_token ||= Picasa::Authentication.authenticate picasa_id, @password end |
#find_album(album_id) ⇒ Object
Find an album from the current user using the album_id
40 41 42 43 |
# File 'lib/picasa/user.rb', line 40 def find_album album_id album = album_class.picasa_find picasa_id, album_id, auth_token album end |