picasawebalbums 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in PicasaWebAlbums.gemspec
4
3
  gemspec
@@ -10,15 +10,11 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "https://github.com/mkraft/PicasaWebAlbums"
11
11
  s.summary = %q{Provides programmatic access to Picasa Web Albums data.}
12
12
  s.description = %q{A simple way to retrieve albums, photos, tags, etc. from Picasa Web Albums.}
13
-
13
+ s.license = 'MIT'
14
14
  s.rubyforge_project = "picasawebalbums"
15
15
  s.required_ruby_version = '>= 1.9.3'
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
-
21
- # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
24
20
  end
@@ -13,13 +13,13 @@ Rails/Application Integration
13
13
 
14
14
  Add one of the below lines to the Gemfile:
15
15
 
16
- - `gem 'picasawebalbums'`, or
16
+ - `gem 'picasawebalbums`, or
17
17
  - `gem 'picasawebalbums', :git => 'git@github.com:mkraft/PicasaWebAlbums.git'`
18
18
 
19
19
  Then run `bundle install`
20
20
 
21
- Code Examples
22
- -------------
21
+ Usage
22
+ -----
23
23
 
24
24
  Print the title of all albums
25
25
 
@@ -40,8 +40,8 @@ Get photos with specific tags
40
40
  photos = repo.get_photos_by_tags(['cat', 'dog'])
41
41
  # returns photos tagged with 'cat' AND 'dog'
42
42
 
43
- Repository Methods
44
- -------------------
43
+ Methods
44
+ -------
45
45
 
46
46
  ### Album(s)
47
47
 
@@ -97,4 +97,38 @@ Additional documentation can be found on the [rubydoc pages](http://rubydoc.info
97
97
  Feature Requests and Bugs
98
98
  -------------------------
99
99
 
100
- Please feel free to log any bugs or feature requests in the [Issues tab on Github](https://github.com/mkraft/PicasaWebAlbums/issues). Thank you.
100
+ Please feel free to log any bugs or feature requests in the [Issues tab on Github](https://github.com/mkraft/PicasaWebAlbums/issues).
101
+
102
+ Coming Down the Pike
103
+ --------------------
104
+
105
+ The goal is to completely mirror all of the Picasa Web Albums API features including
106
+
107
+ - Create, update, delete albums
108
+ - CUD photos
109
+ - CUD tags
110
+ - CRUD comments
111
+ - CRUD geolocation data
112
+
113
+ License
114
+ -------
115
+
116
+ Copyright (C) 2011 Martin Kraft
117
+
118
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
119
+ this software and associated documentation files (the "Software"), to deal in
120
+ the Software without restriction, including without limitation the rights to
121
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
122
+ of the Software, and to permit persons to whom the Software is furnished to do
123
+ so, subject to the following conditions:
124
+
125
+ The above copyright notice and this permission notice shall be included in all
126
+ copies or substantial portions of the Software.
127
+
128
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
129
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
130
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
131
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
133
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
134
+ SOFTWARE.
@@ -1,3 +1,3 @@
1
1
  module PicasaWebAlbums
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
@@ -5,13 +5,7 @@ module PhotosRepository
5
5
  xml = get_xml("http://picasaweb.google.com/data/feed/base/user/#{@email}/albumid/#{id}")
6
6
  photos = []
7
7
  xml.root.elements.each("//entry") do |entry|
8
- photo = PicasaWebAlbums::Photo.new
9
- photo.id = get_photo_id_from_photo_id_url(entry.elements["id"].text)
10
- photo.url = entry.elements["media:group/media:content"].attributes["url"]
11
- photo.width = entry.elements["media:group/media:content"].attributes["width"].to_i
12
- photo.height = entry.elements["media:group/media:content"].attributes["height"].to_i
13
- photo.caption = entry.elements["media:group/media:description"].text
14
- photo.file_name = entry.elements["media:group/media:title"].text
8
+ photo = get_photo_from_xml_element(entry)
15
9
  photos << photo
16
10
  end
17
11
  return photos
@@ -33,13 +27,7 @@ module PhotosRepository
33
27
  xml = get_xml(url)
34
28
  photos = []
35
29
  xml.root.elements.each("//entry") do |entry|
36
- photo = PicasaWebAlbums::Photo.new
37
- photo.id = entry.elements["gphoto:id"].text
38
- photo.url = entry.elements["media:group/media:content"].attributes["url"]
39
- photo.width = entry.elements["media:group/media:content"].attributes["width"].to_i
40
- photo.height = entry.elements["media:group/media:content"].attributes["height"].to_i
41
- photo.caption = entry.elements["media:group/media:description"].text
42
- photo.file_name = entry.elements["media:group/media:title"].text
30
+ photo = get_photo_from_xml_element(entry)
43
31
  photos << photo
44
32
  end
45
33
  return photos
@@ -47,6 +35,21 @@ module PhotosRepository
47
35
 
48
36
  private
49
37
 
38
+ def get_photo_from_xml_element(entry)
39
+ photo = PicasaWebAlbums::Photo.new
40
+ if (entry.elements["gphoto:id"] != nil && entry.elements["gphoto:id"].text != "")
41
+ photo.id = entry.elements["gphoto:id"].text
42
+ else
43
+ photo.id = get_photo_id_from_photo_id_url(entry.elements["id"].text)
44
+ end
45
+ photo.url = entry.elements["media:group/media:content"].attributes["url"]
46
+ photo.width = entry.elements["media:group/media:content"].attributes["width"].to_i
47
+ photo.height = entry.elements["media:group/media:content"].attributes["height"].to_i
48
+ photo.caption = entry.elements["media:group/media:description"].text
49
+ photo.file_name = entry.elements["media:group/media:title"].text
50
+ return photo
51
+ end
52
+
50
53
  def get_tags_string(tags)
51
54
  tags_string = ""
52
55
  tags.each do |tag|
data/test/test_albums.rb CHANGED
@@ -1,41 +1,32 @@
1
1
  require 'test/unit'
2
- require 'shoulda'
3
2
  require_relative '../lib/picasawebalbums'
4
3
 
5
4
  module PicasaWebAlbums
6
5
  class TestAlbums < Test::Unit::TestCase
7
6
 
8
- context "get all albums" do
9
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
10
- should "return albums" do
11
- albums = repo.get_all_albums
12
- assert_equal 4, albums.count
13
- end
7
+ def setup
8
+ @repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
14
9
  end
15
10
 
16
- context "get album by id" do
17
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
18
- should "return an album" do
19
- album = repo.get_album_by_id("5461230096110151249")
20
- assert_equal "Banner Images", album.title
21
- end
11
+ def test_get_all_albums
12
+ albums = @repo.get_all_albums
13
+ assert_equal 4, albums.count
22
14
  end
23
-
24
- context "get album by title" do
25
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
26
- should "return an album" do
27
- album = repo.get_album_by_title("Bio Profile Pics")
28
- assert_equal "5455332611886090353", album.id
29
- end
15
+
16
+ def test_get_album_by_id
17
+ album = @repo.get_album_by_id("5461230096110151249")
18
+ assert_equal "Banner Images", album.title
30
19
  end
31
-
32
- context "get album by slug" do
33
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
34
- should "return an album" do
35
- album = repo.get_album_by_slug("960x350")
36
- assert_equal "5577380987485671713", album.id
37
- end
20
+
21
+ def test_get_album_by_title
22
+ album = @repo.get_album_by_title("Bio Profile Pics")
23
+ assert_equal "5455332611886090353", album.id
38
24
  end
39
25
 
26
+ def test_get_album_by_slug
27
+ album = @repo.get_album_by_slug("960x350")
28
+ assert_equal "5577380987485671713", album.id
29
+ end
30
+
40
31
  end
41
32
  end
data/test/test_photos.rb CHANGED
@@ -1,26 +1,28 @@
1
1
  require 'test/unit'
2
- require 'shoulda'
3
2
  require_relative '../lib/picasawebalbums'
4
3
 
5
4
  module PicasaWebAlbums
6
5
  class TestPhotos < Test::Unit::TestCase
7
6
 
8
- context "get photos from album" do
9
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
10
- should "return at least 1 photo" do
11
- album = repo.get_album_by_id(5461230096110151249)
12
- photos = repo.get_photos_by_album_id(album.id)
13
- assert_equal true, photos.count > 0
14
- end
7
+ def setup
8
+ @repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
15
9
  end
16
10
 
17
- context "get photo by album and id" do
18
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
19
- should "return 1 photo" do
20
- album = repo.get_album_by_slug("960x350")
21
- photo = repo.get_photo_by_album_id_and_photo_id(album.id, "5577383323184640194")
22
- assert_equal "Lake Joe Home.", photo.caption
23
- end
11
+ def test_get_photos_from_album
12
+ album = @repo.get_album_by_id(5461230096110151249)
13
+ photos = @repo.get_photos_by_album_id(album.id)
14
+ assert_equal true, photos.count > 0
15
+ end
16
+
17
+ def test_get_photo_by_album_and_id
18
+ album = @repo.get_album_by_slug("960x350")
19
+ photo = @repo.get_photo_by_album_id_and_photo_id(album.id, "5577383323184640194")
20
+ assert_equal "Lake Joe Home.", photo.caption
21
+ end
22
+
23
+ def test_get_photos_by_tags
24
+ photos = @repo.get_photos_by_tags(['penny'])
25
+ assert photos.count > 0
24
26
  end
25
27
 
26
28
  end
data/test/test_tags.rb CHANGED
@@ -5,36 +5,23 @@ require_relative '../lib/picasawebalbums'
5
5
  module PicasaWebAlbums
6
6
  class TestTags < Test::Unit::TestCase
7
7
 
8
- context "get all tags" do
9
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
10
- should "return at least 1 tag" do
11
- tags = repo.get_all_tags
12
- assert tags.count > 0
13
- end
8
+ def setup
9
+ @repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
14
10
  end
15
-
16
- context "get tags by album id" do
17
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
18
- should "return at least 1 tag" do
19
- tags = repo.get_tags_by_album_id("5461230096110151249")
20
- assert tags.count > 0
21
- end
11
+
12
+ def test_get_all_tags
13
+ tags = @repo.get_all_tags
14
+ assert tags.count > 0
22
15
  end
23
16
 
24
- context "get tags by album id and photo id" do
25
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
26
- should "return at least 1 tag" do
27
- tags = repo.get_tags_by_album_id_and_photo_id("5461230096110151249", "5577383323184640194")
28
- assert tags.count > 0
29
- end
17
+ def test_get_tags_by_album_id
18
+ tags = @repo.get_tags_by_album_id("5461230096110151249")
19
+ assert tags.count > 0
30
20
  end
31
-
32
- context "get photos by tags" do
33
- should "return at least 1 photo" do
34
- repo = PicasaWebAlbums.get_repository('apitest33@gmail.com', 'ruhak23A')
35
- photos = repo.get_photos_by_tags(['penny'])
36
- assert photos.count > 0
37
- end
21
+
22
+ def test_get_tags_by_album_id_and_photo_id
23
+ tags = @repo.get_tags_by_album_id_and_photo_id("5461230096110151249", "5577383323184640194")
24
+ assert tags.count > 0
38
25
  end
39
26
 
40
27
  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.1.2
4
+ version: 1.1.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-18 00:00:00.000000000 Z
12
+ date: 2011-12-22 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:
@@ -21,6 +21,7 @@ files:
21
21
  - .gitignore
22
22
  - Gemfile
23
23
  - PicasaWebAlbums.gemspec
24
+ - README.md
24
25
  - Rakefile
25
26
  - lib/PicasaWebAlbums.rb
26
27
  - lib/PicasaWebAlbums/version.rb
@@ -31,12 +32,12 @@ files:
31
32
  - lib/repositories/photos_repository.rb
32
33
  - lib/repositories/repository.rb
33
34
  - lib/repositories/tags_repository.rb
34
- - readme.md
35
35
  - test/test_albums.rb
36
36
  - test/test_photos.rb
37
37
  - test/test_tags.rb
38
38
  homepage: https://github.com/mkraft/PicasaWebAlbums
39
- licenses: []
39
+ licenses:
40
+ - MIT
40
41
  post_install_message:
41
42
  rdoc_options: []
42
43
  require_paths: