picasa 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/.travis.yml +4 -9
- data/Gemfile +4 -4
- data/README.md +4 -12
- data/extra/Thorfile +0 -3
- data/lib/picasa.rb +1 -8
- data/lib/picasa/api/album.rb +11 -11
- data/lib/picasa/api/base.rb +0 -3
- data/lib/picasa/api/comment.rb +6 -8
- data/lib/picasa/api/photo.rb +9 -9
- data/lib/picasa/api/tag.rb +6 -8
- data/lib/picasa/client.rb +2 -2
- data/lib/picasa/connection.rb +14 -51
- data/lib/picasa/exceptions.rb +1 -0
- data/lib/picasa/file.rb +8 -0
- data/lib/picasa/http.rb +28 -0
- data/lib/picasa/presenter/album.rb +15 -15
- data/lib/picasa/presenter/album_list.rb +10 -10
- data/lib/picasa/presenter/comment.rb +6 -6
- data/lib/picasa/presenter/comment_list.rb +10 -10
- data/lib/picasa/presenter/media.rb +5 -5
- data/lib/picasa/presenter/photo.rb +15 -15
- data/lib/picasa/presenter/tag.rb +3 -3
- data/lib/picasa/presenter/tag_list.rb +10 -10
- data/lib/picasa/utils.rb +11 -13
- data/lib/picasa/version.rb +1 -1
- data/picasa.gemspec +2 -1
- data/test/api/album_test.rb +163 -20
- data/test/api/comment_test.rb +95 -10
- data/test/api/photo_test.rb +27 -11
- data/test/api/tag_test.rb +84 -13
- data/test/cassettes/album-404.yml +52 -0
- data/test/cassettes/album-create.yml +107 -0
- data/test/cassettes/album-destroy.yml +55 -0
- data/test/cassettes/album-list.yml +85 -0
- data/test/cassettes/album-show.yml +123 -0
- data/test/cassettes/auth-failed.yml +50 -0
- data/test/cassettes/auth-success.yml +64 -0
- data/test/cassettes/comment-400.yml +56 -0
- data/test/cassettes/comment-create.yml +88 -0
- data/test/cassettes/comment-destroy.yml +53 -0
- data/test/cassettes/comment-list.yml +87 -0
- data/test/cassettes/photo-412.yml +58 -0
- data/test/cassettes/photo-create.yml +1908 -0
- data/test/cassettes/photo-destroy.yml +55 -0
- data/test/cassettes/tag-create.yml +85 -0
- data/test/cassettes/tag-destroy.yml +53 -0
- data/test/cassettes/tag-list.yml +79 -0
- data/test/client_test.rb +10 -10
- data/test/connection_test.rb +0 -35
- data/test/helper.rb +21 -7
- data/test/utils_test.rb +0 -6
- metadata +37 -40
- data/test/fixtures/album/album-create.txt +0 -21
- data/test/fixtures/album/album-list-with-tag.txt +0 -105
- data/test/fixtures/album/album-list.txt +0 -105
- data/test/fixtures/album/album-show-with-max-results.txt +0 -131
- data/test/fixtures/album/album-show-with-tag-and-many-photos.txt +0 -156
- data/test/fixtures/album/album-show-with-tag-and-one-photo.txt +0 -105
- data/test/fixtures/album/album-show.txt +0 -169
- data/test/fixtures/auth/success.txt +0 -14
- data/test/fixtures/comment/comment-list.txt +0 -65
- data/test/fixtures/exceptions/forbidden.txt +0 -12
- data/test/fixtures/exceptions/not_found.txt +0 -14
- data/test/fixtures/exceptions/precondition_failed.txt +0 -14
- data/test/fixtures/json.txt +0 -435
- data/test/fixtures/photo/photo-created.txt +0 -21
- data/test/fixtures/photo/photo-list-all-with-q.txt +0 -556
- data/test/fixtures/photo/photo-list-all.txt +0 -623
- data/test/fixtures/photo/photo-list-user.txt +0 -388
- data/test/fixtures/presenters/album_list.xml +0 -88
- data/test/fixtures/presenters/album_show.xml +0 -152
- data/test/fixtures/presenters/album_show_with_one_photo.xml +0 -88
- data/test/fixtures/presenters/comment_list.xml +0 -48
- data/test/fixtures/presenters/tag_list.xml +0 -51
- data/test/fixtures/tag/tag-list.txt +0 -68
- data/test/presenter/album_list_test.rb +0 -67
- data/test/presenter/album_test.rb +0 -189
- data/test/presenter/author_test.rb +0 -17
- data/test/presenter/base_test.rb +0 -50
- data/test/presenter/comment_list_test.rb +0 -67
- data/test/presenter/comment_test.rb +0 -56
- data/test/presenter/content_test.rb +0 -18
- data/test/presenter/link_test.rb +0 -21
- data/test/presenter/media_test.rb +0 -29
- data/test/presenter/photo_test.rb +0 -90
- data/test/presenter/tag_list_test.rb +0 -67
- data/test/presenter/tag_test.rb +0 -48
- data/test/presenter/thumbnail_test.rb +0 -24
@@ -1,189 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
describe Picasa::Presenter::Album do
|
5
|
-
describe "album from album list" do
|
6
|
-
before do
|
7
|
-
body = MultiXml.parse(fixture("presenters/album_list.xml"))
|
8
|
-
@album = Picasa::Presenter::Album.new(body["feed"]["entry"][0])
|
9
|
-
end
|
10
|
-
|
11
|
-
it "has author name" do
|
12
|
-
assert_equal "Wojciech Wnętrzak", @album.author.name
|
13
|
-
end
|
14
|
-
|
15
|
-
it "has author uri" do
|
16
|
-
assert_equal "https://picasaweb.google.com/106136347770555028022", @album.author.uri
|
17
|
-
end
|
18
|
-
|
19
|
-
it "has links" do
|
20
|
-
assert_equal 3, @album.links.size
|
21
|
-
end
|
22
|
-
|
23
|
-
it "has etag" do
|
24
|
-
assert_equal "\"YDkqeyI.\"", @album.etag
|
25
|
-
end
|
26
|
-
|
27
|
-
it "has media credit" do
|
28
|
-
assert_equal "Wojciech Wnętrzak", @album.media.credit
|
29
|
-
end
|
30
|
-
|
31
|
-
it "has media thumbnail url" do
|
32
|
-
assert_equal "https://lh6.googleusercontent.com/-u_2FJXbbliU/SMU_eBetTXE/AAAAAAAAAkU/3XThNVnAM-4/s160-c/Test2.jpg", @album.media.thumbnails[0].url
|
33
|
-
end
|
34
|
-
|
35
|
-
it "has published" do
|
36
|
-
assert_equal "2008-09-08T07:00:00+00:00", @album.published.to_s
|
37
|
-
end
|
38
|
-
|
39
|
-
it "has updated" do
|
40
|
-
assert_equal "2011-07-28T18:26:00+00:00", @album.updated.to_s
|
41
|
-
end
|
42
|
-
|
43
|
-
it "has title" do
|
44
|
-
assert_equal "test2", @album.title
|
45
|
-
end
|
46
|
-
|
47
|
-
it "has summary" do
|
48
|
-
assert_nil @album.summary
|
49
|
-
end
|
50
|
-
|
51
|
-
it "has rights" do
|
52
|
-
assert_equal "public", @album.rights
|
53
|
-
end
|
54
|
-
|
55
|
-
it "has id" do
|
56
|
-
assert_equal "5243667126168669553", @album.id
|
57
|
-
end
|
58
|
-
|
59
|
-
it "has name" do
|
60
|
-
assert_equal "Test2", @album.name
|
61
|
-
end
|
62
|
-
|
63
|
-
it "has location" do
|
64
|
-
assert_nil @album.location
|
65
|
-
end
|
66
|
-
|
67
|
-
it "has access" do
|
68
|
-
assert_equal "public", @album.access
|
69
|
-
end
|
70
|
-
|
71
|
-
it "has timestamp" do
|
72
|
-
assert_equal "1220857200000", @album.timestamp
|
73
|
-
end
|
74
|
-
|
75
|
-
it "has numphotos" do
|
76
|
-
assert_equal 3, @album.numphotos
|
77
|
-
end
|
78
|
-
|
79
|
-
it "has user" do
|
80
|
-
assert_equal "106136347770555028022", @album.user
|
81
|
-
end
|
82
|
-
|
83
|
-
it "has nickname" do
|
84
|
-
assert_equal "Wojciech Wnętrzak", @album.nickname
|
85
|
-
end
|
86
|
-
|
87
|
-
it "has empty photo entries" do
|
88
|
-
assert_empty @album.entries
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "album from album show" do
|
93
|
-
before do
|
94
|
-
body = MultiXml.parse(fixture("presenters/album_show.xml"))
|
95
|
-
@album = Picasa::Presenter::Album.new(body["feed"])
|
96
|
-
end
|
97
|
-
|
98
|
-
it "has author name" do
|
99
|
-
assert_equal "Wojciech Wnętrzak", @album.author.name
|
100
|
-
end
|
101
|
-
|
102
|
-
it "has author uri" do
|
103
|
-
assert_equal "https://picasaweb.google.com/106136347770555028022", @album.author.uri
|
104
|
-
end
|
105
|
-
|
106
|
-
it "has links" do
|
107
|
-
assert_equal 5, @album.links.size
|
108
|
-
end
|
109
|
-
|
110
|
-
it "has published" do
|
111
|
-
assert_nil @album.published
|
112
|
-
end
|
113
|
-
|
114
|
-
it "has updated" do
|
115
|
-
assert_equal "2011-07-28T18:26:00+00:00", @album.updated.to_s
|
116
|
-
end
|
117
|
-
|
118
|
-
it "has title" do
|
119
|
-
assert_equal "test2", @album.title
|
120
|
-
end
|
121
|
-
|
122
|
-
it "has summary" do
|
123
|
-
assert_nil @album.summary
|
124
|
-
end
|
125
|
-
|
126
|
-
it "has rights" do
|
127
|
-
assert_equal "public", @album.rights
|
128
|
-
end
|
129
|
-
|
130
|
-
it "has id" do
|
131
|
-
assert_equal "5243667126168669553", @album.id
|
132
|
-
end
|
133
|
-
|
134
|
-
it "has etag" do
|
135
|
-
assert_equal "W/\"DUICQX0_fSp7ImA9WhdSGEo.\"", @album.etag
|
136
|
-
end
|
137
|
-
|
138
|
-
it "has name" do
|
139
|
-
assert_equal "Test2", @album.name
|
140
|
-
end
|
141
|
-
|
142
|
-
it "has location" do
|
143
|
-
assert_nil @album.location
|
144
|
-
end
|
145
|
-
|
146
|
-
it "has access" do
|
147
|
-
assert_equal "public", @album.access
|
148
|
-
end
|
149
|
-
|
150
|
-
it "has timestamp" do
|
151
|
-
assert_equal "1220857200000", @album.timestamp
|
152
|
-
end
|
153
|
-
|
154
|
-
it "has numphotos" do
|
155
|
-
assert_equal 3, @album.numphotos
|
156
|
-
end
|
157
|
-
|
158
|
-
it "has user" do
|
159
|
-
assert_equal "106136347770555028022", @album.user
|
160
|
-
end
|
161
|
-
|
162
|
-
it "has nickname" do
|
163
|
-
assert_equal "Wojciech Wnętrzak", @album.nickname
|
164
|
-
end
|
165
|
-
|
166
|
-
it "has photo entries" do
|
167
|
-
assert_equal 3, @album.entries.size
|
168
|
-
end
|
169
|
-
|
170
|
-
it "has allow_prints" do
|
171
|
-
assert_equal true, @album.allow_prints
|
172
|
-
end
|
173
|
-
|
174
|
-
it "has allow_downloads" do
|
175
|
-
assert_equal true, @album.allow_downloads
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
describe "album from show with single photo" do
|
180
|
-
before do
|
181
|
-
body = MultiXml.parse(fixture("presenters/album_show_with_one_photo.xml"))
|
182
|
-
@album = Picasa::Presenter::Album.new(body["feed"])
|
183
|
-
end
|
184
|
-
|
185
|
-
it "has single photo entry in array" do
|
186
|
-
assert_kind_of Array, @album.entries
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
describe Picasa::Presenter::Author do
|
5
|
-
before do
|
6
|
-
body = MultiXml.parse(fixture("presenters/album_list.xml"))
|
7
|
-
@author = Picasa::Presenter::Author.new(body["feed"]["author"])
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has name" do
|
11
|
-
assert_equal "Wojciech Wnętrzak", @author.name
|
12
|
-
end
|
13
|
-
|
14
|
-
it "has uri" do
|
15
|
-
assert_equal "https://picasaweb.google.com/106136347770555028022", @author.uri
|
16
|
-
end
|
17
|
-
end
|
data/test/presenter/base_test.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
class TestAttributePresenter < Picasa::Presenter::Base
|
5
|
-
def attribute
|
6
|
-
parsed_body[:attribute]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class TestNilAttributePresenter < Picasa::Presenter::Base
|
11
|
-
def nil_attribute
|
12
|
-
nil
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class TestEntriesAliasPresenter < Picasa::Presenter::Base
|
17
|
-
def entries
|
18
|
-
["entries"]
|
19
|
-
end
|
20
|
-
alias :elements :entries
|
21
|
-
end
|
22
|
-
|
23
|
-
describe Picasa::Presenter::Base do
|
24
|
-
it "has attribute" do
|
25
|
-
presenter = TestAttributePresenter.new({:attribute => "presented body"})
|
26
|
-
|
27
|
-
assert_equal presenter.parsed_body, {:attribute => "presented body"}
|
28
|
-
end
|
29
|
-
|
30
|
-
it "has inspect with class name and defined attribute" do
|
31
|
-
presenter = TestAttributePresenter.new({:attribute => "presented body"})
|
32
|
-
expected = %q{#<TestAttributePresenter attribute: "presented body">}
|
33
|
-
|
34
|
-
assert_equal expected, presenter.inspect
|
35
|
-
end
|
36
|
-
|
37
|
-
it "has inspect with nil attribute" do
|
38
|
-
presenter = TestNilAttributePresenter.new({:attribute => "presented body"})
|
39
|
-
expected = %q{#<TestNilAttributePresenter nil_attribute: nil>}
|
40
|
-
|
41
|
-
assert_equal expected, presenter.inspect
|
42
|
-
end
|
43
|
-
|
44
|
-
it "has aliased method to entries" do
|
45
|
-
presenter = TestEntriesAliasPresenter.new({:attribute => "presented body"})
|
46
|
-
expected = %q{#<TestEntriesAliasPresenter elements: ["entries"]>}
|
47
|
-
|
48
|
-
assert_equal expected, presenter.inspect
|
49
|
-
end
|
50
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
describe Picasa::Presenter::CommentList do
|
5
|
-
before do
|
6
|
-
body = MultiXml.parse(fixture("presenters/comment_list.xml"))
|
7
|
-
@comment_list = Picasa::Presenter::CommentList.new(body["feed"])
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has author name" do
|
11
|
-
assert_equal "Wojciech Wnętrzak", @comment_list.author.name
|
12
|
-
end
|
13
|
-
|
14
|
-
it "has author uri" do
|
15
|
-
assert_equal "https://picasaweb.google.com/106136347770555028022", @comment_list.author.uri
|
16
|
-
end
|
17
|
-
|
18
|
-
it "has links" do
|
19
|
-
assert_equal 4, @comment_list.links.size
|
20
|
-
end
|
21
|
-
|
22
|
-
it "has title" do
|
23
|
-
assert_equal "106136347770555028022", @comment_list.title
|
24
|
-
end
|
25
|
-
|
26
|
-
it "has updated" do
|
27
|
-
assert_equal "2012-09-30T09:02:57+00:00", @comment_list.updated.to_s
|
28
|
-
end
|
29
|
-
|
30
|
-
it "has icon" do
|
31
|
-
expected = "https://lh3.googleusercontent.com/-6ezHc54U8x0/AAAAAAAAAAI/AAAAAAAAAAA/PBuxm7Ehn6E/s64-c/106136347770555028022.jpg"
|
32
|
-
assert_equal expected, @comment_list.icon
|
33
|
-
end
|
34
|
-
|
35
|
-
it "has generator" do
|
36
|
-
assert_equal "Picasaweb", @comment_list.generator
|
37
|
-
end
|
38
|
-
|
39
|
-
it "has total_results" do
|
40
|
-
assert_equal 1, @comment_list.total_results
|
41
|
-
end
|
42
|
-
|
43
|
-
it "has start_index" do
|
44
|
-
assert_equal 1, @comment_list.start_index
|
45
|
-
end
|
46
|
-
|
47
|
-
it "has items_per_page" do
|
48
|
-
assert_equal 100, @comment_list.items_per_page
|
49
|
-
end
|
50
|
-
|
51
|
-
it "has user" do
|
52
|
-
assert_equal "106136347770555028022", @comment_list.user
|
53
|
-
end
|
54
|
-
|
55
|
-
it "has nickname" do
|
56
|
-
assert_equal "Wojciech Wnętrzak", @comment_list.nickname
|
57
|
-
end
|
58
|
-
|
59
|
-
it "has thumbnail" do
|
60
|
-
expected = "https://lh3.googleusercontent.com/-6ezHc54U8x0/AAAAAAAAAAI/AAAAAAAAAAA/PBuxm7Ehn6E/s64-c/106136347770555028022.jpg"
|
61
|
-
assert_equal expected, @comment_list.thumbnail
|
62
|
-
end
|
63
|
-
|
64
|
-
it "has entries" do
|
65
|
-
assert_equal 1, @comment_list.entries.size
|
66
|
-
end
|
67
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
describe Picasa::Presenter::Comment do
|
5
|
-
describe "comment from comment list" do
|
6
|
-
before do
|
7
|
-
body = MultiXml.parse(fixture("presenters/comment_list.xml"))
|
8
|
-
@comment = Picasa::Presenter::Comment.new(body["feed"]["entry"])
|
9
|
-
end
|
10
|
-
|
11
|
-
it "has author name" do
|
12
|
-
assert_equal "Wojciech Wnętrzak", @comment.author.name
|
13
|
-
end
|
14
|
-
|
15
|
-
it "has author uri" do
|
16
|
-
assert_equal "https://picasaweb.google.com/106136347770555028022", @comment.author.uri
|
17
|
-
end
|
18
|
-
|
19
|
-
it "has links" do
|
20
|
-
assert_equal 3, @comment.links.size
|
21
|
-
end
|
22
|
-
|
23
|
-
it "has published" do
|
24
|
-
assert_equal "2012-09-30T09:02:57+00:00", @comment.published.to_s
|
25
|
-
end
|
26
|
-
|
27
|
-
it "has updated" do
|
28
|
-
assert_equal "2012-09-30T09:02:57+00:00", @comment.updated.to_s
|
29
|
-
end
|
30
|
-
|
31
|
-
it "has edited" do
|
32
|
-
assert_equal "2012-09-30T09:02:57+00:00", @comment.edited.to_s
|
33
|
-
end
|
34
|
-
|
35
|
-
it "has etag" do
|
36
|
-
assert_equal "W/\"D0ADRn04fCp7ImA9WhJbGUQ.\"", @comment.etag
|
37
|
-
end
|
38
|
-
|
39
|
-
it "has title" do
|
40
|
-
assert_equal "Wojciech Wnętrzak", @comment.title
|
41
|
-
end
|
42
|
-
|
43
|
-
it "has content" do
|
44
|
-
assert_equal "testing comment", @comment.content
|
45
|
-
end
|
46
|
-
|
47
|
-
it "has id" do
|
48
|
-
expected = "z13stn0rtrvkvpnbm04cgjbgjkmwyr5ot4g-1348995777334000"
|
49
|
-
assert_equal expected, @comment.id
|
50
|
-
end
|
51
|
-
|
52
|
-
it "has photo_id" do
|
53
|
-
assert_equal "5793892628357238194", @comment.photo_id
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
describe Picasa::Presenter::Content do
|
5
|
-
before do
|
6
|
-
body = MultiXml.parse(fixture("presenters/album_show.xml"))
|
7
|
-
@content = Picasa::Presenter::Content.new(body["feed"]["entry"][0]["content"])
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has src" do
|
11
|
-
expected = "https://lh4.googleusercontent.com/-O0AOpTAPGBQ/SMU_j4ADl9I/AAAAAAAAAFs/DRnmROPuRVU/Kashmir%252520range.jpg"
|
12
|
-
assert_equal expected, @content.src
|
13
|
-
end
|
14
|
-
|
15
|
-
it "has type" do
|
16
|
-
assert_equal "image/jpeg", @content.type
|
17
|
-
end
|
18
|
-
end
|
data/test/presenter/link_test.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
describe Picasa::Presenter::Link do
|
5
|
-
before do
|
6
|
-
body = MultiXml.parse(fixture("presenters/album_list.xml"))
|
7
|
-
@link = Picasa::Presenter::Link.new(body["feed"]["link"][0])
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has rel" do
|
11
|
-
assert_equal "http://schemas.google.com/g/2005#feed", @link.rel
|
12
|
-
end
|
13
|
-
|
14
|
-
it "has type" do
|
15
|
-
assert_equal "application/atom+xml", @link.type
|
16
|
-
end
|
17
|
-
|
18
|
-
it "has href" do
|
19
|
-
assert_equal "https://picasaweb.google.com/data/feed/api/user/106136347770555028022", @link.href
|
20
|
-
end
|
21
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
describe Picasa::Presenter::Media do
|
5
|
-
before do
|
6
|
-
body = MultiXml.parse(fixture("presenters/album_show.xml"))
|
7
|
-
@media = Picasa::Presenter::Media.new(body["feed"]["entry"][0]["group"])
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has credit" do
|
11
|
-
assert_equal "Wojciech Wnętrzak", @media.credit
|
12
|
-
end
|
13
|
-
|
14
|
-
it "has description" do
|
15
|
-
assert_nil @media.description
|
16
|
-
end
|
17
|
-
|
18
|
-
it "has keywords" do
|
19
|
-
assert_nil @media.keywords
|
20
|
-
end
|
21
|
-
|
22
|
-
it "has title" do
|
23
|
-
assert_equal "Kashmir range.jpg", @media.title
|
24
|
-
end
|
25
|
-
|
26
|
-
it "has thumbnails" do
|
27
|
-
assert_equal 3, @media.thumbnails.size
|
28
|
-
end
|
29
|
-
end
|