umanni-picasa 0.0.0.4 → 0.0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,9 +4,21 @@ module Picasa
4
4
  class Client
5
5
  module Media
6
6
  include Base
7
+
8
+ def get_photos gallery_id
9
+ response = get("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{gallery_id}?alt=json")
10
+ status, headers, body = response
11
+ case status
12
+ when 200
13
+ galleries = MultiJson.decode(body.first)
14
+ return galleries["feed"]["entry"]
15
+ else
16
+ raise(StandardError, "#{status.to_s} - #{body.to_s}")
17
+ end
18
+ end
7
19
 
8
- def list_photo_tags album_id, photo_id
9
- response = get("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{album_id}/photoid/#{photo_id}?kind=tag")
20
+ def list_photo_tags gallery_id, photo_id
21
+ response = get("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{gallery_id}/photoid/#{photo_id}?kind=tag")
10
22
  status, headers, body = response
11
23
  case status
12
24
  when 200
@@ -16,14 +28,14 @@ module Picasa
16
28
  end
17
29
  end
18
30
 
19
- def add_photo_tag album_id, photo_id, tag
31
+ def add_photo_tag gallery_id, photo_id, tag
20
32
  body = "\r\n"
21
33
  body += "<entry xmlns='http://www.w3.org/2005/Atom'>"
22
34
  body += "<title>#{tag}</title>"
23
35
  body += "<category scheme=\"http://schemas.google.com/g/2005#kind\" term=\"http://schemas.google.com/photos/2007#tag\"/>"
24
36
  body += "</entry>\r\n"
25
37
 
26
- response = post("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{album_id}/photoid/#{photo_id}", body)
38
+ response = post("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{gallery_id}/photoid/#{photo_id}", body)
27
39
  status, headers, body = response
28
40
  case status
29
41
  when 200
@@ -34,8 +46,8 @@ module Picasa
34
46
  end
35
47
  end
36
48
 
37
- def delete_photo album_id, photo_id
38
- response = delete("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{album_id}/photoid/#{photo_id}")
49
+ def delete_photo gallery_id, photo_id
50
+ response = delete("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{gallery_id}/photoid/#{photo_id}")
39
51
  status, headers, body = response
40
52
  case status
41
53
  when 200
@@ -45,8 +57,8 @@ module Picasa
45
57
  end
46
58
  end
47
59
 
48
- def delete_photo_comment album_id, photo_id, comment_id
49
- response = delete("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{album_id}/photoid/#{photo_id}/commentid/#{comment_id}")
60
+ def delete_photo_comment gallery_id, photo_id, comment_id
61
+ response = delete("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{gallery_id}/photoid/#{photo_id}/commentid/#{comment_id}")
50
62
  status, headers, body = response
51
63
  case status
52
64
  when 200
@@ -57,8 +69,8 @@ module Picasa
57
69
  end
58
70
  end
59
71
 
60
- def delete_photo_tag album_id, photo_id, tag_id
61
- response = delete("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{album_id}/photoid/#{photo_id}/tag/#{tag_id}")
72
+ def delete_photo_tag gallery_id, photo_id, tag_id
73
+ response = delete("https://picasaweb.google.com/data/feed/api/user/default/albumid/#{gallery_id}/photoid/#{photo_id}/tag/#{tag_id}")
62
74
  status, headers, body = response
63
75
  case status
64
76
  when 200
@@ -74,7 +86,7 @@ module Picasa
74
86
  # image/gif
75
87
  # image/jpeg
76
88
  # image/png
77
- def create_photo album_id, options = {}
89
+ def create_photo gallery_id, options = {}
78
90
  title = options[:title].nil? ? "" : options[:title]
79
91
  summary = options[:summary].nil? ? "" : options[:summary]
80
92
 
@@ -85,7 +97,7 @@ module Picasa
85
97
  term=\"http://schemas.google.com/photos/2007#photo\"/>
86
98
  </entry>
87
99
  "
88
- uri = "https://picasaweb.google.com/data/feed/api/user/default/albumid/#{album_id}"
100
+ uri = "https://picasaweb.google.com/data/feed/api/user/default/albumid/#{gallery_id}"
89
101
 
90
102
  #@xml_io = FileUploadIO.new('/tmp/atom_body_0.atom', "application/atom+xml")
91
103
  @xml_io = FileUploadIO.new('/tmp/atom_body.atom', "application/atom+xml", string_body)
@@ -14,7 +14,7 @@ module Picasa
14
14
  end
15
15
 
16
16
  def self.pre
17
- 4 #nil
17
+ 5 #nil
18
18
  end
19
19
 
20
20
  def self.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umanni-picasa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.4
4
+ version: 0.0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-15 00:00:00.000000000Z
12
+ date: 2011-12-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: signet
16
- requirement: &17589460 !ruby/object:Gem::Requirement
16
+ requirement: &8306060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.2.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *17589460
24
+ version_requirements: *8306060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: umanni-multipart-post
27
- requirement: &17567700 !ruby/object:Gem::Requirement
27
+ requirement: &8305640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *17567700
35
+ version_requirements: *8305640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multi_json
38
- requirement: &17565820 !ruby/object:Gem::Requirement
38
+ requirement: &8305160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *17565820
46
+ version_requirements: *8305160
47
47
  description: A Ruby wrapper for the Picasa Web API.
48
48
  email:
49
49
  - contato@umanni.com