picasa 0.6.7 → 0.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02b104660dfe262b0e881eda1ddd24351c7abf78
4
- data.tar.gz: 7edd6629a0c462b5271666b9eead8c829f679044
3
+ metadata.gz: 13c65c05a5b00067765a40f4339e4e11f04680f1
4
+ data.tar.gz: 66624e0d8ce131805533eae31ff58803a66f13af
5
5
  SHA512:
6
- metadata.gz: e8c5e5fbb39e29d42848233f44458deb51f609580823cf6881a7726cfeeedbe6db9458bf3d6fb245372e13a6d122d9da769e4f29ecca30f0e4f5cef7f871c902
7
- data.tar.gz: 50f2d1c52c8b14a8babd8e294f4c5ff48ba11ae60ebdd5b501d8b3fec551d06e5726e37aec8c589befed0b6cd5efaaf7b9f85387c7351380cb3b2af58f4552f3
6
+ metadata.gz: d233fded3ee7fd4348ba64f3b1849579050467eb64690442ea1367e088b7fbaedd42490a63219b5bd9d8324d58c45c8d15c263d3436b2938e690c8a3ed27b0e9
7
+ data.tar.gz: 7b4311985a57ebec4c687061f98bf8085c8440f7ee7807c8497cd7efb5b9ea434c77a1972a2c38fcda1e69d3286fe7faa470269c58568a8f5952a3b29a1b69da
data/Gemfile CHANGED
@@ -3,11 +3,10 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  gem "multi_json"
6
- gem "rake"
7
6
 
8
7
  group :extra do
9
8
  gem "thor"
10
- gem "debugger", :platform => [:ruby_19, :ruby_20]
9
+ gem "debugger"
11
10
  end
12
11
 
13
12
  # JSON parsers
data/Rakefile CHANGED
@@ -8,4 +8,4 @@ Rake::TestTask.new(:test) do |test|
8
8
  test.verbose = true
9
9
  end
10
10
 
11
- task :default => :test
11
+ task default: :test
@@ -14,7 +14,7 @@ module Picasa
14
14
  # @return [Presenter::AlbumList]
15
15
  def list(options = {})
16
16
  path = "/data/feed/api/user/#{user_id}"
17
- response = Connection.new.get(:path => path, :query => options, :headers => auth_header)
17
+ response = Connection.new.get(path: path, query: options, headers: auth_header)
18
18
 
19
19
  Presenter::AlbumList.new(response.parsed_response["feed"])
20
20
  end
@@ -31,7 +31,7 @@ module Picasa
31
31
  # @raise [NotFoundError] raised when album cannot be found
32
32
  def show(album_id, options = {})
33
33
  path = "/data/feed/api/user/#{user_id}/albumid/#{album_id}"
34
- response = Connection.new.get(:path => path, :query => options, :headers => auth_header)
34
+ response = Connection.new.get(path: path, query: options, headers: auth_header)
35
35
 
36
36
  Presenter::Album.new(response.parsed_response["feed"])
37
37
  end
@@ -54,7 +54,7 @@ module Picasa
54
54
 
55
55
  template = Template.new(:new_album, params)
56
56
  path = "/data/feed/api/user/#{user_id}"
57
- response = Connection.new.post(:path => path, :body => template.render, :headers => auth_header)
57
+ response = Connection.new.post(path: path, body: template.render, headers: auth_header)
58
58
 
59
59
  Presenter::Album.new(response.parsed_response["entry"])
60
60
  end
@@ -71,7 +71,7 @@ module Picasa
71
71
  def destroy(album_id, options = {})
72
72
  headers = auth_header.merge({"If-Match" => options.fetch(:etag, "*")})
73
73
  path = "/data/entry/api/user/#{user_id}/albumid/#{album_id}"
74
- Connection.new.delete(:path => path, :headers => headers)
74
+ Connection.new.delete(path: path, headers: headers)
75
75
  true
76
76
  end
77
77
  alias :delete :destroy
@@ -19,7 +19,7 @@ module Picasa
19
19
  path << "/albumid/#{album_id}" if album_id
20
20
  path << "/photoid/#{photo_id}" if photo_id
21
21
 
22
- response = Connection.new.get(:path => path, :query => options.merge(:kind => "comment"), :headers => auth_header)
22
+ response = Connection.new.get(path: path, query: options.merge(kind: "comment"), headers: auth_header)
23
23
 
24
24
  Presenter::CommentList.new(response.parsed_response["feed"])
25
25
  end
@@ -41,7 +41,7 @@ module Picasa
41
41
 
42
42
  template = Template.new("new_comment", params)
43
43
 
44
- response = Connection.new.post(:path => path, :body => template.render, :headers => auth_header)
44
+ response = Connection.new.post(path: path, body: template.render, headers: auth_header)
45
45
 
46
46
  Presenter::Comment.new(response.parsed_response["entry"])
47
47
  end
@@ -59,7 +59,7 @@ module Picasa
59
59
  photo_id = params.delete(:photo_id) || raise(ArgumentError, "You must specify photo_id")
60
60
 
61
61
  path = "/data/entry/api/user/#{user_id}/albumid/#{album_id}/photoid/#{photo_id}/commentid/#{comment_id}"
62
- Connection.new.delete(:path => path, :headers => auth_header)
62
+ Connection.new.delete(path: path, headers: auth_header)
63
63
  true
64
64
  end
65
65
  alias :delete :destroy
@@ -23,7 +23,7 @@ module Picasa
23
23
  headers = auth_header.merge({"Content-Type" => "multipart/related; boundary=\"#{params[:boundary]}\""})
24
24
 
25
25
  path = "/data/feed/api/user/#{user_id}/albumid/#{album_id}"
26
- response = Connection.new.post(:path => path, :body => template.render, :headers => headers)
26
+ response = Connection.new.post(path: path, body: template.render, headers: headers)
27
27
 
28
28
  Presenter::Photo.new(response.parsed_response["entry"])
29
29
  end
@@ -41,7 +41,7 @@ module Picasa
41
41
  def destroy(album_id, photo_id, options = {})
42
42
  headers = auth_header.merge({"If-Match" => options.fetch(:etag, "*")})
43
43
  path = "/data/entry/api/user/#{user_id}/albumid/#{album_id}/photoid/#{photo_id}"
44
- Connection.new.delete(:path => path, :headers => headers)
44
+ Connection.new.delete(path: path, headers: headers)
45
45
  true
46
46
  end
47
47
  alias :delete :destroy
@@ -19,7 +19,7 @@ module Picasa
19
19
  path << "/albumid/#{album_id}" if album_id
20
20
  path << "/photoid/#{photo_id}" if photo_id
21
21
 
22
- response = Connection.new.get(:path => path, :query => options.merge(:kind => "tag"), :headers => auth_header)
22
+ response = Connection.new.get(path: path, query: options.merge(kind: "tag"), headers: auth_header)
23
23
 
24
24
  Presenter::TagList.new(response.parsed_response["feed"])
25
25
  end
@@ -41,7 +41,7 @@ module Picasa
41
41
 
42
42
  template = Template.new("new_tag", params)
43
43
 
44
- response = Connection.new.post(:path => path, :body => template.render, :headers => auth_header)
44
+ response = Connection.new.post(path: path, body: template.render, headers: auth_header)
45
45
 
46
46
  Presenter::Tag.new(response.parsed_response["entry"])
47
47
  end
@@ -59,7 +59,7 @@ module Picasa
59
59
  photo_id = params.delete(:photo_id) || raise(ArgumentError, "You must specify photo_id")
60
60
 
61
61
  path = "/data/entry/api/user/#{user_id}/albumid/#{album_id}/photoid/#{photo_id}/tag/#{tag_id}"
62
- Connection.new.delete(:path => path, :headers => auth_header)
62
+ Connection.new.delete(path: path, headers: auth_header)
63
63
  true
64
64
  end
65
65
  alias :delete :destroy
@@ -64,10 +64,10 @@ module Picasa
64
64
  # @return [String]
65
65
  def authenticate
66
66
  response = Connection.new.post(
67
- :host => HTTP::API_AUTH_URL,
68
- :headers => {"Content-Type" => "application/x-www-form-urlencoded"},
69
- :path => "/accounts/ClientLogin",
70
- :body => Utils.inline_query(
67
+ host: HTTP::API_AUTH_URL,
68
+ headers: {"Content-Type" => "application/x-www-form-urlencoded"},
69
+ path: "/accounts/ClientLogin",
70
+ body: Utils.inline_query(
71
71
  "accountType" => "HOSTED_OR_GOOGLE",
72
72
  "Email" => user_id,
73
73
  "Passwd" => password,
@@ -87,7 +87,7 @@ module Picasa
87
87
  end
88
88
 
89
89
  def credentials
90
- {:user_id => user_id}.tap do |credentials|
90
+ {user_id: user_id}.tap do |credentials|
91
91
  credentials[:authorization_header] = authorization_header if authorization_header
92
92
  end
93
93
  end
@@ -6,8 +6,6 @@ module Picasa
6
6
  # @option params [String] :query request url query
7
7
  # @option params [String] :headers request headers
8
8
  def get(params = {})
9
- # FIXME: how to add headers to default ones instead of replacing?
10
- params[:headers] = Picasa::HTTP.headers.merge(params[:headers]) if params.has_key?(:headers)
11
9
  exec_request(params) { |uri, options| HTTP.get(uri, options) }
12
10
  end
13
11
 
@@ -20,7 +18,6 @@ module Picasa
20
18
  def post(params = {})
21
19
  params[:headers] ||= {}
22
20
  params[:headers]["Content-Type"] ||= "application/atom+xml"
23
- params[:headers] = Picasa::HTTP.headers.merge(params[:headers])
24
21
  exec_request(params) { |uri, options| HTTP.post(uri, options) }
25
22
  end
26
23
 
@@ -30,15 +27,26 @@ module Picasa
30
27
  # @option params [String] :query request url query
31
28
  # @option params [String] :headers request headers
32
29
  def delete(params = {})
33
- params[:headers] = Picasa::HTTP.headers.merge(params[:headers]) if params.has_key?(:headers)
34
30
  exec_request(params) { |uri, options| HTTP.delete(uri, options) }
35
31
  end
36
32
 
37
33
  private
38
34
 
35
+ # Additional params for HTTParty gem can be passed
36
+ # https://github.com/jnunemaker/httparty/blob/v0.12.0/lib/httparty.rb#L43
39
37
  def exec_request(params, &block)
40
38
  uri = "#{params.delete(:host)}#{params.delete(:path)}"
41
- params.delete_if { |key, value| value.nil? || value.empty? }
39
+
40
+ params.tap do |p|
41
+ p[:headers] = HTTP.headers.merge(p.fetch(:headers, {}))
42
+ if p.keys.none? { |name| [:http_proxyaddr, :http_proxyport, :http_proxyuser, :http_proxypass].include?(name) }
43
+ p[:http_proxyaddr] = proxy_uri.host
44
+ p[:http_proxyport] = proxy_uri.port
45
+ p[:http_proxyuser] = proxy_uri.user
46
+ p[:http_proxypass] = proxy_uri.password
47
+ end
48
+ end
49
+
42
50
  handle_response(yield(uri, params))
43
51
  end
44
52
 
@@ -58,5 +66,9 @@ module Picasa
58
66
  raise ResponseError.new(response.body, response)
59
67
  end
60
68
  end
69
+
70
+ def proxy_uri
71
+ @proxy_uri ||= URI.parse(ENV["https_proxy"] || ENV["HTTPS_PROXY"] || "")
72
+ end
61
73
  end
62
74
  end
@@ -9,20 +9,13 @@ module Picasa
9
9
  API_AUTH_URL = "https://www.google.com"
10
10
  API_VERSION = "2"
11
11
 
12
- def self.proxy
13
- proxy_uri = URI.parse(ENV["https_proxy"] || ENV["HTTPS_PROXY"] || "")
14
- [proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password]
15
- end
16
-
17
12
  format :json
18
- default_params :alt => :json
13
+ default_params alt: :json
19
14
 
20
15
  headers "User-Agent" => "ruby-gem-picasa-v#{VERSION} (gzip)",
21
16
  "GData-Version" => API_VERSION,
22
17
  "Accept-Encoding" => "gzip, deflate"
23
18
 
24
19
  base_uri API_URL
25
-
26
- http_proxy *proxy
27
20
  end
28
21
  end
@@ -21,8 +21,7 @@ module Picasa
21
21
  private
22
22
 
23
23
  def methods_to_inspect
24
- # Ruby 1.8.7 workaround
25
- (public_methods - Object.methods).map { |m| m.to_sym } - [:parsed_body, :entries]
24
+ public_methods - Object.methods - [:parsed_body, :entries]
26
25
  end
27
26
  end
28
27
  end
@@ -12,7 +12,6 @@ module Picasa
12
12
  end
13
13
  end
14
14
 
15
-
16
15
  def retrieve(hash, keys)
17
16
  return if !hash.kind_of?(Hash) || !hash.has_key?(keys.first)
18
17
 
@@ -1,3 +1,3 @@
1
1
  module Picasa
2
- VERSION = "0.6.7"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -1,27 +1,31 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/picasa/version', __FILE__)
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "picasa/version"
3
5
 
4
- Gem::Specification.new do |gem|
5
- gem.author = "Wojciech Wnętrzak"
6
- gem.email = "w.wnetrzak@gmail.com"
7
- gem.description = %q{Ruby client for Google Picasa API}
8
- gem.summary = %q{Simple Google Picasa managment}
9
- gem.homepage = "https://github.com/morgoth/picasa"
10
- gem.license = "MIT"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "picasa"
8
+ spec.version = Picasa::VERSION
9
+ spec.authors = ["Wojciech Wnętrzak"]
10
+ spec.email = ["w.wnetrzak@gmail.com"]
11
+ spec.description = %q{Ruby client for Google Picasa API}
12
+ spec.summary = %q{Simple Google Picasa managment}
13
+ spec.homepage = "https://github.com/morgoth/picasa"
14
+ spec.license = "MIT"
11
15
 
12
- gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
13
- gem.files = `git ls-files`.split("\n")
14
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- gem.name = "picasa"
16
- gem.require_paths = ["lib"]
17
- gem.version = Picasa::VERSION
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
18
20
 
19
- gem.add_dependency "httparty"
21
+ spec.required_ruby_version = ">= 1.9.3"
20
22
 
21
- gem.add_development_dependency "minitest", ">= 5.0.0"
22
- gem.add_development_dependency "webmock"
23
- gem.add_development_dependency "mocha", ">= 0.13.0"
24
- gem.add_development_dependency "vcr", ">= 2.4.0"
23
+ spec.add_dependency "httparty"
25
24
 
26
- gem.post_install_message = "Version 0.7.0 of picasa gem will require Ruby 1.9.3 or greater. If you still need 1.8.7 freeze gem version to ~> 0.6.7"
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "minitest", ">= 5.0.0"
28
+ spec.add_development_dependency "webmock"
29
+ spec.add_development_dependency "mocha", ">= 0.13.0"
30
+ spec.add_development_dependency "vcr", ">= 2.4.0"
27
31
  end
Binary file
@@ -1,5 +1,6 @@
1
1
  require "yaml"
2
2
  require "zlib"
3
+ require "multi_json"
3
4
 
4
5
  require "minitest/autorun"
5
6
  require "webmock/minitest"
@@ -16,7 +17,7 @@ MultiJson.adapter = ENV["JSON_PARSER"] || "oj"
16
17
  VCR.configure do |c|
17
18
  c.cassette_library_dir = "test/cassettes"
18
19
  c.hook_into :webmock
19
- c.default_cassette_options = {:preserve_exact_body_bytes => true}
20
+ c.default_cassette_options = {preserve_exact_body_bytes: true}
20
21
  c.filter_sensitive_data("<FILTERED>") { AuthHeader }
21
22
  c.filter_sensitive_data("<FILTERED>") { Password }
22
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picasa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wojciech Wnętrzak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-26 00:00:00.000000000 Z
11
+ date: 2013-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: minitest
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +109,8 @@ dependencies:
81
109
  - !ruby/object:Gem::Version
82
110
  version: 2.4.0
83
111
  description: Ruby client for Google Picasa API
84
- email: w.wnetrzak@gmail.com
112
+ email:
113
+ - w.wnetrzak@gmail.com
85
114
  executables: []
86
115
  extensions: []
87
116
  extra_rdoc_files: []
@@ -168,8 +197,7 @@ homepage: https://github.com/morgoth/picasa
168
197
  licenses:
169
198
  - MIT
170
199
  metadata: {}
171
- post_install_message: Version 0.7.0 of picasa gem will require Ruby 1.9.3 or greater.
172
- If you still need 1.8.7 freeze gem version to ~> 0.6.7
200
+ post_install_message:
173
201
  rdoc_options: []
174
202
  require_paths:
175
203
  - lib
@@ -177,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
205
  requirements:
178
206
  - - '>='
179
207
  - !ruby/object:Gem::Version
180
- version: '0'
208
+ version: 1.9.3
181
209
  required_rubygems_version: !ruby/object:Gem::Requirement
182
210
  requirements:
183
211
  - - '>='
@@ -185,8 +213,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
213
  version: '0'
186
214
  requirements: []
187
215
  rubyforge_project:
188
- rubygems_version: 2.0.2
216
+ rubygems_version: 2.1.11
189
217
  signing_key:
190
218
  specification_version: 4
191
219
  summary: Simple Google Picasa managment
192
- test_files: []
220
+ test_files:
221
+ - test/api/album_test.rb
222
+ - test/api/comment_test.rb
223
+ - test/api/photo_test.rb
224
+ - test/api/tag_test.rb
225
+ - test/cassettes/album-404.yml
226
+ - test/cassettes/album-create.yml
227
+ - test/cassettes/album-destroy.yml
228
+ - test/cassettes/album-list.yml
229
+ - test/cassettes/album-show.yml
230
+ - test/cassettes/auth-failed.yml
231
+ - test/cassettes/auth-success.yml
232
+ - test/cassettes/comment-400.yml
233
+ - test/cassettes/comment-create.yml
234
+ - test/cassettes/comment-destroy.yml
235
+ - test/cassettes/comment-list.yml
236
+ - test/cassettes/photo-412.yml
237
+ - test/cassettes/photo-create.yml
238
+ - test/cassettes/photo-destroy.yml
239
+ - test/cassettes/tag-create.yml
240
+ - test/cassettes/tag-destroy.yml
241
+ - test/cassettes/tag-list.yml
242
+ - test/cassettes/video-create.yml
243
+ - test/client_test.rb
244
+ - test/connection_test.rb
245
+ - test/file_test.rb
246
+ - test/fixtures/lena.jpg
247
+ - test/fixtures/sample.3gp
248
+ - test/fixtures/sample.txt
249
+ - test/helper.rb
250
+ - test/template_test.rb
251
+ - test/utils_test.rb