picasa 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -23,7 +23,9 @@ In RAILS_ROOT/config/environment.rb
23
23
 
24
24
  or you can set google user in initializer like this:
25
25
 
26
- Picasa::WebAlbums.google_user = "google_username"
26
+ Picasa.config do |c|
27
+ c.google_user = 'google.user'
28
+ end
27
29
 
28
30
  and use it:
29
31
 
data/Rakefile CHANGED
@@ -13,6 +13,8 @@ begin
13
13
  gem.homepage = "http://github.com/morgoth/picasa"
14
14
  gem.authors = ["Wojciech Wnętrzak"]
15
15
  gem.add_dependency('xml-simple')
16
+ gem.add_development_dependency('shoulda')
17
+ gem.add_development_dependency('fakeweb')
16
18
 
17
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
20
  end
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 8
4
+ :patch: 9
5
5
  :build:
data/lib/picasa.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'net/http'
2
- require "xmlsimple"
2
+ require 'xmlsimple'
3
3
  require 'picasa/web_albums'
4
+ require 'picasa/config'
4
5
 
5
6
  module Picasa
6
7
  def self.albums(options = {})
@@ -0,0 +1,15 @@
1
+ require 'singleton'
2
+
3
+ module Picasa
4
+ class Config
5
+ include Singleton
6
+ attr_accessor :google_user
7
+ end
8
+
9
+ def self.config
10
+ if block_given?
11
+ yield Config.instance
12
+ end
13
+ Config.instance
14
+ end
15
+ end
@@ -1,19 +1,13 @@
1
1
  module Picasa
2
2
  class WebAlbums
3
- attr_reader :google_user
4
-
5
- def self.google_user=(user)
6
- @@google_user = user
7
- end
8
-
9
3
  def initialize(user)
10
- @google_user = user || @@google_user
11
- raise ArgumentError.new("You must specify google_user") unless @google_user
4
+ Picasa.config.google_user ||= user
5
+ raise ArgumentError.new("You must specify google_user") unless Picasa.config.google_user
12
6
  end
13
7
 
14
8
  def albums
15
- data = connect("/data/feed/api/user/#{google_user}")
16
- xml=XmlSimple.xml_in(data)
9
+ data = connect("/data/feed/api/user/#{Picasa.config.google_user}")
10
+ xml = XmlSimple.xml_in(data)
17
11
  albums = []
18
12
  xml['entry'].each do |album|
19
13
  attributes = {}
@@ -28,7 +22,7 @@ module Picasa
28
22
  end
29
23
 
30
24
  def photos(album_id)
31
- data = connect("/data/feed/api/user/#{google_user}/albumid/#{album_id}")
25
+ data = connect("/data/feed/api/user/#{Picasa.config.google_user}/albumid/#{album_id}")
32
26
  xml = XmlSimple.xml_in(data)
33
27
  photos = []
34
28
  xml['entry'].each do |photo|
data/picasa.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{picasa}
8
- s.version = "0.1.8"
8
+ s.version = "0.1.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wojciech Wnętrzak"]
12
- s.date = %q{2009-12-10}
12
+ s.date = %q{2010-01-27}
13
13
  s.description = %q{Simple Google Picasa managment}
14
14
  s.email = %q{w.wnetrzak@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION.yml",
26
26
  "lib/picasa.rb",
27
+ "lib/picasa/config.rb",
27
28
  "lib/picasa/web_albums.rb",
28
29
  "picasa.gemspec",
29
30
  "test/fixtures/albums",
@@ -47,11 +48,17 @@ Gem::Specification.new do |s|
47
48
 
48
49
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
49
50
  s.add_runtime_dependency(%q<xml-simple>, [">= 0"])
51
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
52
+ s.add_development_dependency(%q<fakeweb>, [">= 0"])
50
53
  else
51
54
  s.add_dependency(%q<xml-simple>, [">= 0"])
55
+ s.add_dependency(%q<shoulda>, [">= 0"])
56
+ s.add_dependency(%q<fakeweb>, [">= 0"])
52
57
  end
53
58
  else
54
59
  s.add_dependency(%q<xml-simple>, [">= 0"])
60
+ s.add_dependency(%q<shoulda>, [">= 0"])
61
+ s.add_dependency(%q<fakeweb>, [">= 0"])
55
62
  end
56
63
  end
57
64
 
data/test/picasa_test.rb CHANGED
@@ -49,8 +49,10 @@ class PicasaTest < Test::Unit::TestCase
49
49
  end
50
50
  end
51
51
 
52
- should "Not raise argument error if google user is set by class variable" do
53
- Picasa::WebAlbums.google_user = "some.user"
52
+ should "Not raise argument error if google user is set by configuration block" do
53
+ Picasa.config do |c|
54
+ c.google_user = 'some.user'
55
+ end
54
56
  assert_nothing_raised do
55
57
  Picasa::WebAlbums.new(nil)
56
58
  end
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.1.8
4
+ version: 0.1.9
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-12-10 00:00:00 +01:00
12
+ date: 2010-01-27 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,26 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: shoulda
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: fakeweb
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
25
45
  description: Simple Google Picasa managment
26
46
  email: w.wnetrzak@gmail.com
27
47
  executables: []
@@ -39,6 +59,7 @@ files:
39
59
  - Rakefile
40
60
  - VERSION.yml
41
61
  - lib/picasa.rb
62
+ - lib/picasa/config.rb
42
63
  - lib/picasa/web_albums.rb
43
64
  - picasa.gemspec
44
65
  - test/fixtures/albums