flickr-objects 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -17
- data/lib/flickr/api/abstract/params_processor.rb +20 -9
- data/lib/flickr/api/abstract.rb +2 -0
- data/lib/flickr/api/person.rb +8 -0
- data/lib/flickr/api/photo.rb +28 -0
- data/lib/flickr/api/set.rb +2 -0
- data/lib/flickr/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86c3505e2229c1d398d2993def2dc600aa553479
|
4
|
+
data.tar.gz: b3d7201ba2d5045c32170346dbd6488124f1b61c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dbee233ae370d5646d4774f91e4555a294442abebad859b4c21b3d5516f9ff558e71f014934abdc6d5b0380f7e04d704ee1a30f0dd7820b6d6b9b1e28f18dfc
|
7
|
+
data.tar.gz: ffb3356c91cb905667b10465250e9f72a22edfa9a34a06cdadb0522702330eb68fa6ca3a54746693616cdab560e9745e518f1de3a4dd291a377c1f20d6f55e2b
|
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
This gem is an object-oriented wrapper for the [Flickr API](http://flickr.com/api).
|
4
4
|
|
5
|
-
- Web page: [http://janko-m.github.com/flickr-objects
|
6
|
-
-
|
7
|
-
- API Documentation: [http://rubydoc.info/
|
5
|
+
- Web page: [http://janko-m.github.com/flickr-objects](http://janko-m.github.com/flickr-objects)
|
6
|
+
- Source code: [https://github.com/janko-m/flickr-objects](https://github.com/janko-m/flickr-objects)
|
7
|
+
- API Documentation: [http://rubydoc.info/github/janko-m/flickr-objects/master/frames](http://rubydoc.info/github/janko-m/flickr-objects/master/frames)
|
8
8
|
|
9
9
|
## Installation and setup
|
10
10
|
|
@@ -26,8 +26,8 @@ end
|
|
26
26
|
If you don't have them yet, you can apply for them
|
27
27
|
[here](http://www.flickr.com/services/apps/create/apply).
|
28
28
|
|
29
|
-
For list of possible configuration options,
|
30
|
-
[`Flickr::Configuration`](http://rubydoc.info/
|
29
|
+
For list of possible configuration options, see
|
30
|
+
[`Flickr::Configuration`](http://rubydoc.info/github/janko-m/flickr-objects/master/Flickr/Configuration).
|
31
31
|
|
32
32
|
## Usage
|
33
33
|
|
@@ -38,8 +38,8 @@ Flickr.photos.search(...) # flickr.photos.search
|
|
38
38
|
Flickr.person.get_sets(...) # flickr.photosets.getList
|
39
39
|
```
|
40
40
|
|
41
|
-
For the list of all API methods (and their related Flickr's methods), see
|
42
|
-
[`Flickr::Api`](http://rubydoc.info/
|
41
|
+
For the list of all API methods (and their related Flickr's methods), see
|
42
|
+
[`Flickr::Api`](http://rubydoc.info/github/janko-m/flickr-objects/master/Flickr/Api).
|
43
43
|
These methods are included to the `Flickr` module.
|
44
44
|
|
45
45
|
Example:
|
@@ -61,10 +61,10 @@ set.photos_count #=> 40
|
|
61
61
|
Few notes here:
|
62
62
|
|
63
63
|
- flickr-objects distinguishes **instance** from **class** API methods. So,
|
64
|
-
`Flickr.photos.search` is a class API method. And `Flickr.people.get_sets`
|
64
|
+
`Flickr.photos.search` is a **class** API method. And `Flickr.people.get_sets`
|
65
65
|
is by its nature an **instance** API method, because we're finding sets
|
66
|
-
*from a person*; in that case
|
67
|
-
person
|
66
|
+
*from a person*; in that case it's nicer to call `#get_sets` on an instance of
|
67
|
+
person.
|
68
68
|
- Flickr objects can always be instantiated with `Flickr.<objects>.find(id)`
|
69
69
|
(in the above example we did `Flickr.people.find(id)`).
|
70
70
|
|
@@ -84,8 +84,8 @@ the argument list:
|
|
84
84
|
Flickr.people.find_by_email("janko.marohnic@gmail.com")
|
85
85
|
```
|
86
86
|
|
87
|
-
|
88
|
-
[`Flickr::Api::Person#find_by_email`](http://rubydoc.info/
|
87
|
+
These arguments are documented:
|
88
|
+
[`Flickr::Api::Person#find_by_email`](http://rubydoc.info/github/janko-m/flickr-objects/master/Flickr/Api/Person#find_by_email-instance_method).
|
89
89
|
|
90
90
|
## Sizes
|
91
91
|
|
@@ -103,7 +103,7 @@ photo.width #=> 500
|
|
103
103
|
```
|
104
104
|
|
105
105
|
It is important here that you pass `sizes: true` to `Flickr::Person#public_photos`.
|
106
|
-
So, in your (Rails) application,
|
106
|
+
So, in your (Rails) application, you could use it like this:
|
107
107
|
|
108
108
|
```ruby
|
109
109
|
class PhotosController < ApplicationController
|
@@ -119,7 +119,7 @@ end
|
|
119
119
|
<% end %>
|
120
120
|
```
|
121
121
|
|
122
|
-
To find out more, see [`Flickr::Object::Photo`](http://rubydoc.info/
|
122
|
+
To find out more, see [`Flickr::Object::Photo`](http://rubydoc.info/github/janko-m/flickr-objects/master/Flickr/Object/Photo).
|
123
123
|
|
124
124
|
## Authentication
|
125
125
|
|
@@ -133,8 +133,8 @@ flickr.test_login #=> {"id" => "78733179@N04", "username" => ...}
|
|
133
133
|
flickr.people.find("78733179@N04").get_photos #=> [#<Flickr::Photo ...>, #<Flickr::Photo, ...>, ...]
|
134
134
|
```
|
135
135
|
|
136
|
-
For details on how to authenticate,
|
137
|
-
[`Flickr::OAuth`](http://rubydoc.info/
|
136
|
+
For details on how to authenticate the user, that is, obtain his access token, see
|
137
|
+
[`Flickr::OAuth`](http://rubydoc.info/github/janko-m/flickr-objects/master/Flickr/OAuth).
|
138
138
|
|
139
139
|
If you want, you can also assign the access token globally in your configuration.
|
140
140
|
|
@@ -155,7 +155,7 @@ photo = Flickr.photos.find(photo_id).get_info!
|
|
155
155
|
photo.title #=> "Dandelions"
|
156
156
|
```
|
157
157
|
|
158
|
-
See [`Flickr.upload`](http://rubydoc.info/
|
158
|
+
See [`Flickr.upload`](http://rubydoc.info/github/janko-m/flickr-objects/master/Flickr/Api/General#upload-instance_method).
|
159
159
|
|
160
160
|
## Few words
|
161
161
|
|
@@ -6,6 +6,8 @@ module Flickr
|
|
6
6
|
# Does processing of parameters passed to API requests, to enable nicer
|
7
7
|
# syntax.
|
8
8
|
#
|
9
|
+
# @private
|
10
|
+
#
|
9
11
|
class ParamsProcessor
|
10
12
|
|
11
13
|
attr_reader :params
|
@@ -46,19 +48,28 @@ module Flickr
|
|
46
48
|
end
|
47
49
|
|
48
50
|
def add_sizes?(flickr_method)
|
49
|
-
[ "
|
50
|
-
"
|
51
|
+
[ "favorites.getPublicList",
|
52
|
+
"favorites.getList",
|
53
|
+
"galleries.getPhotos",
|
54
|
+
"groups.pools.getPhotos",
|
55
|
+
"interestingness.getList",
|
56
|
+
"people.getPhotos",
|
57
|
+
"people.getPhotosOf",
|
58
|
+
"panda.getPhotos",
|
59
|
+
"people.getPublicPhotos",
|
60
|
+
"photos.comments.getRecentForContacts",
|
61
|
+
"photos.geo.getLocation",
|
62
|
+
"photos.geo.photosForLocation",
|
63
|
+
"photos.getContactsPhotos",
|
64
|
+
"photos.getContactsPublicPhotos",
|
51
65
|
"photos.getNotInSet",
|
52
66
|
"photos.getRecent",
|
53
|
-
"photos.getUntagged",
|
54
67
|
"photos.getWithGeoData",
|
68
|
+
"photos.getUntagged",
|
55
69
|
"photos.getWithoutGeoData",
|
56
|
-
"photos.
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"people.getPhotosOf",
|
60
|
-
"people.getPublicPhotos",
|
61
|
-
"people.getContactsPublicPhotos" ].include?(flickr_method)
|
70
|
+
"photos.search",
|
71
|
+
"photos.recentlyUpdated",
|
72
|
+
"photosets.getPhotos" ].include?(flickr_method)
|
62
73
|
end
|
63
74
|
|
64
75
|
end
|
data/lib/flickr/api/abstract.rb
CHANGED
data/lib/flickr/api/person.rb
CHANGED
@@ -45,6 +45,8 @@ module Flickr
|
|
45
45
|
##
|
46
46
|
# @param person_id [String]
|
47
47
|
# @param params [Hash] See documentation below
|
48
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
49
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
48
50
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
49
51
|
# @docs [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
|
50
52
|
#
|
@@ -56,6 +58,8 @@ module Flickr
|
|
56
58
|
##
|
57
59
|
# @param person_id [String]
|
58
60
|
# @param params [Hash] See documentation below
|
61
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
62
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
59
63
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
60
64
|
# @docs [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
61
65
|
#
|
@@ -67,6 +71,8 @@ module Flickr
|
|
67
71
|
##
|
68
72
|
# @param person_id [String]
|
69
73
|
# @param params [Hash] See documentation below
|
74
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
75
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
70
76
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
71
77
|
# @docs [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
|
72
78
|
#
|
@@ -78,6 +84,8 @@ module Flickr
|
|
78
84
|
##
|
79
85
|
# @param person_id [String]
|
80
86
|
# @param params [Hash] See documentation below
|
87
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
88
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
81
89
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
82
90
|
# @docs [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
|
83
91
|
#
|
data/lib/flickr/api/photo.rb
CHANGED
@@ -5,6 +5,8 @@ module Flickr
|
|
5
5
|
|
6
6
|
##
|
7
7
|
# @param params [Hash] See documentation below
|
8
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
9
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
8
10
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
9
11
|
# @docs [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
10
12
|
#
|
@@ -15,6 +17,8 @@ module Flickr
|
|
15
17
|
|
16
18
|
##
|
17
19
|
# @param params [Hash] See documentation below
|
20
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
21
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
18
22
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
19
23
|
# @docs [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
|
20
24
|
#
|
@@ -25,6 +29,8 @@ module Flickr
|
|
25
29
|
|
26
30
|
##
|
27
31
|
# @param params [Hash] See documentation below
|
32
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
33
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
28
34
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
29
35
|
# @docs [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
|
30
36
|
#
|
@@ -35,6 +41,8 @@ module Flickr
|
|
35
41
|
|
36
42
|
##
|
37
43
|
# @param params [Hash] See documentation below
|
44
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
45
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
38
46
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
39
47
|
# @docs [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
|
40
48
|
#
|
@@ -45,6 +53,20 @@ module Flickr
|
|
45
53
|
|
46
54
|
##
|
47
55
|
# @param params [Hash] See documentation below
|
56
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
57
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
58
|
+
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
59
|
+
# @docs [flickr.interestingness.getList](www.flickr.com/services/api/flickr.interestingness.getList.html)
|
60
|
+
#
|
61
|
+
def get_interesting(params = {})
|
62
|
+
response = get "interestingness.getList", params
|
63
|
+
new_list(:Photo, response["photos"].delete("photo"), response["photos"])
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# @param params [Hash] See documentation below
|
68
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
69
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
48
70
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
49
71
|
# @docs [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
|
50
72
|
#
|
@@ -55,6 +77,8 @@ module Flickr
|
|
55
77
|
|
56
78
|
##
|
57
79
|
# @param params [Hash] See documentation below
|
80
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
81
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
58
82
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
59
83
|
# @docs [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
|
60
84
|
#
|
@@ -65,6 +89,8 @@ module Flickr
|
|
65
89
|
|
66
90
|
##
|
67
91
|
# @param params [Hash] See documentation below
|
92
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
93
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
68
94
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
69
95
|
# @docs [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
|
70
96
|
#
|
@@ -75,6 +101,8 @@ module Flickr
|
|
75
101
|
|
76
102
|
##
|
77
103
|
# @param params [Hash] See documentation below
|
104
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
105
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
78
106
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
79
107
|
# @docs [flickr.photos.RecentlyUpdated](http://www.flickr.com/services/api/flickr.photos.RecentlyUpdated.html)
|
80
108
|
#
|
data/lib/flickr/api/set.rb
CHANGED
@@ -55,6 +55,8 @@ module Flickr
|
|
55
55
|
##
|
56
56
|
# @param set_id [String]
|
57
57
|
# @param params [Hash] See documentation below
|
58
|
+
# @option params [Boolean, Array<String>] :sizes For all sizes use `true`, for specific ones
|
59
|
+
# chuck them into an array (e.g. `["Square 75", "Medium 500"]`).
|
58
60
|
# @return [Flickr::Object::List<Flickr::Object::Photo>]
|
59
61
|
# @docs [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
60
62
|
#
|
data/lib/flickr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickr-objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
260
|
rubyforge_project:
|
261
|
-
rubygems_version: 2.
|
261
|
+
rubygems_version: 2.0.3
|
262
262
|
signing_key:
|
263
263
|
specification_version: 4
|
264
264
|
summary: This gem is an object-oriented wrapper for the Flickr API.
|