flickrie 0.2.1 → 0.2.2
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.
- data/.gitignore +1 -1
- data/LICENSE +1 -1
- data/README.md +7 -3
- data/Rakefile +2 -1
- data/flickrie.gemspec +0 -1
- data/lib/flickrie/oauth.rb +9 -13
- data/lib/flickrie/version.rb +1 -1
- data/test/media_test.rb +4 -4
- metadata +6 -18
- data/finished_api_methods.md +0 -84
data/.gitignore
CHANGED
data/LICENSE
CHANGED
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -54,7 +54,7 @@ Note that, what Flickr refers to as "photoset" in its documentation, I
|
|
54
54
|
refer to as "set". This is because the word "photoset" is actually
|
55
55
|
incorrect, since sets can also hold videos.
|
56
56
|
|
57
|
-
You can also throw in some parameters to
|
57
|
+
You can also throw in some parameters to `Flickrie.photos_from_set` to get more information about photos. For example,
|
58
58
|
|
59
59
|
```ruby
|
60
60
|
photos = Flickrie.photos_from_set(819234, :extras => 'owner_name,last_update,tags,views')
|
@@ -110,7 +110,8 @@ photo.width # => 320
|
|
110
110
|
```
|
111
111
|
|
112
112
|
You can see the full list of available methods and attributes in the
|
113
|
-
[documentation](http://rubydoc.info/gems/flickrie/0.1.2/frames).
|
113
|
+
[documentation](http://rubydoc.info/gems/flickrie/0.1.2/frames). Also,
|
114
|
+
be sure to check the [wiki](https://github.com/janko-m/flickrie/wiki) for some additional info and tips.
|
114
115
|
|
115
116
|
## Authentication
|
116
117
|
|
@@ -139,6 +140,9 @@ request_token.get_authorization_url(:permissions => "read")
|
|
139
140
|
to ask only for "read" permissions from the user. Available permissions
|
140
141
|
are "read", "write" and "delete".
|
141
142
|
|
143
|
+
To see how to make authentication in a web application, see [this](https://github.com/janko-m/flickrie/wiki/Authentication-in-web-applications) wiki
|
144
|
+
page.
|
145
|
+
|
142
146
|
## A few words
|
143
147
|
|
144
148
|
Now, I covered only a few out of many Flickr's API methods using this approach, but I'll constantly update this gem with new API methods. For all of the methods I didn't cover, you can call them using `Flickrie.client`, like this:
|
@@ -200,4 +204,4 @@ basis of this gem.
|
|
200
204
|
|
201
205
|
## License
|
202
206
|
|
203
|
-
[MIT](
|
207
|
+
[MIT](https://github.com/janko-m/flickrie/blob/master/LICENSE)
|
data/Rakefile
CHANGED
data/flickrie.gemspec
CHANGED
data/lib/flickrie/oauth.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'faraday_middleware'
|
2
2
|
require 'faraday_middleware/response_middleware'
|
3
|
-
require 'simple_oauth'
|
4
3
|
|
5
4
|
module Flickrie
|
6
5
|
module OAuth
|
@@ -15,11 +14,11 @@ module Flickrie
|
|
15
14
|
|
16
15
|
Faraday.new(URL) do |connection|
|
17
16
|
connection.request :oauth, oauth_params
|
18
|
-
connection.use
|
17
|
+
connection.use ParseResponseParams
|
19
18
|
connection.adapter Faraday.default_adapter
|
20
19
|
end.
|
21
20
|
tap do |connection|
|
22
|
-
connection.builder.insert_before
|
21
|
+
connection.builder.insert_before ParseResponseParams, StatusCheck
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
@@ -34,15 +33,10 @@ module Flickrie
|
|
34
33
|
class Error < StandardError
|
35
34
|
end
|
36
35
|
|
37
|
-
class
|
38
|
-
dependency do
|
39
|
-
require 'addressable/uri' unless defined?(Addressable)
|
40
|
-
end
|
41
|
-
|
36
|
+
class ParseResponseParams < FaradayMiddleware::ResponseMiddleware
|
42
37
|
define_parser do |body|
|
43
|
-
|
44
|
-
|
45
|
-
parser.query_values
|
38
|
+
params_array = body.split('&').map { |param| param.split('=') }
|
39
|
+
Hash[*params_array.flatten]
|
46
40
|
end
|
47
41
|
end
|
48
42
|
|
@@ -78,12 +72,14 @@ module Flickrie
|
|
78
72
|
extend Token
|
79
73
|
|
80
74
|
def get_authorization_url(options = {})
|
81
|
-
|
75
|
+
require 'uri'
|
76
|
+
url = URI.parse(URL)
|
82
77
|
url.path += "/authorize"
|
83
|
-
|
78
|
+
params = {
|
84
79
|
:oauth_token => token,
|
85
80
|
:perms => options[:permissions] || options[:perms]
|
86
81
|
}
|
82
|
+
url.query = params.map { |k, v| "#{k}=#{v}" }.join('&')
|
87
83
|
url.to_s
|
88
84
|
end
|
89
85
|
end
|
data/lib/flickrie/version.rb
CHANGED
data/test/media_test.rb
CHANGED
@@ -42,7 +42,7 @@ class MediaTest < Test::Unit::TestCase
|
|
42
42
|
assert_equal 'luka', media.tags.first.raw
|
43
43
|
assert_equal false, media.tags.first.machine_tag?
|
44
44
|
|
45
|
-
assert_equal
|
45
|
+
assert_equal 2, media.views_count
|
46
46
|
assert_equal 1, media.comments_count
|
47
47
|
assert_equal '0', media.license.id
|
48
48
|
assert_equal 0, media.safety_level
|
@@ -141,7 +141,7 @@ class MediaTest < Test::Unit::TestCase
|
|
141
141
|
assert_equal 'IMG_0796', media.title
|
142
142
|
assert_equal 'luka', media.tags
|
143
143
|
assert_equal '', media.machine_tags
|
144
|
-
assert_equal
|
144
|
+
assert_equal 2, media.views_count
|
145
145
|
assert_equal '0', media.license.id
|
146
146
|
assert_equal true, media.primary?
|
147
147
|
assert_not_nil media.url
|
@@ -184,7 +184,7 @@ class MediaTest < Test::Unit::TestCase
|
|
184
184
|
assert_equal 'IMG_0796', media.title
|
185
185
|
assert_equal 'luka', media.tags
|
186
186
|
assert_equal '', media.machine_tags
|
187
|
-
assert_equal
|
187
|
+
assert_equal 2, media.views_count
|
188
188
|
assert_equal '0', media.license.id
|
189
189
|
assert_not_nil media.url
|
190
190
|
assert_equal 'ready', media.media_status
|
@@ -232,7 +232,7 @@ class MediaTest < Test::Unit::TestCase
|
|
232
232
|
assert_equal 'IMG_0796', media.title
|
233
233
|
assert_equal 'luka', media.tags
|
234
234
|
assert_equal '', media.machine_tags
|
235
|
-
assert_equal
|
235
|
+
assert_equal 2, media.views_count
|
236
236
|
assert_equal '0', media.license.id
|
237
237
|
assert_not_nil media.url
|
238
238
|
assert_equal 'ready', media.media_status
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickrie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
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: 2012-04-
|
12
|
+
date: 2012-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday_middleware
|
16
|
-
requirement: &
|
16
|
+
requirement: &70320778626240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70320778626240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: simple_oauth
|
27
|
-
requirement: &
|
27
|
+
requirement: &70320778623960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,18 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: addressable
|
38
|
-
requirement: &70145016896660 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *70145016896660
|
35
|
+
version_requirements: *70320778623960
|
47
36
|
description: This gem is a nice wrapper for the Flickr API with an intuitive interface.
|
48
37
|
email:
|
49
38
|
- janko.marohnic@gmail.com
|
@@ -56,7 +45,6 @@ files:
|
|
56
45
|
- LICENSE
|
57
46
|
- README.md
|
58
47
|
- Rakefile
|
59
|
-
- finished_api_methods.md
|
60
48
|
- flickrie.gemspec
|
61
49
|
- lib/flickrie.rb
|
62
50
|
- lib/flickrie/client.rb
|
data/finished_api_methods.md
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# activity
|
2
|
-
|
3
|
-
# auth
|
4
|
-
|
5
|
-
# auth.oauth
|
6
|
-
|
7
|
-
# blogs
|
8
|
-
|
9
|
-
# collections
|
10
|
-
|
11
|
-
# commons
|
12
|
-
|
13
|
-
# contacts
|
14
|
-
|
15
|
-
# favorites
|
16
|
-
|
17
|
-
# galleries
|
18
|
-
|
19
|
-
# groups
|
20
|
-
|
21
|
-
# groups.members
|
22
|
-
|
23
|
-
# groups.pools
|
24
|
-
|
25
|
-
# interestingness
|
26
|
-
|
27
|
-
# machinetags
|
28
|
-
|
29
|
-
# panda
|
30
|
-
|
31
|
-
# people
|
32
|
-
|
33
|
-
- flickr.people.findByEmail
|
34
|
-
- flickr.people.findByUsername
|
35
|
-
- flickr.people.getInfo
|
36
|
-
- flickr.people.getPublicPhotos
|
37
|
-
|
38
|
-
# photos
|
39
|
-
|
40
|
-
- flickr.photos.getInfo
|
41
|
-
- flickr.photos.getSizes
|
42
|
-
- flickr.photos.search
|
43
|
-
|
44
|
-
# photos.comments
|
45
|
-
|
46
|
-
# photos.geo
|
47
|
-
|
48
|
-
# photos.licenses
|
49
|
-
|
50
|
-
- flickr.photos.licenses.getInfo
|
51
|
-
|
52
|
-
# photos.notes
|
53
|
-
|
54
|
-
# photos.people
|
55
|
-
|
56
|
-
# photos.suggestions
|
57
|
-
|
58
|
-
# photos.transform
|
59
|
-
|
60
|
-
# photos.upload
|
61
|
-
|
62
|
-
# photosets
|
63
|
-
|
64
|
-
- flickr.photosets.getInfo
|
65
|
-
- flickr.photosets.getList
|
66
|
-
- flickr.photosets.getPhotos
|
67
|
-
|
68
|
-
# photosets.comments
|
69
|
-
|
70
|
-
# places
|
71
|
-
|
72
|
-
# prefs
|
73
|
-
|
74
|
-
# push
|
75
|
-
|
76
|
-
# reflection
|
77
|
-
|
78
|
-
# stats
|
79
|
-
|
80
|
-
# tags
|
81
|
-
|
82
|
-
# test
|
83
|
-
|
84
|
-
# urls
|