Class: Google::Picasa::Album

Inherits:
Object
  • Object
show all
Defined in:
lib/google-picasa.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAlbum

Returns a new instance of Album.



417
418
419
# File 'lib/google-picasa.rb', line 417

def initialize()
  thumbnail = Thumbnail.new()
end

Instance Attribute Details

#accessObject

Returns the value of attribute access.



408
409
410
# File 'lib/google-picasa.rb', line 408

def access
  @access
end

#author_nameObject

Returns the value of attribute author_name.



409
410
411
# File 'lib/google-picasa.rb', line 409

def author_name
  @author_name
end

#author_uriObject

Returns the value of attribute author_uri.



409
410
411
# File 'lib/google-picasa.rb', line 409

def author_uri
  @author_uri
end

#descriptionObject

Returns the value of attribute description.



407
408
409
# File 'lib/google-picasa.rb', line 407

def description
  @description
end

#description_typeObject

Returns the value of attribute description_type.



407
408
409
# File 'lib/google-picasa.rb', line 407

def description_type
  @description_type
end

#edit_urlObject

Returns the value of attribute edit_url.



415
416
417
# File 'lib/google-picasa.rb', line 415

def edit_url
  @edit_url
end

#idObject

Returns the value of attribute id.



404
405
406
# File 'lib/google-picasa.rb', line 404

def id
  @id
end

#image_typeObject

Returns the value of attribute image_type.



412
413
414
# File 'lib/google-picasa.rb', line 412

def image_type
  @image_type
end

#image_urlObject

Returns the value of attribute image_url.



412
413
414
# File 'lib/google-picasa.rb', line 412

def image_url
  @image_url
end

#is_commentableObject

Returns the value of attribute is_commentable.



411
412
413
# File 'lib/google-picasa.rb', line 411

def is_commentable
  @is_commentable
end

#nameObject

Returns the value of attribute name.



404
405
406
# File 'lib/google-picasa.rb', line 404

def name
  @name
end

#number_of_commentsObject

Returns the value of attribute number_of_comments.



410
411
412
# File 'lib/google-picasa.rb', line 410

def number_of_comments
  @number_of_comments
end

#number_of_photosObject

Returns the value of attribute number_of_photos.



410
411
412
# File 'lib/google-picasa.rb', line 410

def number_of_photos
  @number_of_photos
end

#picasa_sessionObject

Returns the value of attribute picasa_session.



402
403
404
# File 'lib/google-picasa.rb', line 402

def picasa_session
  @picasa_session
end

#self_xml_urlObject

Returns the value of attribute self_xml_url.



415
416
417
# File 'lib/google-picasa.rb', line 415

def self_xml_url
  @self_xml_url
end

#thumbnailObject

Returns the value of attribute thumbnail.



413
414
415
# File 'lib/google-picasa.rb', line 413

def thumbnail
  @thumbnail
end

#titleObject

Returns the value of attribute title.



406
407
408
# File 'lib/google-picasa.rb', line 406

def title
  @title
end

#title_typeObject

Returns the value of attribute title_type.



406
407
408
# File 'lib/google-picasa.rb', line 406

def title_type
  @title_type
end

#userObject

Returns the value of attribute user.



405
406
407
# File 'lib/google-picasa.rb', line 405

def user
  @user
end

#xmlObject

Returns the value of attribute xml.



414
415
416
# File 'lib/google-picasa.rb', line 414

def xml
  @xml
end

Instance Method Details

#create_photos_from_xml(xml_response) ⇒ Object



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/google-picasa.rb', line 445

def create_photos_from_xml(xml_response)
  photos = []

  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



421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/google-picasa.rb', line 421

def photos(options = {})
  userId = options[:user_id].nil? ? self.user : options[:user_id]
  albumName = options[:album].nil? ? self.name : options[:album]
  albumId = options[:album_id].nil? ? self.id : options[:album_id]

  if(albumId != nil && albumId != "")
    url = "http://picasaweb.google.com/data/feed/api/user/#{userId}/albumid/#{albumId}?kind=photo"
  else
    url = "http://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 = http.get(uri.path, headers)
  xml_response = response.body

  photos = self.create_photos_from_xml(xml_response)

  return photos
end