Class: Picasa::Album
- Inherits:
-
Object
- Object
- Picasa::Album
- Defined in:
- lib/picasa.rb
Instance Attribute Summary collapse
-
#access ⇒ Object
Returns the value of attribute access.
-
#author_name ⇒ Object
Returns the value of attribute author_name.
-
#author_uri ⇒ Object
Returns the value of attribute author_uri.
-
#description ⇒ Object
Returns the value of attribute description.
-
#description_type ⇒ Object
Returns the value of attribute description_type.
-
#edit_url ⇒ Object
Returns the value of attribute edit_url.
-
#id ⇒ Object
Returns the value of attribute id.
-
#image_type ⇒ Object
Returns the value of attribute image_type.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#is_commentable ⇒ Object
Returns the value of attribute is_commentable.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number_of_comments ⇒ Object
Returns the value of attribute number_of_comments.
-
#number_of_photos ⇒ Object
Returns the value of attribute number_of_photos.
-
#picasa_session ⇒ Object
Returns the value of attribute picasa_session.
-
#self_xml_url ⇒ Object
Returns the value of attribute self_xml_url.
-
#thumbnail ⇒ Object
Returns the value of attribute thumbnail.
-
#title ⇒ Object
Returns the value of attribute title.
-
#title_type ⇒ Object
Returns the value of attribute title_type.
-
#user ⇒ Object
Returns the value of attribute user.
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
- #create_photos_from_xml(xml_response) ⇒ Object
-
#initialize ⇒ Album
constructor
A new instance of Album.
- #photos(options = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#access ⇒ Object
Returns the value of attribute access.
415 416 417 |
# File 'lib/picasa.rb', line 415 def access @access end |
#author_name ⇒ Object
Returns the value of attribute author_name.
416 417 418 |
# File 'lib/picasa.rb', line 416 def @author_name end |
#author_uri ⇒ Object
Returns the value of attribute author_uri.
416 417 418 |
# File 'lib/picasa.rb', line 416 def @author_uri end |
#description ⇒ Object
Returns the value of attribute description.
414 415 416 |
# File 'lib/picasa.rb', line 414 def description @description end |
#description_type ⇒ Object
Returns the value of attribute description_type.
414 415 416 |
# File 'lib/picasa.rb', line 414 def description_type @description_type end |
#edit_url ⇒ Object
Returns the value of attribute edit_url.
422 423 424 |
# File 'lib/picasa.rb', line 422 def edit_url @edit_url end |
#id ⇒ Object
Returns the value of attribute id.
411 412 413 |
# File 'lib/picasa.rb', line 411 def id @id end |
#image_type ⇒ Object
Returns the value of attribute image_type.
419 420 421 |
# File 'lib/picasa.rb', line 419 def image_type @image_type end |
#image_url ⇒ Object
Returns the value of attribute image_url.
419 420 421 |
# File 'lib/picasa.rb', line 419 def image_url @image_url end |
#is_commentable ⇒ Object
Returns the value of attribute is_commentable.
418 419 420 |
# File 'lib/picasa.rb', line 418 def is_commentable @is_commentable end |
#name ⇒ Object
Returns the value of attribute name.
411 412 413 |
# File 'lib/picasa.rb', line 411 def name @name end |
#number_of_comments ⇒ Object
Returns the value of attribute number_of_comments.
417 418 419 |
# File 'lib/picasa.rb', line 417 def number_of_comments @number_of_comments end |
#number_of_photos ⇒ Object
Returns the value of attribute number_of_photos.
417 418 419 |
# File 'lib/picasa.rb', line 417 def number_of_photos @number_of_photos end |
#picasa_session ⇒ Object
Returns the value of attribute picasa_session.
409 410 411 |
# File 'lib/picasa.rb', line 409 def picasa_session @picasa_session end |
#self_xml_url ⇒ Object
Returns the value of attribute self_xml_url.
422 423 424 |
# File 'lib/picasa.rb', line 422 def self_xml_url @self_xml_url end |
#thumbnail ⇒ Object
Returns the value of attribute thumbnail.
420 421 422 |
# File 'lib/picasa.rb', line 420 def thumbnail @thumbnail end |
#title ⇒ Object
Returns the value of attribute title.
413 414 415 |
# File 'lib/picasa.rb', line 413 def title @title end |
#title_type ⇒ Object
Returns the value of attribute title_type.
413 414 415 |
# File 'lib/picasa.rb', line 413 def title_type @title_type end |
#user ⇒ Object
Returns the value of attribute user.
412 413 414 |
# File 'lib/picasa.rb', line 412 def user @user end |
#xml ⇒ Object
Returns the value of attribute xml.
421 422 423 |
# File 'lib/picasa.rb', line 421 def xml @xml end |
Instance Method Details
#create_photos_from_xml(xml_response) ⇒ Object
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/picasa.rb', line 451 def create_photos_from_xml(xml_response) photos = [] #response_hash = XmlSimple.xml_in(xml_response, { 'ForceArray' => false }) #puts response_hash.inspect Picasa.entries(xml_response).each do |entry| #parse the entry xml element and get the photo object photo = Picasa.parse_photo_entry(entry) #enter session values in photo object photo.picasa_session = PicasaSession.new photo.picasa_session.auth_key = self.picasa_session.auth_key photo.picasa_session.user_id = self.picasa_session.user_id photos << photo end return photos end |
#photos(options = {}) ⇒ Object
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/picasa.rb', line 428 def photos( = {}) userId = [:user_id].nil? ? self.user : [:user_id] albumName = [:album].nil? ? self.name : [:album] albumId = [:album_id].nil? ? self.id : [:album_id] if(albumId != nil && albumId != "") url = "https://picasaweb.google.com/data/feed/api/user/#{userId}/albumid/#{albumId}?kind=photo" else url = "https://picasaweb.google.com/data/feed/api/user/#{userId}/album/#{albumName}?kind=photo" end uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) headers = {"Authorization" => "GoogleLogin auth=#{self.picasa_session.auth_key}"} response, xml_response = http.get(uri.path, headers) photos = self.create_photos_from_xml(xml_response) return photos end |