picasa 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://picasaweb.google.com/data/entry/api/user/w.wnetrzak@gmail.com/albumid/5793892606777564353/photoid/5806295577614146146?alt=json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
base64_string: ""
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ruby-gem-picasa-v0.5.4 (gzip)
|
12
|
+
Gdata-Version:
|
13
|
+
- "2"
|
14
|
+
Content-Type:
|
15
|
+
- application/atom+xml
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip, deflate
|
18
|
+
Authorization:
|
19
|
+
- <FILTERED>
|
20
|
+
If-Match:
|
21
|
+
- "*"
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Expires:
|
28
|
+
- Fri, 02 Nov 2012 23:12:10 GMT
|
29
|
+
Date:
|
30
|
+
- Fri, 02 Nov 2012 23:12:10 GMT
|
31
|
+
Cache-Control:
|
32
|
+
- private, max-age=0, must-revalidate
|
33
|
+
Set-Cookie:
|
34
|
+
- S=photos_html=tC03KtdPGN2r7-aSZe3qSA; Domain=.google.com; Path=/; Secure; HttpOnly
|
35
|
+
- _rtok=aD7_4rBeOlyy; Path=/; Secure; HttpOnly
|
36
|
+
Gdata-Version:
|
37
|
+
- "2.0"
|
38
|
+
X-Content-Type-Options:
|
39
|
+
- nosniff
|
40
|
+
X-Frame-Options:
|
41
|
+
- SAMEORIGIN
|
42
|
+
X-Xss-Protection:
|
43
|
+
- 1; mode=block
|
44
|
+
Content-Length:
|
45
|
+
- "0"
|
46
|
+
Server:
|
47
|
+
- GSE
|
48
|
+
Content-Type:
|
49
|
+
- text/html; charset=UTF-8
|
50
|
+
body:
|
51
|
+
encoding: US-ASCII
|
52
|
+
base64_string: ""
|
53
|
+
http_version:
|
54
|
+
recorded_at: Fri, 02 Nov 2012 23:12:10 GMT
|
55
|
+
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,85 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://picasaweb.google.com/data/feed/api/user/w.wnetrzak@gmail.com/albumid/5793892606777564353/photoid/5806295577614146146?alt=json
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
base64_string: |
|
9
|
+
PGVudHJ5IHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDA1L0F0b20iPgog
|
10
|
+
IDx0aXRsZT5iZWF1dHk8L3RpdGxlPgogIDxjYXRlZ29yeSBzY2hlbWU9Imh0
|
11
|
+
dHA6Ly9zY2hlbWFzLmdvb2dsZS5jb20vZy8yMDA1I2tpbmQiIHRlcm09Imh0
|
12
|
+
dHA6Ly9zY2hlbWFzLmdvb2dsZS5jb20vcGhvdG9zLzIwMDcjdGFnIi8+Cjwv
|
13
|
+
ZW50cnk+Cg==
|
14
|
+
|
15
|
+
headers:
|
16
|
+
User-Agent:
|
17
|
+
- ruby-gem-picasa-v0.5.4 (gzip)
|
18
|
+
Gdata-Version:
|
19
|
+
- "2"
|
20
|
+
Content-Type:
|
21
|
+
- application/atom+xml
|
22
|
+
Accept-Encoding:
|
23
|
+
- gzip, deflate
|
24
|
+
Authorization:
|
25
|
+
- <FILTERED>
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 201
|
29
|
+
message: Created
|
30
|
+
headers:
|
31
|
+
Expires:
|
32
|
+
- Fri, 02 Nov 2012 19:26:13 GMT
|
33
|
+
Date:
|
34
|
+
- Fri, 02 Nov 2012 19:26:13 GMT
|
35
|
+
Cache-Control:
|
36
|
+
- private, max-age=0, must-revalidate, no-transform
|
37
|
+
Set-Cookie:
|
38
|
+
- S=photos_html=jhp6pSG9D6LFu7OtMckIQQ; Domain=.google.com; Path=/; Secure; HttpOnly
|
39
|
+
- _rtok=_YeYgDBM1shW; Path=/; Secure; HttpOnly
|
40
|
+
Content-Type:
|
41
|
+
- application/json; charset=UTF-8
|
42
|
+
Access-Control-Allow-Origin:
|
43
|
+
- "*"
|
44
|
+
Vary:
|
45
|
+
- Accept, X-GData-Authorization, GData-Version
|
46
|
+
Gdata-Version:
|
47
|
+
- "2.0"
|
48
|
+
Etag:
|
49
|
+
- W/"DkQDQ3Y_cCp7ImA9WhNSGEU."
|
50
|
+
Location:
|
51
|
+
- https://picasaweb.google.com/data/entry/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146/tag/beauty?alt=json&authkey=Gv1sRgCNmigd3KrbOHLA
|
52
|
+
Content-Location:
|
53
|
+
- https://picasaweb.google.com/data/entry/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146/tag/beauty?alt=json&authkey=Gv1sRgCNmigd3KrbOHLA
|
54
|
+
Content-Encoding:
|
55
|
+
- gzip
|
56
|
+
Transfer-Encoding:
|
57
|
+
- chunked
|
58
|
+
X-Content-Type-Options:
|
59
|
+
- nosniff
|
60
|
+
X-Frame-Options:
|
61
|
+
- SAMEORIGIN
|
62
|
+
X-Xss-Protection:
|
63
|
+
- 1; mode=block
|
64
|
+
Server:
|
65
|
+
- GSE
|
66
|
+
body:
|
67
|
+
encoding: ASCII-8BIT
|
68
|
+
base64_string: |
|
69
|
+
H4sIAAAAAAAAAN1UXW/TMBT9K8ir+sIa56P5aKVoqjYoCDQ02FQBm5CbuInX
|
70
|
+
OM5sZ2mp8kP4P/wwrlO2VmhAX3jhJZLvPb733HuOs0H3VComSjRGjmWjY0TL
|
71
|
+
RKSszCBwdflyEHUhLddovEErXpSqR6oKkrnW1RjjpmmsxrOEzLBr2yE2yeMt
|
72
|
+
8HcgH0+04A+oXpbugCrJKSfKyoTICmolguPtFUBnaY9qYnjN8DU6W16cXXgf
|
73
|
+
vySnVfiaT0az/PzD9MWVdY0AylLDtqd/FlZQuWIJUaSh8/3aKdEEd9PhWlGJ
|
74
|
+
HTtwvMAbhmFo+75vu5HtupgU85qzFPvhyItGbmAHkPeDoed7uMqFFiYX2YE7
|
75
|
+
8v0wDJyhM4RPgIEsnlNS6zVqj1FdQTe6I+bajjtwnIHtXjqjsRuMHdeKhtEn
|
76
|
+
g4Ul9mjKDoUnUDgTRqLPG9StkB6w0qMlK1NYlqaS/xHezag6eY+MAO0NXGK6
|
77
|
+
oI/kdlOqmnOyNcsvmYKVy46gpAUkSAF9SyBuGKwrQ1jTlca55gWEckkXf1Ov
|
78
|
+
yLGiRCb5XIpG0ZO7eNutX6kknvbrknAaPylpf8FM+9gGYg+EFC0WOy6gQAE9
|
79
|
+
NbwMTMCtz1cH09ozFanYvzXWCawxvlWi7MMpX9J1PL131Pvs9JyzLPXeyPm7
|
80
|
+
V28ne1MaV/23U4IvDUDIzmdG/kcfzsRtwmiSP5uV379p+ZUsuzcp2WE/iicn
|
81
|
+
Q21707Y/AMkZlQRCBQAA
|
82
|
+
|
83
|
+
http_version:
|
84
|
+
recorded_at: Fri, 02 Nov 2012 19:26:13 GMT
|
85
|
+
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://picasaweb.google.com/data/entry/api/user/w.wnetrzak@gmail.com/albumid/5793892606777564353/photoid/5806295577614146146/tag/beauty?alt=json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
base64_string: ""
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ruby-gem-picasa-v0.5.4 (gzip)
|
12
|
+
Gdata-Version:
|
13
|
+
- "2"
|
14
|
+
Content-Type:
|
15
|
+
- application/atom+xml
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip, deflate
|
18
|
+
Authorization:
|
19
|
+
- <FILTERED>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Expires:
|
26
|
+
- Fri, 02 Nov 2012 22:44:01 GMT
|
27
|
+
Date:
|
28
|
+
- Fri, 02 Nov 2012 22:44:01 GMT
|
29
|
+
Cache-Control:
|
30
|
+
- private, max-age=0, must-revalidate
|
31
|
+
Set-Cookie:
|
32
|
+
- S=photos_html=75VosCHo5p-jdB_YfBYF2Q; Domain=.google.com; Path=/; Secure; HttpOnly
|
33
|
+
- _rtok=BEt5sjzfzGGd; Path=/; Secure; HttpOnly
|
34
|
+
Gdata-Version:
|
35
|
+
- "2.0"
|
36
|
+
X-Content-Type-Options:
|
37
|
+
- nosniff
|
38
|
+
X-Frame-Options:
|
39
|
+
- SAMEORIGIN
|
40
|
+
X-Xss-Protection:
|
41
|
+
- 1; mode=block
|
42
|
+
Content-Length:
|
43
|
+
- "0"
|
44
|
+
Server:
|
45
|
+
- GSE
|
46
|
+
Content-Type:
|
47
|
+
- text/html; charset=UTF-8
|
48
|
+
body:
|
49
|
+
encoding: US-ASCII
|
50
|
+
base64_string: ""
|
51
|
+
http_version:
|
52
|
+
recorded_at: Fri, 02 Nov 2012 22:44:03 GMT
|
53
|
+
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,79 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://picasaweb.google.com/data/feed/api/user/w.wnetrzak?alt=json&kind=tag
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ""
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ruby-gem-picasa-v0.5.4 (gzip)
|
12
|
+
Gdata-Version:
|
13
|
+
- "2"
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip, deflate
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Expires:
|
22
|
+
- Thu, 01 Nov 2012 17:26:25 GMT
|
23
|
+
Date:
|
24
|
+
- Thu, 01 Nov 2012 17:26:25 GMT
|
25
|
+
Cache-Control:
|
26
|
+
- private, max-age=0, must-revalidate, no-transform
|
27
|
+
Set-Cookie:
|
28
|
+
- S=photos_html=8eaxzVvcRG3MoQYx2wnWQg; Domain=.google.com; Path=/; Secure; HttpOnly
|
29
|
+
- _rtok=511JCZCLo4RP; Path=/; Secure; HttpOnly
|
30
|
+
Content-Type:
|
31
|
+
- application/json; charset=UTF-8
|
32
|
+
Access-Control-Allow-Origin:
|
33
|
+
- "*"
|
34
|
+
Vary:
|
35
|
+
- Accept, X-GData-Authorization, GData-Version, Cookie
|
36
|
+
Gdata-Version:
|
37
|
+
- "2.0"
|
38
|
+
Etag:
|
39
|
+
- W/"D0UGSHg5fCp7ImA9WhNSF0k."
|
40
|
+
Last-Modified:
|
41
|
+
- Thu, 01 Nov 2012 04:47:09 GMT
|
42
|
+
Content-Encoding:
|
43
|
+
- gzip
|
44
|
+
Transfer-Encoding:
|
45
|
+
- chunked
|
46
|
+
X-Content-Type-Options:
|
47
|
+
- nosniff
|
48
|
+
X-Frame-Options:
|
49
|
+
- SAMEORIGIN
|
50
|
+
X-Xss-Protection:
|
51
|
+
- 1; mode=block
|
52
|
+
Server:
|
53
|
+
- GSE
|
54
|
+
body:
|
55
|
+
encoding: ASCII-8BIT
|
56
|
+
string: !binary |
|
57
|
+
H4sIAAAAAAAAAM1W227aQBD9lcohvDT2rrkmSFZEmutLhXIRUps+LGawN9he
|
58
|
+
d3cdk0R8SP+nH9ZZczGkJOGhUWqQjdZn58ycmZ3hyboHqbhIrI7lOtTasyDx
|
59
|
+
xZAnAS7cXJ/a+7g0AhhanSdrEkeJwvVQ67RDSJ7nTl53hAxIjdIm6WoRI7pA
|
60
|
+
VYI0FFqUYOWHEDPlBEIEETi+iEmBUGZve7lNpJBcAZN+WG5lBwXcJioFnxiE
|
61
|
+
KhDEdVxSEg5fJZv5iOhgWAHNTHh9cmsd05uzq/OgOfqSti/i7kE//Hp1SsfO
|
62
|
+
rYVQXkRd0XPDCi2n3GeK5TBYtT1kmhEjEskUSOLSlltv1Rvtdps2m01a26e1
|
63
|
+
mjXds7IUkVAarVG3ZruuTd1r2ug02h164LRqjW8G6yMyEPLB6nx/sop4YIv4
|
64
|
+
dsY8GaLnGmS8rfY7xmlr+gN3cR3B0rsXw1DZYB1pFrlvauiZWlFYn5MaDkRo
|
65
|
+
SPQsmS14PPebjZv9CSXd5XWx8rtLekfZJG6fhEnrhKhWw/Y3S+vcpYFxIeLJ
|
66
|
+
uJBLQrSNVkVZY9QPqZGWpWmEydV4FgjDSv6MZYVvQwmj7fPPUv5KDRyySHt3
|
67
|
+
CoWa7i28xCWQCSa79ETDRJNQb03/UqLeFmK1ClTEh6BCkW+WZGLjO3+cs3uw
|
68
|
+
RxFT4ZbOKeKTAU/I0ryj8tFhKJT2NuGrl2dHHp3Q4qoaTb3C/G69u1s7xe+m
|
69
|
+
TbhsUoAPswEfmAa8m0TgY6M8u/VTVH63fiyVWpFKQTT6mJKoKs2ktvH4wsRz
|
70
|
+
qzGb2BJUFmnlNVEJc64907bMOWWZDoUsSj1hcXkO++LO5+CHn/rJ719aPrJx
|
71
|
+
0XUk366NvVBHhjGABCRKIJeWegsLKMjaCDEzpKBc1N1GLuNY2esrWmgWXc7i
|
72
|
+
XVC465BCnwsjzwsAriFWPZA9FiwlQekQNJtFlaLPvdnd5uCE++MtxJ2jdZjF
|
73
|
+
g4Tx6INbINqej4z3GnMFwysFTZCUYD/LJPzHI29xktbnWOm2yuKYGU/+evNs
|
74
|
+
yPyD9h2FZPZ/ZiBFruDwpzdjq6bK986qmalCb6PW1RE39B59tw42y/brLWwl
|
75
|
+
4ysD7gPaFH6mfwCS2xOI0AoAAA==
|
76
|
+
|
77
|
+
http_version:
|
78
|
+
recorded_at: Thu, 01 Nov 2012 17:26:25 GMT
|
79
|
+
recorded_with: VCR 2.3.0
|
data/test/client_test.rb
CHANGED
@@ -14,21 +14,21 @@ describe Picasa::Client do
|
|
14
14
|
|
15
15
|
describe "#authenticate" do
|
16
16
|
it "successfully authenticates" do
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
VCR.use_cassette("auth-success") do
|
18
|
+
client = Picasa::Client.new(:user_id => "w.wnetrzak@gmail.com", :password => Password)
|
19
|
+
client.authenticate
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
refute_nil client.authorization_header
|
22
|
+
end
|
23
23
|
end
|
24
24
|
|
25
25
|
it "raises an ForbiddenError when authentication failed" do
|
26
|
-
|
26
|
+
VCR.use_cassette("auth-failed") do
|
27
|
+
client = Picasa::Client.new(:user_id => "w.wnetrzak@gmail.com", :password => "invalid")
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
client.authenticate
|
29
|
+
assert_raises(Picasa::ForbiddenError) do
|
30
|
+
client.authenticate
|
31
|
+
end
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/test/connection_test.rb
CHANGED
@@ -4,39 +4,4 @@ describe Picasa::Connection do
|
|
4
4
|
before do
|
5
5
|
@connection = Picasa::Connection.new
|
6
6
|
end
|
7
|
-
|
8
|
-
describe "#path_with_query" do
|
9
|
-
it "returns path when no params provided" do
|
10
|
-
path = @connection.path_with_query("/data/feed/api")
|
11
|
-
assert_equal "/data/feed/api", path
|
12
|
-
end
|
13
|
-
|
14
|
-
it "adds params to path" do
|
15
|
-
path = @connection.path_with_query("/data/feed/api", {:q => "bomb"})
|
16
|
-
assert_equal "/data/feed/api?q=bomb", path
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it "raises NotFound exception when 404 returned" do
|
21
|
-
connection = Picasa::Connection.new
|
22
|
-
uri = URI.parse("/data/feed/api/user/some.user/albumid/non-existing")
|
23
|
-
|
24
|
-
stub_request(:get, "https://picasaweb.google.com" + uri.path).to_return(fixture("exceptions/not_found.txt"))
|
25
|
-
|
26
|
-
assert_raises Picasa::NotFoundError, "Invalid entity id: non-existing" do
|
27
|
-
connection.get(:path => uri.path)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it "raises PreconditionFailed exception when 412 returned" do
|
32
|
-
connection = Picasa::Connection.new
|
33
|
-
uri = URI.parse("/data/feed/api/user/some.user/albumid/123")
|
34
|
-
|
35
|
-
stub_request(:post, "https://www.google.com/accounts/ClientLogin").to_return(fixture("auth/success.txt"))
|
36
|
-
stub_request(:delete, "https://picasaweb.google.com" + uri.path).to_return(fixture("exceptions/precondition_failed.txt"))
|
37
|
-
|
38
|
-
assert_raises Picasa::PreconditionFailedError, "Mismatch: etags = [oldetag], version = [7]" do
|
39
|
-
connection.delete(:path => uri.path, :headers => {"If-Match" => "oldetag"})
|
40
|
-
end
|
41
|
-
end
|
42
7
|
end
|
data/test/helper.rb
CHANGED
@@ -1,13 +1,25 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "zlib"
|
3
|
+
|
1
4
|
require "minitest/autorun"
|
2
5
|
require "webmock/minitest"
|
6
|
+
require "vcr"
|
3
7
|
require "mocha"
|
4
8
|
|
5
9
|
require "picasa"
|
6
10
|
|
7
|
-
|
11
|
+
AuthHeader = ENV["PICASA_AUTH_HEADER"] || "GoogleLogin auth=token"
|
12
|
+
Password = ENV["PICASA_PASSWORD"] || "secret"
|
13
|
+
|
14
|
+
MultiJson.adapter = ENV["JSON_PARSER"] || "oj"
|
8
15
|
|
9
|
-
|
10
|
-
|
16
|
+
VCR.configure do |c|
|
17
|
+
c.cassette_library_dir = "test/cassettes"
|
18
|
+
c.hook_into :webmock
|
19
|
+
c.default_cassette_options = {:serialize_with => :syck, :preserve_exact_body_bytes => true} # Avoid stroing headers as binary
|
20
|
+
c.filter_sensitive_data("<FILTERED>") { AuthHeader }
|
21
|
+
c.filter_sensitive_data("<FILTERED>") { Password }
|
22
|
+
end
|
11
23
|
|
12
24
|
class MiniTest::Unit::TestCase
|
13
25
|
def setup
|
@@ -18,9 +30,11 @@ class MiniTest::Unit::TestCase
|
|
18
30
|
File.join("test", "fixtures", filename)
|
19
31
|
end
|
20
32
|
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
33
|
+
# Retrieves gzipped body
|
34
|
+
def decode(cassette_name)
|
35
|
+
cassette = YAML.load_file(File.join("test", "cassettes", cassette_name))
|
36
|
+
gzipped_body = cassette["http_interactions"][0]["response"]["body"]["string"]
|
37
|
+
body_io = StringIO.new(gzipped_body)
|
38
|
+
Zlib::GzipReader.new(body_io).read
|
25
39
|
end
|
26
40
|
end
|
data/test/utils_test.rb
CHANGED
@@ -43,12 +43,6 @@ describe Picasa::Utils do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe "#array_wrap" do
|
47
|
-
it "wraps hash into array" do
|
48
|
-
assert_equal [{:wt => :f}], Picasa::Utils.array_wrap({:wt => :f})
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
46
|
describe "#map_to_integer" do
|
53
47
|
it "does not convert nil value" do
|
54
48
|
assert_nil Picasa::Utils.map_to_integer(nil)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picasa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: httparty
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: vcr
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
description: Simple Google Picasa managment
|
63
79
|
email:
|
64
80
|
- w.wnetrzak@gmail.com
|
@@ -91,6 +107,7 @@ files:
|
|
91
107
|
- lib/picasa/connection.rb
|
92
108
|
- lib/picasa/exceptions.rb
|
93
109
|
- lib/picasa/file.rb
|
110
|
+
- lib/picasa/http.rb
|
94
111
|
- lib/picasa/presenter/album.rb
|
95
112
|
- lib/picasa/presenter/album_list.rb
|
96
113
|
- lib/picasa/presenter/author.rb
|
@@ -116,47 +133,28 @@ files:
|
|
116
133
|
- test/api/comment_test.rb
|
117
134
|
- test/api/photo_test.rb
|
118
135
|
- test/api/tag_test.rb
|
136
|
+
- test/cassettes/album-404.yml
|
137
|
+
- test/cassettes/album-create.yml
|
138
|
+
- test/cassettes/album-destroy.yml
|
139
|
+
- test/cassettes/album-list.yml
|
140
|
+
- test/cassettes/album-show.yml
|
141
|
+
- test/cassettes/auth-failed.yml
|
142
|
+
- test/cassettes/auth-success.yml
|
143
|
+
- test/cassettes/comment-400.yml
|
144
|
+
- test/cassettes/comment-create.yml
|
145
|
+
- test/cassettes/comment-destroy.yml
|
146
|
+
- test/cassettes/comment-list.yml
|
147
|
+
- test/cassettes/photo-412.yml
|
148
|
+
- test/cassettes/photo-create.yml
|
149
|
+
- test/cassettes/photo-destroy.yml
|
150
|
+
- test/cassettes/tag-create.yml
|
151
|
+
- test/cassettes/tag-destroy.yml
|
152
|
+
- test/cassettes/tag-list.yml
|
119
153
|
- test/client_test.rb
|
120
154
|
- test/connection_test.rb
|
121
155
|
- test/file_test.rb
|
122
|
-
- test/fixtures/album/album-create.txt
|
123
|
-
- test/fixtures/album/album-list-with-tag.txt
|
124
|
-
- test/fixtures/album/album-list.txt
|
125
|
-
- test/fixtures/album/album-show-with-max-results.txt
|
126
|
-
- test/fixtures/album/album-show-with-tag-and-many-photos.txt
|
127
|
-
- test/fixtures/album/album-show-with-tag-and-one-photo.txt
|
128
|
-
- test/fixtures/album/album-show.txt
|
129
|
-
- test/fixtures/auth/success.txt
|
130
|
-
- test/fixtures/comment/comment-list.txt
|
131
|
-
- test/fixtures/exceptions/forbidden.txt
|
132
|
-
- test/fixtures/exceptions/not_found.txt
|
133
|
-
- test/fixtures/exceptions/precondition_failed.txt
|
134
|
-
- test/fixtures/json.txt
|
135
156
|
- test/fixtures/lena.jpg
|
136
|
-
- test/fixtures/photo/photo-created.txt
|
137
|
-
- test/fixtures/photo/photo-list-all-with-q.txt
|
138
|
-
- test/fixtures/photo/photo-list-all.txt
|
139
|
-
- test/fixtures/photo/photo-list-user.txt
|
140
|
-
- test/fixtures/presenters/album_list.xml
|
141
|
-
- test/fixtures/presenters/album_show.xml
|
142
|
-
- test/fixtures/presenters/album_show_with_one_photo.xml
|
143
|
-
- test/fixtures/presenters/comment_list.xml
|
144
|
-
- test/fixtures/presenters/tag_list.xml
|
145
|
-
- test/fixtures/tag/tag-list.txt
|
146
157
|
- test/helper.rb
|
147
|
-
- test/presenter/album_list_test.rb
|
148
|
-
- test/presenter/album_test.rb
|
149
|
-
- test/presenter/author_test.rb
|
150
|
-
- test/presenter/base_test.rb
|
151
|
-
- test/presenter/comment_list_test.rb
|
152
|
-
- test/presenter/comment_test.rb
|
153
|
-
- test/presenter/content_test.rb
|
154
|
-
- test/presenter/link_test.rb
|
155
|
-
- test/presenter/media_test.rb
|
156
|
-
- test/presenter/photo_test.rb
|
157
|
-
- test/presenter/tag_list_test.rb
|
158
|
-
- test/presenter/tag_test.rb
|
159
|
-
- test/presenter/thumbnail_test.rb
|
160
158
|
- test/template_test.rb
|
161
159
|
- test/utils_test.rb
|
162
160
|
homepage: https://github.com/morgoth/picasa
|
@@ -184,4 +182,3 @@ signing_key:
|
|
184
182
|
specification_version: 3
|
185
183
|
summary: simple google picasa managment
|
186
184
|
test_files: []
|
187
|
-
has_rdoc:
|