picasa 0.7.2 → 0.7.3

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: 02d51d52ccbf5d0255b0327c42963269e4b7a5e8
4
- data.tar.gz: 073d56384b7055c8d9d5ab289f77ee1f1b146347
3
+ metadata.gz: ed0c5ff921d846bba81d3bc6bc90bf340f22e235
4
+ data.tar.gz: 814262697dbbbc9ddf9da9e2e6735bf93428f087
5
5
  SHA512:
6
- metadata.gz: 41529357a1fa264ef5fec9b8fb11f39cbe74f07f0fc3d6046d8dd4adc0a3db80727dcc30c14ae5de32ad7c20ca3b2a6022d5b197da604b3e30340bc058bcf292
7
- data.tar.gz: ed5469728b41ea29d2c1918787c1cc0d2a5773c69401bdc1abe492c3a360c2ee6205614377b98f86e3250865090fd3c94f36347bcbf1931294aa37f145c92b55
6
+ metadata.gz: 389af531ef0538a6a3c4eee3dc31a0f916f1be7f257e9bf8766e23b38e07694475ac8d97bb3f44eb262df69f7ee89a23bbd62c2849578454b5cadeaf42d4777a
7
+ data.tar.gz: 92316513cbdd65a16ef2f691550dae8f1c7ad267cefe20fb72170b89838639593ca294f8e75945942cb70b85788d172c0908518a7216243ddcaddff9487f8682
@@ -1,12 +1,13 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
2
4
  bundler_args: --without extra
3
5
  notifications:
4
6
  disabled: true
5
7
  rvm:
6
- - 1.9.3
7
- - 2.0.0
8
+ - 2.0
9
+ - 2.1
8
10
 
9
11
  env:
10
12
  - JSON_PARSER=oj
11
13
  - JSON_PARSER=yajl
12
- - JSON_PARSER=json_pure
data/Gemfile CHANGED
@@ -6,10 +6,9 @@ gem "multi_json"
6
6
 
7
7
  group :extra do
8
8
  gem "thor"
9
- gem "debugger"
9
+ gem "byebug"
10
10
  end
11
11
 
12
12
  # JSON parsers
13
13
  gem "oj"
14
14
  gem "yajl-ruby"
15
- gem "json_pure"
data/README.md CHANGED
@@ -97,6 +97,7 @@ Picasa uses gzipped requests to speedup fetching results. Benchmarks are availab
97
97
  * [Ionut-Cristian Florescu](https://github.com/icflorescu)
98
98
  * [Sébastien Grosjean](https://github.com/ZenCocoon)
99
99
  * [Grant Gardner](https://github.com/lwoggardner)
100
+ * [Anton Astashov](https://github.com/astashov)
100
101
 
101
102
  ## Copyright
102
103
 
@@ -0,0 +1,57 @@
1
+ require "picasa/presenter/base"
2
+
3
+ module Picasa
4
+ module Presenter
5
+ class Exif < Base
6
+
7
+ # @return [Float]
8
+ def fstop
9
+ @fstop ||= map_to_float(safe_retrieve(parsed_body, "exif$fstop"))
10
+ end
11
+
12
+ # @return [String]
13
+ def make
14
+ @make ||= safe_retrieve(parsed_body, "exif$make")
15
+ end
16
+
17
+ # @return [String]
18
+ def model
19
+ @model ||= safe_retrieve(parsed_body, "exif$model")
20
+ end
21
+
22
+ # @return [Float]
23
+ def exposure
24
+ @exposure ||= map_to_float(safe_retrieve(parsed_body, "exif$exposure"))
25
+ end
26
+
27
+ # @return [Boolean]
28
+ def flash
29
+ @flash ||= map_to_boolean(safe_retrieve(parsed_body, "exif$flash"))
30
+ end
31
+
32
+ # @return [Float]
33
+ def focal_length
34
+ @focal_length ||= map_to_float(safe_retrieve(parsed_body, "exif$focallength"))
35
+ end
36
+
37
+ # @return [Integer]
38
+ def iso
39
+ @iso ||= map_to_integer(safe_retrieve(parsed_body, "exif$iso"))
40
+ end
41
+
42
+ # @return [DateTime]
43
+ def time
44
+ @time ||= begin
45
+ if value = safe_retrieve(parsed_body, "exif$time")
46
+ DateTime.strptime((value.to_f / 1000).round.to_s, '%s')
47
+ end
48
+ end
49
+ end
50
+
51
+ # @return [String]
52
+ def image_unique_id
53
+ @image_unique_id ||= safe_retrieve(parsed_body, "exif$imageUniqueID")
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,4 +1,5 @@
1
1
  require "picasa/presenter/base"
2
+ require "picasa/presenter/exif"
2
3
 
3
4
  module Picasa
4
5
  module Presenter
@@ -28,6 +29,21 @@ module Picasa
28
29
  @etag ||= safe_retrieve(parsed_body, "gd$etag")
29
30
  end
30
31
 
32
+ # @return [Exif]
33
+ def exif
34
+ @exif ||= Exif.new(safe_retrieve(parsed_body, "exif$tags"))
35
+ end
36
+
37
+ # @return [Float]
38
+ def latitude
39
+ @latitude ||= map_to_float(location && location.split(" ")[0])
40
+ end
41
+
42
+ # @return [Float]
43
+ def longitude
44
+ @longitude ||= map_to_float(location && location.split(" ")[1])
45
+ end
46
+
31
47
  # @return [DateTime]
32
48
  def published
33
49
  @published ||= map_to_date(safe_retrieve(parsed_body, "published"))
@@ -107,6 +123,12 @@ module Picasa
107
123
  def video_status
108
124
  @video_status ||= safe_retrieve(parsed_body, "gphoto$videostatus")
109
125
  end
126
+
127
+ private
128
+
129
+ def location
130
+ @location ||= safe_retrieve(parsed_body, "georss$where", "gml$Point", "gml$pos")
131
+ end
110
132
  end
111
133
  end
112
134
  end
@@ -37,6 +37,10 @@ module Picasa
37
37
  value && value.to_i
38
38
  end
39
39
 
40
+ def map_to_float(value)
41
+ value && value.to_f
42
+ end
43
+
40
44
  def map_to_date(value)
41
45
  value && DateTime.parse(value)
42
46
  end
@@ -56,6 +60,6 @@ module Picasa
56
60
  end.join("&")
57
61
  end
58
62
 
59
- module_function :safe_retrieve, :retrieve, :array_wrap, :map_to_integer, :map_to_boolean, :map_to_date, :inline_query
63
+ module_function :safe_retrieve, :retrieve, :array_wrap, :map_to_integer, :map_to_boolean, :map_to_date, :inline_query, :map_to_float
60
64
  end
61
65
  end
@@ -1,3 +1,3 @@
1
1
  module Picasa
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -0,0 +1,20 @@
1
+ require "helper"
2
+
3
+ describe Picasa::Presenter::Photo do
4
+ def setup
5
+ # TODO: find a way to retrieve this from cassettes
6
+ @data = {"xmlns$exif"=>"http://schemas.google.com/photos/exif/2007", "xmlns$app"=>"http://www.w3.org/2007/app", "xmlns"=>"http://www.w3.org/2005/Atom", "xmlns$gphoto"=>"http://schemas.google.com/photos/2007", "xmlns$media"=>"http://search.yahoo.com/mrss/", "xmlns$gd"=>"http://schemas.google.com/g/2005", "gd$etag"=>"\"YD0qeyI.\"", "id"=>{"$t"=>"https://picasaweb.google.com/data/entry/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146"}, "published"=>{"$t"=>"2012-11-02T19:12:16.000Z"}, "updated"=>{"$t"=>"2012-11-02T19:12:16.566Z"}, "app$edited"=>{"$t"=>"2012-11-02T19:12:16.566Z"}, "category"=>[{"scheme"=>"http://schemas.google.com/g/2005#kind", "term"=>"http://schemas.google.com/photos/2007#photo"}], "title"=>{"$t"=>"Lena"}, "summary"=>{"$t"=>""}, "content"=>{"type"=>"image/jpeg", "src"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/Lena.jpg"}, "link"=>[{"rel"=>"http://schemas.google.com/g/2005#feed", "type"=>"application/atom+xml", "href"=>"https://picasaweb.google.com/data/feed/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146?alt=json&authkey=Gv1sRgCNmigd3KrbOHLA"}, {"rel"=>"alternate", "type"=>"text/html", "href"=>"https://picasaweb.google.com/106136347770555028022/ThorTesting02?authkey=Gv1sRgCNmigd3KrbOHLA#5806295577614146146"}, {"rel"=>"http://schemas.google.com/photos/2007#canonical", "type"=>"text/html", "href"=>"https://picasaweb.google.com/lh/photo/uzMvHBCIb3kHVheiGO2QCCUdvMQllM3aC4Soztgbiog"}, {"rel"=>"self", "type"=>"application/atom+xml", "href"=>"https://picasaweb.google.com/data/entry/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146?alt=json&authkey=Gv1sRgCNmigd3KrbOHLA"}, {"rel"=>"edit", "type"=>"application/atom+xml", "href"=>"https://picasaweb.google.com/data/entry/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146?authkey=Gv1sRgCNmigd3KrbOHLA"}, {"rel"=>"edit-media", "type"=>"image/jpeg", "href"=>"https://picasaweb.google.com/data/media/api/user/106136347770555028022/albumid/5793892606777564353/photoid/5806295577614146146?authkey=Gv1sRgCNmigd3KrbOHLA"}, {"rel"=>"http://schemas.google.com/photos/2007#report", "type"=>"text/html", "href"=>"https://picasaweb.google.com/lh/reportAbuse?uname=106136347770555028022&aid=5793892606777564353&iid=5806295577614146146"}], "gphoto$id"=>{"$t"=>"5806295577614146146"}, "gphoto$albumid"=>{"$t"=>"5793892606777564353"}, "gphoto$access"=>{"$t"=>"private"}, "gphoto$width"=>{"$t"=>"337"}, "gphoto$height"=>{"$t"=>"720"}, "gphoto$size"=>{"$t"=>"81352"}, "gphoto$checksum"=>{"$t"=>""}, "gphoto$timestamp"=>{"$t"=>"1351883536000"}, "gphoto$imageVersion"=>{"$t"=>"3824"}, "gphoto$commentingEnabled"=>{"$t"=>"true"}, "gphoto$commentCount"=>{"$t"=>0}, "gphoto$license"=>{"$t"=>"ALL_RIGHTS_RESERVED", "id"=>0, "name"=>"Wszelkie prawa zastrzeżone", "url"=>""}, "exif$tags"=>{"exif$imageUniqueID"=>{"$t"=>"8a69034d54f38875a7c44db612085818"}}, "media$group"=>{"media$content"=>[{"url"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/Lena.jpg", "height"=>512, "width"=>240, "type"=>"image/jpeg", "medium"=>"image"}], "media$credit"=>[{"$t"=>"Wojciech Wnętrzak"}], "media$description"=>{"$t"=>"", "type"=>"plain"}, "media$keywords"=>{}, "media$thumbnail"=>[{"url"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/s72/Lena.jpg", "height"=>72, "width"=>34}, {"url"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/s144/Lena.jpg", "height"=>144, "width"=>68}, {"url"=>"https://lh5.googleusercontent.com/-k4MaJY-F7Ao/UJQbEJSc2mI/AAAAAAAADvA/oDLr5F6-xho/s288/Lena.jpg", "height"=>288, "width"=>135}], "media$title"=>{"$t"=>"Lena", "type"=>"plain"}}}
7
+ end
8
+
9
+ it "returns nil when no latitude" do
10
+ photo = Picasa::Presenter::Photo.new(@data)
11
+
12
+ assert_nil photo.latitude
13
+ end
14
+
15
+ it "returns nil when no longitude" do
16
+ photo = Picasa::Presenter::Photo.new(@data)
17
+
18
+ assert_nil photo.longitude
19
+ end
20
+ end
@@ -59,6 +59,17 @@ describe Picasa::Utils do
59
59
  end
60
60
  end
61
61
 
62
+ describe "#map_to_float" do
63
+ it "does not convert nil value" do
64
+ assert_nil Picasa::Utils.map_to_float(nil)
65
+ end
66
+
67
+ it "converts given value to float" do
68
+ assert_in_delta 101.123, Picasa::Utils.map_to_float("101.123")
69
+ end
70
+ end
71
+
72
+
62
73
  describe "#map_to_date" do
63
74
  it "does not convert nil value" do
64
75
  assert_nil Picasa::Utils.map_to_date(nil)
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picasa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
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-11-29 00:00:00.000000000 Z
11
+ date: 2015-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 5.0.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 5.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mocha
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.13.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.13.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: vcr
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 2.4.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.4.0
111
111
  description: Ruby client for Google Picasa API
@@ -115,8 +115,8 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - .gitignore
119
- - .travis.yml
118
+ - ".gitignore"
119
+ - ".travis.yml"
120
120
  - Gemfile
121
121
  - LICENSE
122
122
  - README.md
@@ -148,6 +148,7 @@ files:
148
148
  - lib/picasa/presenter/comment.rb
149
149
  - lib/picasa/presenter/comment_list.rb
150
150
  - lib/picasa/presenter/content.rb
151
+ - lib/picasa/presenter/exif.rb
151
152
  - lib/picasa/presenter/link.rb
152
153
  - lib/picasa/presenter/media.rb
153
154
  - lib/picasa/presenter/photo.rb
@@ -197,6 +198,7 @@ files:
197
198
  - test/fixtures/sample.3gp
198
199
  - test/fixtures/sample.txt
199
200
  - test/helper.rb
201
+ - test/presenter/photo_test.rb
200
202
  - test/template_test.rb
201
203
  - test/utils_test.rb
202
204
  homepage: https://github.com/morgoth/picasa
@@ -209,17 +211,17 @@ require_paths:
209
211
  - lib
210
212
  required_ruby_version: !ruby/object:Gem::Requirement
211
213
  requirements:
212
- - - '>='
214
+ - - ">="
213
215
  - !ruby/object:Gem::Version
214
216
  version: 1.9.3
215
217
  required_rubygems_version: !ruby/object:Gem::Requirement
216
218
  requirements:
217
- - - '>='
219
+ - - ">="
218
220
  - !ruby/object:Gem::Version
219
221
  version: '0'
220
222
  requirements: []
221
223
  rubyforge_project:
222
- rubygems_version: 2.1.11
224
+ rubygems_version: 2.4.5
223
225
  signing_key:
224
226
  specification_version: 4
225
227
  summary: Simple Google Picasa managment
@@ -258,5 +260,7 @@ test_files:
258
260
  - test/fixtures/sample.3gp
259
261
  - test/fixtures/sample.txt
260
262
  - test/helper.rb
263
+ - test/presenter/photo_test.rb
261
264
  - test/template_test.rb
262
265
  - test/utils_test.rb
266
+ has_rdoc: