morgoth-picasa 0.1.3 → 0.1.4
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/VERSION.yml +1 -1
- data/lib/picasa.rb +7 -9
- data/lib/{web_albums.rb → picasa/web_albums.rb} +12 -12
- data/picasa.gemspec +3 -3
- data/test/picasa_test.rb +15 -2
- metadata +3 -3
data/VERSION.yml
CHANGED
data/lib/picasa.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'web_albums.rb'
|
1
|
+
require 'net/http'
|
2
|
+
require "xmlsimple"
|
3
|
+
require 'picasa/web_albums'
|
6
4
|
|
5
|
+
module Picasa
|
7
6
|
def self.albums(options = {})
|
8
|
-
raise ArgumentError
|
7
|
+
raise ArgumentError.new("You must specify google_user") unless options[:google_user]
|
9
8
|
web_albums = Picasa::WebAlbums.new(options[:google_user])
|
10
9
|
web_albums.albums
|
11
10
|
end
|
12
11
|
|
13
12
|
def self.photos(options = {})
|
14
|
-
|
15
|
-
|
16
|
-
end
|
13
|
+
raise ArgumentError.new("You must specify google_user") unless options[:google_user]
|
14
|
+
raise ArgumentError.new("You must specify album_id") unless options[:album_id]
|
17
15
|
web_albums = Picasa::WebAlbums.new(options[:google_user])
|
18
16
|
web_albums.photos(options[:album_id])
|
19
17
|
end
|
@@ -11,11 +11,11 @@ module Picasa
|
|
11
11
|
xml=XmlSimple.xml_in(data)
|
12
12
|
albums = []
|
13
13
|
xml['entry'].each do |album|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
albums <<
|
14
|
+
attributes = {}
|
15
|
+
attributes[:id] = album['id'][1]
|
16
|
+
attributes[:title] = album['title'][0]['content']
|
17
|
+
attributes[:photos_count] = album['numphotos'][0].to_i
|
18
|
+
albums << attributes
|
19
19
|
end
|
20
20
|
albums
|
21
21
|
end
|
@@ -25,14 +25,14 @@ module Picasa
|
|
25
25
|
xml = XmlSimple.xml_in(data)
|
26
26
|
photos = []
|
27
27
|
xml['entry'].each do |photo|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
attributes = {}
|
29
|
+
attributes[:title] = photo['group'][0]['description'][0]['content'] #returns nil if empty
|
30
|
+
attributes[:thumbnail_1] = photo['group'][0]['thumbnail'][0]['url']
|
31
|
+
attributes[:thumbnail_2] = photo['group'][0]['thumbnail'][1]['url']
|
32
|
+
attributes[:thumbnail_3] = photo['group'][0]['thumbnail'][2]['url']
|
33
33
|
#attributes[:photo] << photo['group'][0]['content']['url']
|
34
|
-
|
35
|
-
photos <<
|
34
|
+
attributes[:photo] = photo['content']['src']
|
35
|
+
photos << attributes
|
36
36
|
end
|
37
37
|
{ :photos => photos, :slideshow => xml['link'][2]['href'] }
|
38
38
|
end
|
data/picasa.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{picasa}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Wojciech Wn\304\231trzak"]
|
9
|
-
s.date = %q{2009-07-
|
9
|
+
s.date = %q{2009-07-03}
|
10
10
|
s.email = %q{w.wnetrzak@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
"Rakefile",
|
21
21
|
"VERSION.yml",
|
22
22
|
"lib/picasa.rb",
|
23
|
-
"lib/web_albums.rb",
|
23
|
+
"lib/picasa/web_albums.rb",
|
24
24
|
"picasa.gemspec",
|
25
25
|
"test/fixtures/albums",
|
26
26
|
"test/fixtures/photos",
|
data/test/picasa_test.rb
CHANGED
@@ -24,13 +24,26 @@ class PicasaTest < Test::Unit::TestCase
|
|
24
24
|
|
25
25
|
should 'parse it' do
|
26
26
|
photos = Picasa.photos(:google_user => 'some.user', :album_id => '666')
|
27
|
-
assert_equal photos[:photos].count
|
27
|
+
assert_equal 10, photos[:photos].count
|
28
28
|
assert_not_nil photos[:slideshow]
|
29
29
|
assert_not_nil photos[:photos].first[:thumbnail_1]
|
30
30
|
assert_not_nil photos[:photos].first[:thumbnail_2]
|
31
31
|
assert_not_nil photos[:photos].first[:thumbnail_3]
|
32
32
|
assert_nil photos[:photos].first[:title]
|
33
|
-
assert_equal
|
33
|
+
assert_equal "http://lh5.ggpht.com/_Kp7xCOU0f_U/SQS8EFqEXjI/AAAAAAAAAFo/aUOA6byXAuE/Jurek.JPG",
|
34
|
+
photos[:photos].first[:photo]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
should "Raise argument error if google user is not present" do
|
39
|
+
assert_raise ArgumentError do
|
40
|
+
Picasa.albums
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
should "Raise argument error if album_id is not present" do
|
45
|
+
assert_raise ArgumentError do
|
46
|
+
Picasa.photos :google_user => 'some.user'
|
34
47
|
end
|
35
48
|
end
|
36
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morgoth-picasa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Wojciech Wn\xC4\x99trzak"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-03 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,7 +39,7 @@ files:
|
|
39
39
|
- Rakefile
|
40
40
|
- VERSION.yml
|
41
41
|
- lib/picasa.rb
|
42
|
-
- lib/web_albums.rb
|
42
|
+
- lib/picasa/web_albums.rb
|
43
43
|
- picasa.gemspec
|
44
44
|
- test/fixtures/albums
|
45
45
|
- test/fixtures/photos
|