picasawebalbums 1.2.3 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/lib/PicasaWebAlbums/version.rb +1 -1
- data/lib/repositories/albums_repository.rb +32 -0
- data/test/test_albums.rb +15 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -41,4 +41,36 @@ module AlbumsRepository
|
|
41
41
|
album_to_return = albums[albums.find_index{|album| album.slug == slug.to_s}]
|
42
42
|
return album_to_return
|
43
43
|
end
|
44
|
+
|
45
|
+
def create_album(album)
|
46
|
+
entry = "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:gphoto='http://schemas.google.com/photos/2007'><title type='text'>#{album.title}</title><summary type='text'>#{album.description}</summary><gphoto:location></gphoto:location><gphoto:access>#{album.access}</gphoto:access><gphoto:timestamp></gphoto:timestamp><media:group><media:keywords></media:keywords></media:group><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/photos/2007#album'></category></entry>"
|
47
|
+
post_new_album(entry)
|
48
|
+
end
|
49
|
+
|
50
|
+
#def delete_album_by_id(album_id)
|
51
|
+
# url = URI.parse("https://picasaweb.google.com/data/entry/api/user/#{@email}/albumid/#{album_id}")
|
52
|
+
# http = Net::HTTP.new(url.host, url.port)
|
53
|
+
# http.use_ssl = (url.scheme == 'https')
|
54
|
+
# http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
55
|
+
# req = Net::HTTP::Delete.new(url.request_uri)
|
56
|
+
# req['Authorization'] = @authentication_token
|
57
|
+
# res = http.request(req)
|
58
|
+
# return res.code
|
59
|
+
#end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def post_new_album(data)
|
64
|
+
uri = URI("https://picasaweb.google.com/data/feed/api/user/#{@email}")
|
65
|
+
status = ""
|
66
|
+
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
67
|
+
request = Net::HTTP::Post.new uri.request_uri
|
68
|
+
request['Authorization'] = @authentication_token
|
69
|
+
request['Content-Type'] = "application/atom+xml; charset=UTF-8; type=entry"
|
70
|
+
request.body = data
|
71
|
+
response = http.request(request)
|
72
|
+
status = response.code
|
73
|
+
end
|
74
|
+
return status
|
75
|
+
end
|
44
76
|
end
|
data/test/test_albums.rb
CHANGED
@@ -28,5 +28,20 @@ module PicasaWebAlbums
|
|
28
28
|
assert_equal "5577380987485671713", album.id
|
29
29
|
end
|
30
30
|
|
31
|
+
#def test_create_new_album
|
32
|
+
# album = Album.new
|
33
|
+
# album.title = "Programmatic album title"
|
34
|
+
# album.description = "This is my programmatic album description!"
|
35
|
+
# album.access = "private"
|
36
|
+
# status_code = @repo.create_album(album)
|
37
|
+
# assert_equal "201", status_code
|
38
|
+
#end
|
39
|
+
|
40
|
+
#def test_delete_album
|
41
|
+
# album = @repo.get_album_by_title("Programmatic album title")
|
42
|
+
# status_code = @repo.delete_album_by_id(album.id)
|
43
|
+
# assert_equal "201", status_code
|
44
|
+
#end
|
45
|
+
|
31
46
|
end
|
32
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picasawebalbums
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A simple way to retrieve albums, photos, tags, etc. from Picasa Web Albums.
|
15
15
|
email:
|