Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Commit

Permalink
added Album#subtitle method - in show API this field contains summary
Browse files Browse the repository at this point in the history
  • Loading branch information
morgoth committed Nov 27, 2013
1 parent aae8424 commit b42ba62
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/picasa/presenter/album.rb
Expand Up @@ -46,7 +46,13 @@ def title

# @return [String]
def summary
@summary ||= safe_retrieve(parsed_body, "summary") || safe_retrieve(parsed_body, "subtitle")
@summary ||= safe_retrieve(parsed_body, "summary")
end

# Picasa API is not consistent - in show API this field contains summary
# @return [String]
def subtitle
@subtitle ||= safe_retrieve(parsed_body, "subtitle")
end

# @return [String]
Expand Down
6 changes: 5 additions & 1 deletion test/api/album_test.rb
Expand Up @@ -107,6 +107,10 @@
assert_nil @album.summary
end

it "has subtitle" do
assert_equal "Opis albumu", @album.subtitle
end

it "has rights" do
assert_equal "public", @album.rights
end
Expand Down Expand Up @@ -260,7 +264,7 @@
it "creates album" do
VCR.use_cassette("album-create") do
attributes = {:title => "gem-test", :summary => "created from test suite <&>", :access => "protected",
:location => "Gilowice", :keywords => "test"}
:location => "Gilowice", :keywords => "test"}
album = Picasa::API::Album.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).create(attributes)

assert_equal "gem-test", album.title
Expand Down
4 changes: 2 additions & 2 deletions test/api/album_update_test.rb
Expand Up @@ -12,7 +12,7 @@
original_timestamp = album.timestamp

album = api.show(album.id)
assert_equal "created from test suite", album.summary
assert_equal "created from test suite", album.subtitle

album = api.update(album.id, :summary => "updated")

Expand All @@ -24,7 +24,7 @@
album = api.show(album.id)

assert_equal "Sydney", album.location
assert_equal "updated", album.summary
assert_equal "updated", album.subtitle
assert_equal "protected", album.access

new_timestamp = 1385553052
Expand Down

0 comments on commit b42ba62

Please sign in to comment.