flickraw 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +9 -7
- data/examples/web_oauth.rb +1 -2
- data/lib/flickraw.rb +3 -1
- data/lib/flickraw/api.rb +5 -5
- data/lib/flickraw/oauth.rb +2 -2
- data/test/helper.rb +1 -1
- data/test/test.rb +24 -24
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc6ebd96bb86d75cb32adff22f3e2110405c9d53
|
4
|
+
data.tar.gz: c00d50468c5b8aa775bd0a9145d590c83fc4365a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e600b2afe460bc96a670a0a20d7a1815cca53af6091191884f65177a843ee2d534f7a5eb1bbe965579643411f3f27dcbed1e8d26f3b4075011006d9c8b882bf
|
7
|
+
data.tar.gz: e784c567318a3483d5ae9c31f17aa5ca5fb8433caae3361f9c5bcd7e74664821bc5e99a2156e045eba809baeb6d5a9403078395398630b56636bd9caf36c075c
|
data/README.rdoc
CHANGED
@@ -111,8 +111,10 @@ If you need to have several users authenticated at the same time in your applica
|
|
111
111
|
|
112
112
|
== Secure endpoints
|
113
113
|
|
114
|
+
https endpoints are used by default. If you want to use unencrypted endpoints :
|
115
|
+
|
114
116
|
require 'flickraw'
|
115
|
-
FlickRaw.secure =
|
117
|
+
FlickRaw.secure = false
|
116
118
|
|
117
119
|
== Flickr URL Helpers
|
118
120
|
|
@@ -121,32 +123,32 @@ There are some helpers to build flickr urls :
|
|
121
123
|
=== url, url_m, url_s, url_t, url_b, url_z, url_q, url_n, url_c, url_o
|
122
124
|
|
123
125
|
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
124
|
-
FlickRaw.url_b(info) # => "
|
126
|
+
FlickRaw.url_b(info) # => "https://farm3.static.flickr.com/2485/3839885270_6fb8b54e06_b.jpg"
|
125
127
|
|
126
128
|
=== url_profile
|
127
129
|
|
128
130
|
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
129
|
-
FlickRaw.url_profile(info) # => "
|
131
|
+
FlickRaw.url_profile(info) # => "https://www.flickr.com/people/41650587@N02/"
|
130
132
|
|
131
133
|
=== url_photopage
|
132
134
|
|
133
135
|
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
134
|
-
FlickRaw.url_photopage(info) # => "
|
136
|
+
FlickRaw.url_photopage(info) # => "https://www.flickr.com/photos/41650587@N02/3839885270"
|
135
137
|
|
136
138
|
=== url_photoset, url_photosets
|
137
139
|
|
138
140
|
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
139
|
-
FlickRaw.url_photosets(info) # => "
|
141
|
+
FlickRaw.url_photosets(info) # => "https://www.flickr.com/photos/41650587@N02/sets/"
|
140
142
|
|
141
143
|
=== url_short, url_short_m, url_short_s, url_short_t
|
142
144
|
|
143
145
|
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
144
|
-
FlickRaw.url_short(info) # => "
|
146
|
+
FlickRaw.url_short(info) # => "https://flic.kr/p/6Rjq7s"
|
145
147
|
|
146
148
|
=== url_photostream
|
147
149
|
|
148
150
|
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
149
|
-
FlickRaw.url_photostream(info) # => "
|
151
|
+
FlickRaw.url_photostream(info) # => "https://www.flickr.com/photos/41650587@N02/"
|
150
152
|
|
151
153
|
|
152
154
|
See the _examples_ directory to find more examples.
|
data/examples/web_oauth.rb
CHANGED
@@ -46,7 +46,6 @@ def callback
|
|
46
46
|
|
47
47
|
# Attach the tokens to your flickr instance - you can now make authenticated calls with the flickr object
|
48
48
|
flickr.access_token = oauth_token
|
49
|
-
flickr.access_secret =
|
50
|
-
|
49
|
+
flickr.access_secret = oauth_token_secret
|
51
50
|
end
|
52
51
|
|
data/lib/flickraw.rb
CHANGED
@@ -6,8 +6,10 @@ require 'flickraw/response'
|
|
6
6
|
require 'flickraw/api'
|
7
7
|
|
8
8
|
module FlickRaw
|
9
|
-
VERSION='0.9.
|
9
|
+
VERSION='0.9.8'
|
10
10
|
USER_AGENT = "FlickRaw/#{VERSION}"
|
11
|
+
|
12
|
+
self.secure = true
|
11
13
|
end
|
12
14
|
|
13
15
|
# Use this to access the flickr API easily. You can type directly the flickr requests as they are described on the flickr website.
|
data/lib/flickraw/api.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module FlickRaw
|
2
2
|
END_POINT='http://api.flickr.com/services'.freeze
|
3
3
|
END_POINT2='http://www.flickr.com/services'.freeze
|
4
|
-
END_POINT_SECURE='https://
|
4
|
+
END_POINT_SECURE='https://api.flickr.com/services'.freeze
|
5
5
|
|
6
6
|
FLICKR_OAUTH_REQUEST_TOKEN=(END_POINT2 + '/oauth/request_token').freeze
|
7
7
|
FLICKR_OAUTH_AUTHORIZE=(END_POINT2 + '/oauth/authorize').freeze
|
@@ -19,10 +19,10 @@ module FlickRaw
|
|
19
19
|
UPLOAD_PATH_SECURE=(END_POINT_SECURE + '/upload/').freeze
|
20
20
|
REPLACE_PATH_SECURE=(END_POINT_SECURE + '/replace/').freeze
|
21
21
|
|
22
|
-
PHOTO_SOURCE_URL='
|
23
|
-
URL_PROFILE='
|
24
|
-
URL_PHOTOSTREAM='
|
25
|
-
URL_SHORT='
|
22
|
+
PHOTO_SOURCE_URL='https://farm%s.staticflickr.com/%s/%s_%s%s.%s'.freeze
|
23
|
+
URL_PROFILE='https://www.flickr.com/people/'.freeze
|
24
|
+
URL_PHOTOSTREAM='https://www.flickr.com/photos/'.freeze
|
25
|
+
URL_SHORT='https://flic.kr/p/'.freeze
|
26
26
|
|
27
27
|
class FlickrAppNotConfigured < Error; end
|
28
28
|
|
data/lib/flickraw/oauth.rb
CHANGED
@@ -37,14 +37,14 @@ module FlickRaw
|
|
37
37
|
def sign_rsa_sha1(method, url, params, token_secret, consumer_secret)
|
38
38
|
text = signature_base_string(method, url, params)
|
39
39
|
key = OpenSSL::PKey::RSA.new(consumer_secret)
|
40
|
-
digest = OpenSSL::Digest::
|
40
|
+
digest = OpenSSL::Digest::SHA1.new
|
41
41
|
[key.sign(digest, text)].pack('m0').gsub(/\n$/,'')
|
42
42
|
end
|
43
43
|
|
44
44
|
def sign_hmac_sha1(method, url, params, token_secret, consumer_secret)
|
45
45
|
text = signature_base_string(method, url, params)
|
46
46
|
key = escape(consumer_secret) + "&" + escape(token_secret)
|
47
|
-
digest = OpenSSL::Digest::
|
47
|
+
digest = OpenSSL::Digest::SHA1.new
|
48
48
|
[OpenSSL::HMAC.digest(digest, key, text)].pack('m0').gsub(/\n$/,'')
|
49
49
|
end
|
50
50
|
|
data/test/helper.rb
CHANGED
@@ -5,7 +5,7 @@ require 'flickraw'
|
|
5
5
|
|
6
6
|
FlickRaw.api_key = ENV['FLICKRAW_API_KEY']
|
7
7
|
FlickRaw.shared_secret = ENV['FLICKRAW_SHARED_SECRET']
|
8
|
-
#FlickRaw.secure =
|
8
|
+
#FlickRaw.secure = false
|
9
9
|
|
10
10
|
flickr.access_token = ENV['FLICKRAW_ACCESS_TOKEN']
|
11
11
|
flickr.access_secret = ENV['FLICKRAW_ACCESS_SECRET']
|
data/test/test.rb
CHANGED
@@ -290,9 +290,9 @@ class Basic < Test::Unit::TestCase
|
|
290
290
|
user = flickr.people.getInfo :user_id => "41650587@N02"
|
291
291
|
people user
|
292
292
|
assert_equal "Flickraw", user.realname
|
293
|
-
assert_equal "
|
294
|
-
assert_equal "
|
295
|
-
assert_equal "
|
293
|
+
assert_equal "https://www.flickr.com/photos/41650587@N02/", user.photosurl
|
294
|
+
assert_equal "https://www.flickr.com/people/41650587@N02/", user.profileurl
|
295
|
+
assert_equal "https://m.flickr.com/photostream.gne?id=41630239", user.mobileurl
|
296
296
|
assert_equal 0, user.ispro
|
297
297
|
end
|
298
298
|
|
@@ -342,7 +342,7 @@ class Basic < Test::Unit::TestCase
|
|
342
342
|
|
343
343
|
def test_photos_getSizes
|
344
344
|
info = flickr.photos.getSizes :photo_id => "3839885270"
|
345
|
-
assert_equal "
|
345
|
+
assert_equal "https://www.flickr.com/photos/41650587@N02/3839885270/sizes/l/", info.find {|f| f.label == "Large"}.url
|
346
346
|
if FlickRaw.secure
|
347
347
|
source = "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_b.jpg"
|
348
348
|
else
|
@@ -365,7 +365,7 @@ class Basic < Test::Unit::TestCase
|
|
365
365
|
assert_equal "41630239-3839885270-72157621986549875", comments[0].id
|
366
366
|
assert_equal "41650587@N02", comments[0].author
|
367
367
|
assert_equal "ruby_flickraw", comments[0].authorname
|
368
|
-
assert_equal "
|
368
|
+
assert_equal "https://www.flickr.com/photos/41650587@N02/3839885270/#comment72157621986549875", comments[0].permalink
|
369
369
|
assert_equal "This is a cute cat !", comments[0].to_s
|
370
370
|
end
|
371
371
|
|
@@ -387,29 +387,29 @@ class Basic < Test::Unit::TestCase
|
|
387
387
|
def test_urls_getGroup
|
388
388
|
info = flickr.urls.getGroup :group_id => "51035612836@N01"
|
389
389
|
assert_equal "51035612836@N01", info.nsid
|
390
|
-
assert_equal "
|
390
|
+
assert_equal "https://www.flickr.com/groups/api/", info.url
|
391
391
|
end
|
392
392
|
|
393
393
|
def test_urls_getUserPhotos
|
394
394
|
info = flickr.urls.getUserPhotos :user_id => "41650587@N02"
|
395
395
|
assert_equal "41650587@N02", info.nsid
|
396
|
-
assert_equal "
|
396
|
+
assert_equal "https://www.flickr.com/photos/41650587@N02/", info.url
|
397
397
|
end
|
398
398
|
|
399
399
|
def test_urls_getUserProfile
|
400
400
|
info = flickr.urls.getUserProfile :user_id => "41650587@N02"
|
401
401
|
assert_equal "41650587@N02", info.nsid
|
402
|
-
assert_equal "
|
402
|
+
assert_equal "https://www.flickr.com/people/41650587@N02/", info.url
|
403
403
|
end
|
404
404
|
|
405
405
|
def test_urls_lookupGroup
|
406
|
-
info = flickr.urls.lookupGroup :url => "
|
406
|
+
info = flickr.urls.lookupGroup :url => "https://www.flickr.com/groups/api/"
|
407
407
|
assert_equal "51035612836@N01", info.id
|
408
408
|
assert_equal "Flickr API", info.groupname
|
409
409
|
end
|
410
410
|
|
411
411
|
def test_urls_lookupUser
|
412
|
-
info = flickr.urls.lookupUser :url => "
|
412
|
+
info = flickr.urls.lookupUser :url => "https://www.flickr.com/photos/41650587@N02/"
|
413
413
|
assert_equal "41650587@N02", info.id
|
414
414
|
assert_equal "ruby_flickraw", info.username
|
415
415
|
end
|
@@ -418,21 +418,21 @@ class Basic < Test::Unit::TestCase
|
|
418
418
|
id = "3839885270"
|
419
419
|
info = flickr.photos.getInfo(:photo_id => id)
|
420
420
|
|
421
|
-
assert_equal "
|
422
|
-
assert_equal "
|
423
|
-
assert_equal "
|
424
|
-
assert_equal "
|
425
|
-
assert_equal "
|
426
|
-
assert_equal "
|
427
|
-
assert_equal "
|
428
|
-
assert_equal "
|
429
|
-
assert_equal "
|
421
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06.jpg", FlickRaw.url(info)
|
422
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_m.jpg", FlickRaw.url_m(info)
|
423
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_s.jpg", FlickRaw.url_s(info)
|
424
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_t.jpg", FlickRaw.url_t(info)
|
425
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_b.jpg", FlickRaw.url_b(info)
|
426
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_z.jpg", FlickRaw.url_z(info)
|
427
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_q.jpg", FlickRaw.url_q(info)
|
428
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_n.jpg", FlickRaw.url_n(info)
|
429
|
+
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_c.jpg", FlickRaw.url_c(info)
|
430
430
|
|
431
|
-
assert_equal "
|
432
|
-
assert_equal "
|
433
|
-
assert_equal "
|
434
|
-
assert_equal "
|
435
|
-
assert_equal "
|
431
|
+
assert_equal "https://www.flickr.com/people/41650587@N02/", FlickRaw.url_profile(info)
|
432
|
+
assert_equal "https://www.flickr.com/photos/41650587@N02/", FlickRaw.url_photostream(info)
|
433
|
+
assert_equal "https://www.flickr.com/photos/41650587@N02/3839885270", FlickRaw.url_photopage(info)
|
434
|
+
assert_equal "https://www.flickr.com/photos/41650587@N02/sets/", FlickRaw.url_photosets(info)
|
435
|
+
assert_equal "https://flic.kr/p/6Rjq7s", FlickRaw.url_short(info)
|
436
436
|
end
|
437
437
|
|
438
438
|
def test_url_escape
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickraw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mael Clerambault
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: mael@clerambault.fr
|
@@ -16,25 +16,25 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- LICENSE
|
20
|
+
- README.rdoc
|
19
21
|
- examples/auth.rb
|
20
22
|
- examples/interestingness.rb
|
21
23
|
- examples/search.rb
|
22
24
|
- examples/sinatra.rb
|
23
25
|
- examples/upload.rb
|
24
26
|
- examples/web_oauth.rb
|
25
|
-
-
|
26
|
-
-
|
27
|
-
- test/test.rb
|
28
|
-
- lib/flickraw/request.rb
|
27
|
+
- flickraw_rdoc.rb
|
28
|
+
- lib/flickraw.rb
|
29
29
|
- lib/flickraw/api.rb
|
30
30
|
- lib/flickraw/error.rb
|
31
31
|
- lib/flickraw/oauth.rb
|
32
|
+
- lib/flickraw/request.rb
|
32
33
|
- lib/flickraw/response.rb
|
33
|
-
- lib/flickraw.rb
|
34
|
-
- flickraw_rdoc.rb
|
35
|
-
- LICENSE
|
36
|
-
- README.rdoc
|
37
34
|
- rakefile
|
35
|
+
- test/helper.rb
|
36
|
+
- test/test.rb
|
37
|
+
- test/test_upload.rb
|
38
38
|
homepage: http://hanklords.github.com/flickraw/
|
39
39
|
licenses:
|
40
40
|
- MIT
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.2.2
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Flickr library with a syntax close to the syntax described on http://www.flickr.com/services/api
|