flickrie 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +41 -140
- data/lib/flickrie.rb +10 -5
- data/lib/flickrie/api_methods.rb +274 -167
- data/lib/flickrie/callable.rb +21 -21
- data/lib/flickrie/client.rb +16 -259
- data/lib/flickrie/client/methods.rb +89 -0
- data/lib/flickrie/collection.rb +1 -2
- data/lib/flickrie/deprecatable.rb +10 -0
- data/lib/flickrie/flickr_api_methods.rb +246 -0
- data/lib/flickrie/instance.rb +0 -1
- data/lib/flickrie/middleware/fix_flickr_data.rb +149 -124
- data/lib/flickrie/oauth.rb +9 -9
- data/lib/flickrie/objects/comment.rb +35 -0
- data/lib/flickrie/objects/media.rb +8 -8
- data/lib/flickrie/objects/media/exif.rb +2 -2
- data/lib/flickrie/objects/media_context.rb +1 -1
- data/lib/flickrie/objects/user.rb +2 -1
- data/lib/flickrie/upload_client.rb +3 -10
- data/lib/flickrie/version.rb +1 -1
- metadata +40 -54
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aac7ec3fceb277ce74b0708c49f6001e7bd99179
|
4
|
+
data.tar.gz: b8646789ba7a387579743f3653da143dc923e5bc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea9b15d28e7d399d4eedc547fdfcd726d96f8bba84a8564b75143ed096c91f2b42b1a1a9dd83dd82c224ccdb53cea5717d2408c38c219fdfd53ad0f22c8ef000
|
7
|
+
data.tar.gz: 65f0a923e9ed74586cd0afa9981f5fb520f850bddab4a0d52ea35715a54f1c7ecfb5479f9f042e3a9eed17da71b173f874b8ab062840ef979bcc3fd458a47ed7
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Flickrie
|
2
2
|
|
3
|
+
**NOTICE: This gem is deprecated. You should switch to the
|
4
|
+
[flickr-objects](https://github.com/janko-m/flickr-objects) gem.**
|
5
|
+
|
6
|
+
---
|
7
|
+
|
3
8
|
This gem is a nice wrapper for the Flickr API with an object-oriented interface.
|
4
9
|
|
5
10
|
- Homepage: [http://janko-m.github.com/flickrie/](http://janko-m.github.com/flickrie/)
|
@@ -12,54 +17,25 @@ This gem is a nice wrapper for the Flickr API with an object-oriented interface.
|
|
12
17
|
|
13
18
|
- Flickr API page: [http://www.flickr.com/services/api](http://www.flickr.com/services/api/)
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
The reason why I did this gem is because the existing ones either weren't
|
18
|
-
well maintained, or they weren't object oriented and provided a literal
|
19
|
-
wrapper over the API. That didn't statisfy me, because Flickr API
|
20
|
-
sometimes gives you the same information in different ways. And I want
|
21
|
-
to normalize that. Also, JSON responses can return "time" attributes
|
22
|
-
only in the string format. And I thought it would be nice that, if you're
|
23
|
-
accessing the `updated_at` attribute for example, you actually **get**
|
24
|
-
an instance of `Time`, instead of a string, or even integer. These are
|
25
|
-
just some of the reason I decided to make this gem.
|
26
|
-
|
27
|
-
The method names here aren't called the same as Flickr's API methods
|
28
|
-
(and they can't be), but they follow a pattern which
|
29
|
-
shouldn't be too difficult to predict. Take a look at the ["Currently covered API
|
30
|
-
methods"](#currently-covered-api-methods) section of this readme.
|
31
|
-
|
32
|
-
Also, some attribute names that you get from the response are changed.
|
33
|
-
So, for example, the `last_update` attribute is called `updated_at`,
|
34
|
-
and the `candownload` attribute is called `can_download?`. Because this
|
35
|
-
is a **ruby** wrapper, I wanted to write it in Ruby/Rails fashion. At
|
36
|
-
first you might not approve of this, because then you might not know
|
37
|
-
what the methods name are if you know the name of the key in the
|
38
|
-
response hash. But, on the other hand, Flickr often gives you the same
|
39
|
-
information in different formats, so this also acts as a normalizer. The
|
40
|
-
downsize of this approach is that it may not be up to date when the
|
41
|
-
Flickr API changes, but that's why I have **you** to open a new issue
|
42
|
-
when you notice something isn't working :)
|
43
|
-
|
44
|
-
The gem works on Ruby versions `1.9.2` and `1.9.3`. Also, it follows
|
45
|
-
[Semantic versioning](http://semver.org/).
|
46
|
-
|
47
|
-
## Examples of usage
|
48
|
-
|
49
|
-
You first need to install the gem.
|
20
|
+
Supported Ruby versions:
|
50
21
|
|
51
|
-
|
52
|
-
|
53
|
-
```
|
22
|
+
- `1.9.2`
|
23
|
+
- `1.9.3`
|
54
24
|
|
55
|
-
|
25
|
+
This gem follows [Semantic versioning](http://semver.org/).
|
26
|
+
|
27
|
+
## Installation and setup
|
28
|
+
|
29
|
+
Add it to your `Gemfile`.
|
56
30
|
|
57
31
|
```ruby
|
58
|
-
gem "flickrie"
|
32
|
+
gem "flickrie"
|
59
33
|
```
|
60
34
|
|
61
|
-
|
62
|
-
|
35
|
+
And in your Terminal run `bundle install`.
|
36
|
+
|
37
|
+
Now you have to set your API key and shared secret in your app (if you don't have them yet,
|
38
|
+
you can get them [here](http://www.flickr.com/services/apps/create/apply)).
|
63
39
|
|
64
40
|
```ruby
|
65
41
|
require 'flickrie'
|
@@ -68,9 +44,9 @@ Flickrie.api_key = "API_KEY"
|
|
68
44
|
Flickrie.shared_secret = "SHARED_SECRET"
|
69
45
|
```
|
70
46
|
|
71
|
-
If
|
47
|
+
If you're in a Rails app, this would go into an initializer.
|
72
48
|
|
73
|
-
|
49
|
+
## Usage
|
74
50
|
|
75
51
|
```ruby
|
76
52
|
set_id = 819234
|
@@ -84,20 +60,21 @@ photo.owner # => #<User: nsid="67313352@N04", ...>
|
|
84
60
|
photo.owner.nsid # => "67313352@N04"
|
85
61
|
```
|
86
62
|
|
87
|
-
You can also
|
63
|
+
You can also pass in additional parameters to to get more information about photos:
|
88
64
|
|
89
65
|
```ruby
|
90
|
-
photos = Flickrie.photos_from_set(819234, :
|
66
|
+
photos = Flickrie.photos_from_set(819234, extras: "owner_name,last_update,tags,views")
|
91
67
|
|
92
68
|
photo = photos.first
|
93
|
-
photo.tags.join(
|
69
|
+
photo.tags.join(" ") # => "cave cold forrest"
|
94
70
|
photo.owner.username # => "jsmith"
|
95
71
|
photo.updated_at # => 2012-04-20 23:29:17 +0200
|
96
72
|
photo.views_count # => 24
|
97
73
|
```
|
98
74
|
|
99
|
-
|
100
|
-
|
75
|
+
For the list of all Flickr API methods and parameters you can pass to them take a look at the
|
76
|
+
[Flickr API documentation](http://www.flickr.com/services/api/). The method names in this gem correspond
|
77
|
+
to Flickr's method names (so, for example, `Flickr.photos_from_set` is actually `flickr.photosets.getPhotos`).
|
101
78
|
|
102
79
|
You can also get additional info on a single photo:
|
103
80
|
|
@@ -112,7 +89,7 @@ photo.owner.real_name # => "John Smith"
|
|
112
89
|
photo.location.country.name # => "United States"
|
113
90
|
```
|
114
91
|
|
115
|
-
If you already have an
|
92
|
+
If you already have an instatiated photo, you can also get info like this:
|
116
93
|
|
117
94
|
```ruby
|
118
95
|
photo.description # => nil
|
@@ -121,11 +98,11 @@ photo.description # => "In this photo Peter said something really funny..."
|
|
121
98
|
```
|
122
99
|
|
123
100
|
You'll also probably want to display these photos in your app. There are
|
124
|
-
some neat methods
|
101
|
+
some neat methods to help you with this.
|
125
102
|
|
126
103
|
```ruby
|
127
104
|
photo = Flickrie.get_photo_sizes(8232348)
|
128
|
-
# or
|
105
|
+
# or `photo.get_sizes` on an existing photo
|
129
106
|
|
130
107
|
photo.medium!(500)
|
131
108
|
photo.size # => "Medium 500"
|
@@ -144,9 +121,6 @@ So, in your ERB template you could do something like this (in Rails):
|
|
144
121
|
|
145
122
|
You can see the full list of available methods and attributes in the
|
146
123
|
[documentation](http://rubydoc.info/gems/flickrie/).
|
147
|
-
For photos (and videos) have a look at the `Flickrie::Media` module,
|
148
|
-
because it's included into `Flickrie::Photo` and `Flickrie::Video`, and most
|
149
|
-
of the attributes are there.
|
150
124
|
|
151
125
|
Also, be sure to check the [wiki](https://github.com/janko-m/flickrie/wiki) for some additional info and tips.
|
152
126
|
|
@@ -169,26 +143,25 @@ puts "You successfully authenticated!"
|
|
169
143
|
|
170
144
|
Flickrie.access_token = access_token.token
|
171
145
|
Flickrie.access_secret = access_token.secret
|
172
|
-
access_token.user_params # => {:
|
146
|
+
access_token.user_params # => {fullname: "John Smith", user_nsid: "67131352@N03", username: "jsmith"}
|
173
147
|
```
|
174
148
|
|
175
149
|
When getting the authorization url, you can also call
|
176
150
|
```ruby
|
177
|
-
request_token.
|
151
|
+
request_token.authorize_url(permissions: "read")
|
178
152
|
```
|
179
|
-
to ask only for "read" permissions
|
180
|
-
are "read", "write" and "delete".
|
153
|
+
to ask only for "read" permissions. Available permissions are "read", "write" and "delete".
|
181
154
|
|
182
|
-
If you want to make authentication in your web application,
|
183
|
-
[
|
184
|
-
Or, if you want to do it
|
155
|
+
If you want to make authentication in your web application, I would highly
|
156
|
+
recommend the [omniauth-flickr](https://github.com/timbreitkreutz/omniauth-flickr) gem.
|
157
|
+
Or, if you want to do it from scratch, without any additional gems, check out
|
185
158
|
[this wiki](https://github.com/janko-m/flickrie/wiki/Authentication-in-web-applications)
|
186
|
-
for
|
159
|
+
for an example how that authentication might look like.
|
187
160
|
|
188
161
|
## Photo upload
|
189
162
|
|
190
163
|
```ruby
|
191
|
-
photo_id = Flickrie.upload("/path/to/photo.jpg", :
|
164
|
+
photo_id = Flickrie.upload("/path/to/photo.jpg", title: "A cow")
|
192
165
|
photo = Flickrie.get_photo_info(photo_id)
|
193
166
|
photo.title # => "A cow"
|
194
167
|
```
|
@@ -203,7 +176,7 @@ of an asynchronous photo upload.
|
|
203
176
|
|
204
177
|
## A few words
|
205
178
|
|
206
|
-
Now,
|
179
|
+
Now, there are a lot more API methods that I didn't cover yet,
|
207
180
|
but I'll constantly update this gem with new API methods. For all of the methods
|
208
181
|
I didn't cover, you can still call them using
|
209
182
|
|
@@ -238,82 +211,10 @@ It's not nearly as pretty, but at least you can get to the data for the
|
|
238
211
|
time being. Notice that the `:api_key` parameter is always passed in by
|
239
212
|
default.
|
240
213
|
|
241
|
-
##
|
242
|
-
|
243
|
-
Please, feel free to post any issues that you're having. You can also
|
244
|
-
post feature requests.
|
245
|
-
|
246
|
-
## Cedits
|
214
|
+
## Credits
|
247
215
|
|
248
216
|
Special thanks to @**mislav**, my brother, he helped me really a lot
|
249
|
-
with getting started with
|
250
|
-
basis of this gem.
|
251
|
-
|
252
|
-
## Currently covered API methods
|
253
|
-
|
254
|
-
```ruby
|
255
|
-
# people
|
256
|
-
"flickr.people.findByEmail" -> Flickrie.find_user_by_email
|
257
|
-
"flickr.people.findByUsername" -> Flickrie.find_user_by_username
|
258
|
-
"flickr.people.getInfo" -> Flickrie.get_user_info
|
259
|
-
"flickr.people.getPhotos" -> Flickrie.photos_from_user
|
260
|
-
"flickr.people.getPhotosOf" -> Flickrie.photos_of_user
|
261
|
-
"flickr.people.getPublicPhotos" -> Flickrie.public_photos_from_user
|
262
|
-
"flickr.people.getUploadStatus" -> Flickrie.get_upload_status
|
263
|
-
|
264
|
-
# photos
|
265
|
-
"flickr.photos.addTags" -> Flickrie.add_photo_tags
|
266
|
-
"flickr.photos.delete" -> Flickrie.delete_photo
|
267
|
-
"flickr.photos.getContactsPhotos" -> Flickrie.photos_from_contacts
|
268
|
-
"flickr.photos.getContactsPublicPhotos" -> Flickrie.public_photos_from_user_contacts
|
269
|
-
"flickr.photos.getContext" -> Flickrie.get_photo_context
|
270
|
-
"flickr.photos.getCounts" -> Flickrie.get_photos_counts
|
271
|
-
"flickr.photos.getExif" -> Flickrie.get_photo_exif
|
272
|
-
"flickr.photos.getFavorites" -> Flickrie.get_photo_favorites
|
273
|
-
"flickr.photos.getInfo" -> Flickrie.get_photo_info
|
274
|
-
"flickr.photos.getNotInSet" -> Flickrie.photos_not_in_set
|
275
|
-
"flickr.photos.getPerms" -> Flickrie.get_photo_permissions
|
276
|
-
"flickr.photos.getRecent" -> Flickrie.get_recent_photos
|
277
|
-
"flickr.photos.getSizes" -> Flickrie.get_photo_sizes
|
278
|
-
"flickr.photos.getUntagged" -> Flickrie.get_untagged_photos
|
279
|
-
"flickr.photos.getWithGeoData" -> Flickrie.get_photos_with_geo_data
|
280
|
-
"flickr.photos.getWithoutGeoData" -> Flickrie.get_photos_without_geo_data
|
281
|
-
"flickr.photos.recentlyUpdated" -> Flickrie.recently_updated_photos
|
282
|
-
"flickr.photos.removeTag" -> Flickrie.remove_photo_tag
|
283
|
-
"flickr.photos.search" -> Flickrie.search_photos
|
284
|
-
"flickr.photos.setContentType" -> Flickrie.set_photo_content_type
|
285
|
-
"flickr.photos.setDates" -> Flickrie.set_photo_dates
|
286
|
-
"flickr.photos.setMeta" -> Flickrie.set_photo_meta
|
287
|
-
"flickr.photos.setPerms" -> Flickrie.set_photo_permissions
|
288
|
-
"flickr.photos.setSafetyLevel" -> Flickrie.set_photo_safety_level
|
289
|
-
"flickr.photos.setTags" -> Flickrie.set_photo_tags
|
290
|
-
|
291
|
-
# photos.licenses
|
292
|
-
"flickr.photos.licenses.getInfo" -> Flickrie.get_licenses
|
293
|
-
"flickr.photos.licenses.setLicense" -> Flickrie.set_photo_license
|
294
|
-
|
295
|
-
# photos.upload
|
296
|
-
"flickr.photos.upload.checkTickets" -> Flickrie.check_upload_tickets
|
297
|
-
|
298
|
-
# photosets
|
299
|
-
"flickr.photosets.addPhoto" -> Flickrie.add_photo_to_set
|
300
|
-
"flickr.photosets.create" -> Flickrie.create_set
|
301
|
-
"flickr.photosets.delete" -> Flickrie.delete_set
|
302
|
-
"flickr.photosets.editMeta" -> Flickrie.edit_set_metadata
|
303
|
-
"flickr.photosets.editPhotos" -> Flickrie.edit_set_photos
|
304
|
-
"flickr.photosets.getContext" -> Flickrie.get_set_context
|
305
|
-
"flickr.photosets.getInfo" -> Flickrie.get_set_info
|
306
|
-
"flickr.photosets.getList" -> Flickrie.sets_from_user
|
307
|
-
"flickr.photosets.getPhotos" -> Flickrie.photos_from_set
|
308
|
-
"flickr.photosets.orderSets" -> Flickrie.order_sets
|
309
|
-
"flickr.photosets.removePhoto" -> Flickrie.remove_photos_from_set
|
310
|
-
"flickr.photosets.removePhotos" -> Flickrie.remove_photos_from_set
|
311
|
-
"flickr.photosets.reorderPhotos" -> Flickrie.reorder_photos_in_set
|
312
|
-
"flickr.photosets.setPrimaryPhoto" -> Flickrie.set_primary_photo_to_set
|
313
|
-
|
314
|
-
# test
|
315
|
-
"flickr.test.login" -> Flickrie.test_login
|
316
|
-
```
|
217
|
+
with getting started with Ruby, and with the basis of this gem.
|
317
218
|
|
318
219
|
## Changelog
|
319
220
|
|
@@ -321,7 +222,7 @@ You can see the changelog [here](https://github.com/janko-m/flickrie/blob/master
|
|
321
222
|
|
322
223
|
## Social
|
323
224
|
|
324
|
-
You can follow me on Twitter, I'm
|
225
|
+
You can follow me on Twitter, I'm [@jankomarohnic](https://twitter.com/jankomarohnic).
|
325
226
|
|
326
227
|
## License
|
327
228
|
|
data/lib/flickrie.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'flickrie/callable'
|
2
|
+
require 'flickrie/deprecatable'
|
3
|
+
require 'flickrie/flickr_api_methods'
|
2
4
|
|
3
5
|
module Flickrie
|
4
6
|
DEFAULTS = {
|
5
|
-
:
|
6
|
-
:
|
7
|
+
open_timeout: 3,
|
8
|
+
timeout: 4
|
7
9
|
}
|
8
10
|
|
9
11
|
class << self
|
@@ -65,7 +67,7 @@ module Flickrie
|
|
65
67
|
#
|
66
68
|
# Now let's assume you have a collection of photos
|
67
69
|
#
|
68
|
-
# @photos = Flickrie.photos_from_set(2734243, :
|
70
|
+
# @photos = Flickrie.photos_from_set(2734243, per_page: 20, page: params[:page])
|
69
71
|
#
|
70
72
|
# This collection is now paginated. You can now call in your ERB template:
|
71
73
|
#
|
@@ -94,8 +96,6 @@ module Flickrie
|
|
94
96
|
@client = @upload_client = nil
|
95
97
|
end
|
96
98
|
end
|
97
|
-
|
98
|
-
include Callable
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -106,6 +106,7 @@ module Flickrie
|
|
106
106
|
autoload :License, 'flickrie/objects/license'
|
107
107
|
autoload :User, 'flickrie/objects/user'
|
108
108
|
autoload :Media, 'flickrie/objects/media'
|
109
|
+
autoload :Comment, 'flickrie/objects/comment'
|
109
110
|
autoload :Photo, 'flickrie/objects/photo'
|
110
111
|
autoload :Video, 'flickrie/objects/video'
|
111
112
|
autoload :Set, 'flickrie/objects/set'
|
@@ -119,4 +120,8 @@ module Flickrie
|
|
119
120
|
autoload :Base58, 'flickrie/base58'
|
120
121
|
|
121
122
|
extend ApiMethods
|
123
|
+
|
124
|
+
def self.lookup_method(method)
|
125
|
+
FLICKR_API_METHODS[method]
|
126
|
+
end
|
122
127
|
end
|
data/lib/flickrie/api_methods.rb
CHANGED
@@ -1,21 +1,25 @@
|
|
1
1
|
module Flickrie
|
2
2
|
module ApiMethods
|
3
|
+
|
4
|
+
include Callable
|
5
|
+
extend Deprecatable
|
6
|
+
|
3
7
|
# For uploading photos and videos to Flickr. Example:
|
4
8
|
#
|
5
9
|
# path = File.expand_path("photo.jpg")
|
6
|
-
# photo_id = Flickrie.upload(path, :
|
10
|
+
# photo_id = Flickrie.upload(path, title: "Me and Jessica", description: "...")
|
7
11
|
# photo = Flickrie.get_photo_info(photo_id)
|
8
12
|
# photo.title # => "Me and Jessica"
|
9
13
|
#
|
10
|
-
# If the
|
14
|
+
# If the `async: 1` option is passed, returns the ticket ID (see {#check\_upload\_tickets}).
|
11
15
|
#
|
12
16
|
# @param media [File, String] A file or a path to the file you want to upload
|
13
17
|
# @param params [Hash] Options for uploading (see [this page](http://www.flickr.com/services/api/upload.api.html))
|
14
|
-
# @return [String] New photo's ID, or ticket's ID, if
|
18
|
+
# @return [String] New photo's ID, or ticket's ID, if `async: 1` is passed
|
15
19
|
#
|
16
20
|
# @note This method requires authentication with "write" permissions.
|
17
21
|
def upload(media, params = {})
|
18
|
-
response =
|
22
|
+
response = make_request(media, params)
|
19
23
|
if params[:async] == 1
|
20
24
|
response.body['rsp']['ticketid']
|
21
25
|
else
|
@@ -29,16 +33,16 @@ module Flickrie
|
|
29
33
|
# photo_id = 42374 # ID of the photo to be replaced
|
30
34
|
# id = Flickrie.replace(path, photo_id)
|
31
35
|
#
|
32
|
-
# If the
|
36
|
+
# If the `async: 1` option is passed, returns the ticket ID (see {#check\_upload\_tickets}).
|
33
37
|
#
|
34
38
|
# @param media [File, String] A file or a path to the file you want to upload
|
35
39
|
# @param media_id [String, Fixnum] The ID of the photo/video to be replaced
|
36
40
|
# @param params [Hash] Options for replacing (see [this page](http://www.flickr.com/services/api/replace.api.html))
|
37
|
-
# @return [String] New photo's ID, or ticket's ID, if
|
41
|
+
# @return [String] New photo's ID, or ticket's ID, if `async: 1` is passed
|
38
42
|
#
|
39
43
|
# @note This method requires authentication with "write" permissions.
|
40
44
|
def replace(media, media_id, params = {})
|
41
|
-
response =
|
45
|
+
response = make_request(media, media_id, params)
|
42
46
|
if params[:async] == 1
|
43
47
|
response.body['rsp']['ticketid']
|
44
48
|
else
|
@@ -48,116 +52,113 @@ module Flickrie
|
|
48
52
|
|
49
53
|
# Fetches the Flickr user with the given email.
|
50
54
|
#
|
51
|
-
# @param email [String]
|
52
55
|
# @return [Flickrie::User]
|
53
56
|
# @api_method [flickr.people.findByEmail](http://www.flickr.com/services/api/flickr.people.findByEmail.html)
|
54
57
|
def find_user_by_email(email, params = {})
|
55
|
-
response =
|
58
|
+
response = make_request(email, params)
|
56
59
|
User.new(response.body['user'], self)
|
57
60
|
end
|
58
61
|
|
59
62
|
# Fetches the Flickr user with the given username.
|
60
63
|
#
|
61
|
-
# @param username [String]
|
62
64
|
# @return [Flickrie::User]
|
63
65
|
# @api_method [flickr.people.findByUsername](http://www.flickr.com/services/api/flickr.people.findByUsername.html)
|
64
66
|
def find_user_by_username(username, params = {})
|
65
|
-
response =
|
67
|
+
response = make_request(username, params)
|
66
68
|
User.new(response.body['user'], self)
|
67
69
|
end
|
68
70
|
|
69
71
|
# Fetches photos and videos from the Flickr user with the given NSID.
|
70
72
|
#
|
71
|
-
# @param nsid [String]
|
72
73
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
73
74
|
# @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
|
74
75
|
#
|
75
76
|
# @note This method requires authentication with "read" permissions.
|
76
|
-
def
|
77
|
-
response =
|
77
|
+
def get_media_from_user(nsid, params = {})
|
78
|
+
response = make_request(nsid, params)
|
78
79
|
Media.new_collection(response.body['photos'], self)
|
79
80
|
end
|
81
|
+
deprecated_alias :media_from_user, :get_media_from_user
|
80
82
|
# Fetches photos from the Flickr user with the given NSID.
|
81
83
|
#
|
82
|
-
# @param nsid [String]
|
83
84
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
84
85
|
# @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
|
85
86
|
#
|
86
87
|
# @note This method requires authentication with "read" permissions.
|
87
|
-
def
|
88
|
-
|
88
|
+
def get_photos_from_user(nsid, params = {})
|
89
|
+
get_media_from_user(nsid, params).select { |media| media.is_a?(Photo) }
|
89
90
|
end
|
91
|
+
deprecated_alias :photos_from_user, :get_photos_from_user
|
90
92
|
# Fetches videos from the Flickr user with the given NSID.
|
91
93
|
#
|
92
|
-
# @param nsid [String]
|
93
94
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
94
95
|
# @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
|
95
96
|
#
|
96
97
|
# @note This method requires authentication with "read" permissions.
|
97
|
-
def
|
98
|
-
|
98
|
+
def get_videos_from_user(nsid, params = {})
|
99
|
+
get_media_from_user(nsid, params).select { |media| media.is_a?(Video) }
|
99
100
|
end
|
101
|
+
deprecated_alias :videos_from_user, :get_videos_from_user
|
100
102
|
|
101
103
|
# Fetches photos and videos containing a Flickr user with the given NSID.
|
102
104
|
#
|
103
|
-
# @param nsid [String]
|
104
105
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
105
106
|
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
106
|
-
def
|
107
|
-
response =
|
107
|
+
def get_media_of_user(nsid, params = {})
|
108
|
+
response = make_request(nsid, params)
|
108
109
|
Media.new_collection(response.body['photos'], self)
|
109
110
|
end
|
111
|
+
deprecated_alias :media_of_user, :get_media_of_user
|
110
112
|
# Fetches photos containing a Flickr user with the given NSID.
|
111
113
|
#
|
112
|
-
# @param nsid [String]
|
113
114
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
114
115
|
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
115
|
-
def
|
116
|
-
|
116
|
+
def get_photos_of_user(nsid, params = {})
|
117
|
+
get_media_of_user(nsid, params).select { |media| media.is_a?(Photo) }
|
117
118
|
end
|
119
|
+
deprecated_alias :photos_of_user, :get_photos_of_user
|
118
120
|
# Fetches videos containing a Flickr user with the given NSID.
|
119
121
|
#
|
120
|
-
# @param nsid [String]
|
121
122
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
122
123
|
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
123
|
-
def
|
124
|
-
|
124
|
+
def get_videos_of_user(nsid, params = {})
|
125
|
+
get_media_of_user(nsid, params).select { |media| media.is_a?(Video) }
|
125
126
|
end
|
127
|
+
deprecated_alias :videos_of_user, :get_videos_of_user
|
126
128
|
|
127
129
|
# Fetches public photos and videos from the Flickr user with the given
|
128
130
|
# NSID.
|
129
131
|
#
|
130
|
-
# @param nsid [String]
|
131
132
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
132
133
|
# @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
|
133
|
-
def
|
134
|
-
response =
|
134
|
+
def get_public_media_from_user(nsid, params = {})
|
135
|
+
response = make_request(nsid, params)
|
135
136
|
Media.new_collection(response.body['photos'], self)
|
136
137
|
end
|
138
|
+
deprecated_alias :public_media_from_user, :get_public_media_from_user
|
137
139
|
# Fetches public photos from the Flickr user with the given NSID.
|
138
140
|
#
|
139
|
-
# @param nsid [String]
|
140
141
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
141
142
|
# @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
|
142
|
-
def
|
143
|
-
|
143
|
+
def get_public_photos_from_user(nsid, params = {})
|
144
|
+
get_public_media_from_user(nsid, params).select { |media| media.is_a?(Photo) }
|
144
145
|
end
|
146
|
+
deprecated_alias :public_photos_from_user, :get_public_photos_from_user
|
145
147
|
# Fetches public videos from the Flickr user with the given NSID.
|
146
148
|
#
|
147
|
-
# @param nsid [String]
|
148
149
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
149
150
|
# @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
|
150
|
-
def
|
151
|
-
|
151
|
+
def get_public_videos_from_user(nsid, params = {})
|
152
|
+
get_public_media_from_user(nsid, params).select { |media| media.is_a?(Video) }
|
152
153
|
end
|
154
|
+
deprecated_alias :public_videos_from_user, :get_public_videos_from_user
|
153
155
|
|
154
156
|
# Fetches the Flickr user with the given NSID.
|
155
157
|
#
|
156
|
-
# @param nsid [String]
|
157
158
|
# @return [Flickrie::User]
|
158
159
|
# @api_method [flickr.people.getInfo](http://www.flickr.com/services/api/flickr.people.getInfo.html)
|
159
160
|
def get_user_info(nsid, params = {})
|
160
|
-
response =
|
161
|
+
response = make_request(nsid, params)
|
161
162
|
User.new(response.body['person'], self)
|
162
163
|
end
|
163
164
|
|
@@ -169,34 +170,35 @@ module Flickrie
|
|
169
170
|
#
|
170
171
|
# @note This method requires authentication with "read" permissions.
|
171
172
|
def get_upload_status(params = {})
|
172
|
-
response =
|
173
|
+
response = make_request(params)
|
173
174
|
User.new(response.body['user'], self)
|
174
175
|
end
|
175
176
|
|
176
177
|
# Add tags to the photo/video with the given ID.
|
177
178
|
#
|
178
|
-
# @param media_id [String, Fixnum]
|
179
179
|
# @param tags [String] A space delimited string with tags
|
180
180
|
# @return [nil]
|
181
181
|
# @api_method [flickr.photos.addTags](http://www.flickr.com/services/api/flickr.photos.addTags.html)
|
182
182
|
#
|
183
183
|
# @note This method requires authentication with "write" permissions.
|
184
|
-
def
|
185
|
-
|
184
|
+
def tag_media(media_id, tags, params = {})
|
185
|
+
make_request(media_id, tags, params)
|
186
186
|
nil
|
187
187
|
end
|
188
|
-
|
189
|
-
alias
|
188
|
+
deprecated_alias :add_media_tags, :tag_media
|
189
|
+
alias tag_photo tag_media
|
190
|
+
deprecated_alias :add_photo_tags, :tag_photo
|
191
|
+
alias tag_video tag_media
|
192
|
+
deprecated_alias :add_video_tags, :tag_video
|
190
193
|
|
191
194
|
# Deletes the photo/video with the given ID.
|
192
195
|
#
|
193
|
-
# @param media_id [String, Fixnum]
|
194
196
|
# @return [nil]
|
195
197
|
# @api_method [flickr.photos.delete](http://www.flickr.com/services/api/flickr.photos.delete.html)
|
196
198
|
#
|
197
199
|
# @note This method requires authentication with "delete" permissions.
|
198
200
|
def delete_media(media_id, params = {})
|
199
|
-
|
201
|
+
make_request(media_id, params)
|
200
202
|
nil
|
201
203
|
end
|
202
204
|
alias delete_photo delete_media
|
@@ -204,69 +206,64 @@ module Flickrie
|
|
204
206
|
|
205
207
|
# Fetches photos and videos from contacts of the user who authenticated.
|
206
208
|
#
|
207
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
208
209
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
209
210
|
# @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
|
210
211
|
#
|
211
212
|
# @note This method requires authentication with "read" permissions.
|
212
|
-
def
|
213
|
-
response =
|
213
|
+
def get_media_from_contacts(params = {})
|
214
|
+
response = make_request(params)
|
214
215
|
Media.new_collection(response.body['photos'], self)
|
215
216
|
end
|
217
|
+
deprecated_alias :media_from_contacts, :get_media_from_contacts
|
216
218
|
# Fetches photos from contacts of the user who authenticated.
|
217
219
|
#
|
218
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
219
220
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
220
221
|
# @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
|
221
222
|
#
|
222
223
|
# @note This method requires authentication with "read" permissions.
|
223
|
-
def
|
224
|
-
|
224
|
+
def get_photos_from_contacts(params = {})
|
225
|
+
get_media_from_contacts(params).select { |media| media.is_a?(Photo) }
|
225
226
|
end
|
227
|
+
deprecated_alias :photos_from_contacts, :get_photos_from_contacts
|
226
228
|
# Fetches videos from contacts of the user who authenticated.
|
227
229
|
#
|
228
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
229
230
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
230
231
|
# @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
|
231
232
|
#
|
232
233
|
# @note This method requires authentication with "read" permissions.
|
233
|
-
def
|
234
|
-
|
234
|
+
def get_videos_from_contacts(params = {})
|
235
|
+
get_media_from_contacts(params).select { |media| media.is_a?(Video) }
|
235
236
|
end
|
237
|
+
deprecated_alias :videos_from_contacts, :get_videos_from_contacts
|
236
238
|
|
237
239
|
# Fetches public photos and videos from contacts of the user with the
|
238
240
|
# given NSID.
|
239
241
|
#
|
240
|
-
# @param nsid [String]
|
241
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
242
242
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
243
243
|
# @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
|
244
|
-
def
|
245
|
-
response =
|
244
|
+
def get_public_media_from_contacts(nsid, params = {})
|
245
|
+
response = make_request(nsid, params)
|
246
246
|
Media.new_collection(response.body['photos'], self)
|
247
247
|
end
|
248
|
+
deprecated_alias :public_media_from_user_contacts, :get_public_media_from_contacts
|
248
249
|
# Fetches public photos from contacts of the user with the
|
249
250
|
# given NSID.
|
250
251
|
#
|
251
|
-
# @param nsid [String]
|
252
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
253
252
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
254
253
|
# @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
|
255
|
-
def
|
256
|
-
|
257
|
-
select { |media| media.is_a?(Photo) }
|
254
|
+
def get_public_photos_from_contacts(nsid, params = {})
|
255
|
+
get_public_media_from_contacts(nsid, params).select { |media| media.is_a?(Photo) }
|
258
256
|
end
|
257
|
+
deprecated_alias :public_photos_from_user_contacts, :get_public_photos_from_contacts
|
259
258
|
# Fetches public videos from contacts of the user with the
|
260
259
|
# given NSID.
|
261
260
|
#
|
262
|
-
# @param nsid [String]
|
263
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
264
261
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
265
262
|
# @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
|
266
|
-
def
|
267
|
-
|
268
|
-
select { |media| media.is_a?(Video) }
|
263
|
+
def get_public_videos_from_contacts(nsid, params = {})
|
264
|
+
get_public_media_from_contacts(nsid, params).select { |media| media.is_a?(Video) }
|
269
265
|
end
|
266
|
+
deprecated_alias :public_videos_from_user_contacts, :get_public_videos_from_contacts
|
270
267
|
|
271
268
|
# Fetches context of the photo/video with the given ID. Example:
|
272
269
|
#
|
@@ -275,11 +272,10 @@ module Flickrie
|
|
275
272
|
# context.previous # => #<Photo: id=2433240, ...>
|
276
273
|
# context.next # => #<Video: id=1282404, ...>
|
277
274
|
#
|
278
|
-
# @
|
279
|
-
# @return [Struct]
|
275
|
+
# @return [Flickrie::MediaContext]
|
280
276
|
# @api_method [flickr.photos.getContext](http://www.flickr.com/services/api/flickr.photos.getContext.html)
|
281
277
|
def get_media_context(media_id, params = {})
|
282
|
-
response =
|
278
|
+
response = make_request(media_id, params)
|
283
279
|
MediaContext.new(response.body, self)
|
284
280
|
end
|
285
281
|
alias get_photo_context get_media_context
|
@@ -289,7 +285,7 @@ module Flickrie
|
|
289
285
|
#
|
290
286
|
# require 'date'
|
291
287
|
# dates = [DateTime.parse("3rd Jan 2011").to_time, DateTime.parse("11th Aug 2011").to_time]
|
292
|
-
# counts = Flickrie.get_media_counts(:
|
288
|
+
# counts = Flickrie.get_media_counts(taken_dates: dates.map(&:to_i).join(','))
|
293
289
|
#
|
294
290
|
# count = counts.first
|
295
291
|
# count.value # => 24
|
@@ -297,11 +293,10 @@ module Flickrie
|
|
297
293
|
# count.date_range.begin # => 2011-01-03 01:00:00 +0100
|
298
294
|
# count.from # => 2011-01-03 01:00:00 +0100
|
299
295
|
#
|
300
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
301
296
|
# @return [Flickrie::MediaCount]
|
302
297
|
# @api_method [flickr.photos.getCounts](http://www.flickr.com/services/api/flickr.photos.getCounts.html)
|
303
298
|
def get_media_counts(params = {})
|
304
|
-
response =
|
299
|
+
response = make_request(params)
|
305
300
|
MediaCount.new_collection(response.body['photocounts'])
|
306
301
|
end
|
307
302
|
alias get_photos_counts get_media_counts
|
@@ -312,15 +307,15 @@ module Flickrie
|
|
312
307
|
# photo = Flickrie.get_photo_exif(27234987)
|
313
308
|
# photo.exif.get('Model') # => 'Canon PowerShot G12'
|
314
309
|
#
|
315
|
-
# photo.exif.get('X-Resolution', :
|
316
|
-
# photo.exif.get('X-Resolution', :
|
310
|
+
# photo.exif.get('X-Resolution', data: 'raw') # => '180'
|
311
|
+
# photo.exif.get('X-Resolution', data: 'clean') # => '180 dpi'
|
317
312
|
# photo.exif.get('X-Resolution') # => '180 dpi'
|
318
313
|
#
|
319
314
|
# @param photo_id [String, Fixnum]
|
320
315
|
# @return [Flickrie::Photo]
|
321
316
|
# @api_method [flickr.photos.getExif](http://www.flickr.com/services/api/flickr.photos.getExif.html)
|
322
317
|
def get_photo_exif(photo_id, params = {})
|
323
|
-
response =
|
318
|
+
response = make_request(photo_id, params)
|
324
319
|
Photo.new(response.body['photo'], self)
|
325
320
|
end
|
326
321
|
# Fetches the exif for the video with the given ID. Example:
|
@@ -328,15 +323,15 @@ module Flickrie
|
|
328
323
|
# video = Flickrie.get_video_exif(27234987)
|
329
324
|
# video.exif.get('Model') # => 'Canon PowerShot G12'
|
330
325
|
#
|
331
|
-
# video.exif.get('X-Resolution', :
|
332
|
-
# video.exif.get('X-Resolution', :
|
326
|
+
# video.exif.get('X-Resolution', data: 'raw') # => '180'
|
327
|
+
# video.exif.get('X-Resolution', data: 'clean') # => '180 dpi'
|
333
328
|
# video.exif.get('X-Resolution') # => '180 dpi'
|
334
329
|
#
|
335
330
|
# @param video_id [String, Fixnum]
|
336
331
|
# @return [Flickrie::Video]
|
337
332
|
# @api_method [flickr.photos.getExif](http://www.flickr.com/services/api/flickr.photos.getExif.html)
|
338
333
|
def get_video_exif(video_id, params = {})
|
339
|
-
response =
|
334
|
+
response = make_request(video_id, params)
|
340
335
|
Video.new(response.body['photo'], self)
|
341
336
|
end
|
342
337
|
|
@@ -350,7 +345,7 @@ module Flickrie
|
|
350
345
|
# @return [Flickrie::Photo]
|
351
346
|
# @api_method [flickr.photos.getFavorites](http://www.flickr.com/services/api/flickr.photos.getFavorites.html)
|
352
347
|
def get_photo_favorites(photo_id, params = {})
|
353
|
-
response =
|
348
|
+
response = make_request(photo_id, params)
|
354
349
|
Photo.new(response.body['photo'], self)
|
355
350
|
end
|
356
351
|
# Fetches the list of users who favorited the video with the given ID.
|
@@ -363,7 +358,7 @@ module Flickrie
|
|
363
358
|
# @return [Flickrie::Video]
|
364
359
|
# @api_method [flickr.photos.getFavorites](http://www.flickr.com/services/api/flickr.photos.getFavorites.html)
|
365
360
|
def get_video_favorites(video_id, params = {})
|
366
|
-
response =
|
361
|
+
response = make_request(video_id, params)
|
367
362
|
Video.new(response.body['photo'], self)
|
368
363
|
end
|
369
364
|
|
@@ -373,7 +368,7 @@ module Flickrie
|
|
373
368
|
# @return [Flickrie::Photo, Flickrie::Video]
|
374
369
|
# @api_method [flickr.photos.getInfo](http://www.flickr.com/services/api/flickr.photos.getInfo.html)
|
375
370
|
def get_media_info(media_id, params = {})
|
376
|
-
response =
|
371
|
+
response = make_request(media_id, params)
|
377
372
|
Media.new(response.body['photo'], self)
|
378
373
|
end
|
379
374
|
alias get_photo_info get_media_info
|
@@ -386,10 +381,11 @@ module Flickrie
|
|
386
381
|
# @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
|
387
382
|
#
|
388
383
|
# @note This method requires authentication with "read" permissions.
|
389
|
-
def
|
390
|
-
response =
|
384
|
+
def get_media_not_in_set(params = {})
|
385
|
+
response = make_request({media: 'all'}.merge(params))
|
391
386
|
Media.new_collection(response.body['photos'], self)
|
392
387
|
end
|
388
|
+
deprecated_alias :media_not_in_set, :get_media_not_in_set
|
393
389
|
# Fetches photos from the authenticated user
|
394
390
|
# that are not in any set.
|
395
391
|
#
|
@@ -397,9 +393,10 @@ module Flickrie
|
|
397
393
|
# @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
|
398
394
|
#
|
399
395
|
# @note This method requires authentication with "read" permissions.
|
400
|
-
def
|
401
|
-
|
396
|
+
def get_photos_not_in_set(params = {})
|
397
|
+
get_media_not_in_set({media: "photos"}.merge(params))
|
402
398
|
end
|
399
|
+
deprecated_alias :photos_not_in_set, :get_photos_not_in_set
|
403
400
|
# Fetches videos from the authenticated user
|
404
401
|
# that are not in any set.
|
405
402
|
#
|
@@ -407,9 +404,10 @@ module Flickrie
|
|
407
404
|
# @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
|
408
405
|
#
|
409
406
|
# @note This method requires authentication with "read" permissions.
|
410
|
-
def
|
411
|
-
|
407
|
+
def get_videos_not_in_set(params = {})
|
408
|
+
get_media_not_in_set({media: "videos"}.merge(params))
|
412
409
|
end
|
410
|
+
deprecated_alias :videos_not_in_set, :get_videos_not_in_set
|
413
411
|
|
414
412
|
# Gets permissions of a photo with the given ID.
|
415
413
|
#
|
@@ -418,7 +416,7 @@ module Flickrie
|
|
418
416
|
#
|
419
417
|
# @note This method requires authentication with "read" permissions.
|
420
418
|
def get_photo_permissions(photo_id, params = {})
|
421
|
-
response =
|
419
|
+
response = make_request(photo_id, params)
|
422
420
|
Photo.new(response.body['perms'], self)
|
423
421
|
end
|
424
422
|
# Gets permissions of a video with the given ID.
|
@@ -428,7 +426,7 @@ module Flickrie
|
|
428
426
|
#
|
429
427
|
# @note This method requires authentication with "read" permissions.
|
430
428
|
def get_video_permissions(video_id, params = {})
|
431
|
-
response =
|
429
|
+
response = make_request(video_id, params)
|
432
430
|
Video.new(response.body['perms'], self)
|
433
431
|
end
|
434
432
|
|
@@ -437,7 +435,7 @@ module Flickrie
|
|
437
435
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
438
436
|
# @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
|
439
437
|
def get_recent_media(params = {})
|
440
|
-
response =
|
438
|
+
response = make_request(params)
|
441
439
|
Media.new_collection(response.body['photos'], self)
|
442
440
|
end
|
443
441
|
# Fetches the latest photos uploaded to Flickr.
|
@@ -466,7 +464,7 @@ module Flickrie
|
|
466
464
|
# @return [Flickrie::Photo]
|
467
465
|
# @api_method [flickr.photos.getSizes](http://www.flickr.com/services/api/flickr.photos.getSizes.html)
|
468
466
|
def get_photo_sizes(photo_id, params = {})
|
469
|
-
response =
|
467
|
+
response = make_request(photo_id, params)
|
470
468
|
Photo.new(response.body['sizes'], self)
|
471
469
|
end
|
472
470
|
# Fetches the sizes of the video with the given ID. Example:
|
@@ -478,7 +476,7 @@ module Flickrie
|
|
478
476
|
# @return [Flickrie::Video]
|
479
477
|
# @api_method [flickr.photos.getSizes](http://www.flickr.com/services/api/flickr.photos.getSizes.html)
|
480
478
|
def get_video_sizes(video_id, params = {})
|
481
|
-
response =
|
479
|
+
response = make_request(video_id, params)
|
482
480
|
Video.new(response.body['sizes'], self)
|
483
481
|
end
|
484
482
|
|
@@ -490,7 +488,7 @@ module Flickrie
|
|
490
488
|
#
|
491
489
|
# @note This method requires authentication with "read" permissions.
|
492
490
|
def get_untagged_media(params = {})
|
493
|
-
response =
|
491
|
+
response = make_request({media: 'all'}.merge(params))
|
494
492
|
Media.new_collection(response.body['photos'], self)
|
495
493
|
end
|
496
494
|
# Fetches photos from the authenticated user that have no tags.
|
@@ -500,7 +498,7 @@ module Flickrie
|
|
500
498
|
#
|
501
499
|
# @note This method requires authentication with "read" permissions.
|
502
500
|
def get_untagged_photos(params = {})
|
503
|
-
get_untagged_media({:
|
501
|
+
get_untagged_media({media: 'photos'}.merge(params))
|
504
502
|
end
|
505
503
|
# Fetches videos from the authenticated user that have no tags.
|
506
504
|
#
|
@@ -509,7 +507,7 @@ module Flickrie
|
|
509
507
|
#
|
510
508
|
# @note This method requires authentication with "read" permissions.
|
511
509
|
def get_untagged_videos(params = {})
|
512
|
-
get_untagged_media({:
|
510
|
+
get_untagged_media({media: 'videos'}.merge(params))
|
513
511
|
end
|
514
512
|
|
515
513
|
# Fetches geo-tagged photos and videos from the authenticated user.
|
@@ -519,7 +517,7 @@ module Flickrie
|
|
519
517
|
#
|
520
518
|
# @note This method requires authentication with "read" permissions.
|
521
519
|
def get_media_with_geo_data(params = {})
|
522
|
-
response =
|
520
|
+
response = make_request({media: 'all'}.merge(params))
|
523
521
|
Media.new_collection(response.body['photos'], self)
|
524
522
|
end
|
525
523
|
# Fetches geo-tagged photos from the authenticated user.
|
@@ -529,7 +527,7 @@ module Flickrie
|
|
529
527
|
#
|
530
528
|
# @note This method requires authentication with "read" permissions.
|
531
529
|
def get_photos_with_geo_data(params = {})
|
532
|
-
get_media_with_geo_data({:
|
530
|
+
get_media_with_geo_data({media: 'photos'}.merge(params))
|
533
531
|
end
|
534
532
|
# Fetches geo-tagged videos from the authenticated user.
|
535
533
|
#
|
@@ -538,7 +536,7 @@ module Flickrie
|
|
538
536
|
#
|
539
537
|
# @note This method requires authentication with "read" permissions.
|
540
538
|
def get_videos_with_geo_data(params = {})
|
541
|
-
get_media_with_geo_data({:
|
539
|
+
get_media_with_geo_data({media: 'videos'}.merge(params))
|
542
540
|
end
|
543
541
|
|
544
542
|
# Fetches photos and videos from the authenticated user that are not
|
@@ -549,7 +547,7 @@ module Flickrie
|
|
549
547
|
#
|
550
548
|
# @note This method requires authentication with "read" permissions.
|
551
549
|
def get_media_without_geo_data(params = {})
|
552
|
-
response =
|
550
|
+
response = make_request({media: 'all'}.merge(params))
|
553
551
|
Media.new_collection(response.body['photos'], self)
|
554
552
|
end
|
555
553
|
# Fetches photos from the authenticated user that are not geo-tagged.
|
@@ -559,7 +557,7 @@ module Flickrie
|
|
559
557
|
#
|
560
558
|
# @note This method requires authentication with "read" permissions.
|
561
559
|
def get_photos_without_geo_data(params = {})
|
562
|
-
get_media_with_geo_data({:
|
560
|
+
get_media_with_geo_data({media: 'photos'}.merge(params))
|
563
561
|
end
|
564
562
|
# Fetches videos from the authenticated user that are not geo-tagged.
|
565
563
|
#
|
@@ -568,7 +566,7 @@ module Flickrie
|
|
568
566
|
#
|
569
567
|
# @note This method requires authentication with "read" permissions.
|
570
568
|
def get_videos_without_geo_data(params = {})
|
571
|
-
get_media_with_geo_data({:
|
569
|
+
get_media_with_geo_data({media: 'videos'}.merge(params))
|
572
570
|
end
|
573
571
|
|
574
572
|
# Fetches photos and videos from the authenticated user that have
|
@@ -578,28 +576,31 @@ module Flickrie
|
|
578
576
|
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
579
577
|
#
|
580
578
|
# @note This method requires authentication with "read" permissions.
|
581
|
-
def
|
582
|
-
response =
|
579
|
+
def get_recently_updated_media(params = {})
|
580
|
+
response = make_request(params)
|
583
581
|
Media.new_collection(response.body['photos'], self)
|
584
582
|
end
|
583
|
+
deprecated_alias :recently_updated_media, :get_recently_updated_media
|
585
584
|
# Fetches photos from the authenticated user that have recently been updated.
|
586
585
|
#
|
587
586
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
588
587
|
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
589
588
|
#
|
590
589
|
# @note This method requires authentication with "read" permissions.
|
591
|
-
def
|
590
|
+
def get_recently_updated_photos(params = {})
|
592
591
|
recently_updated_media(params).select { |media| media.is_a?(Photo) }
|
593
592
|
end
|
593
|
+
deprecated_alias :recently_updated_photos, :get_recently_updated_photos
|
594
594
|
# Fetches videos from the authenticated user that have recently been updated.
|
595
595
|
#
|
596
596
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
597
597
|
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
598
598
|
#
|
599
599
|
# @note This method requires authentication with "read" permissions.
|
600
|
-
def
|
600
|
+
def get_recently_updated_videos(params = {})
|
601
601
|
recently_updated_media(params).select { |media| media.is_a?(Video) }
|
602
602
|
end
|
603
|
+
deprecated_alias :recently_updated_videos, :get_recently_updated_videos
|
603
604
|
|
604
605
|
# Remove the tag with the given ID
|
605
606
|
#
|
@@ -608,19 +609,22 @@ module Flickrie
|
|
608
609
|
# @api_method [flickr.photos.removeTag](http://www.flickr.com/services/api/flickr.photos.removeTag.html)
|
609
610
|
#
|
610
611
|
# @note This method requires authentication with "write" permissions.
|
611
|
-
def
|
612
|
-
|
612
|
+
def untag_media(tag_id, params = {})
|
613
|
+
make_request(tag_id, params)
|
613
614
|
nil
|
614
615
|
end
|
615
|
-
|
616
|
-
alias
|
616
|
+
deprecated_alias :remove_media_tag, :untag_media
|
617
|
+
alias untag_photo untag_media
|
618
|
+
deprecated_alias :remove_photo_tag, :untag_photo
|
619
|
+
alias untag_video untag_media
|
620
|
+
deprecated_alias :remove_video_tag, :untag_video
|
617
621
|
|
618
622
|
# Fetches photos and videos matching a certain criteria.
|
619
623
|
#
|
620
624
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
621
625
|
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
622
626
|
def search_media(params = {})
|
623
|
-
response =
|
627
|
+
response = make_request({media: 'all'}.merge(params))
|
624
628
|
Media.new_collection(response.body['photos'], self)
|
625
629
|
end
|
626
630
|
# Fetches photos matching a certain criteria.
|
@@ -628,14 +632,14 @@ module Flickrie
|
|
628
632
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
629
633
|
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
630
634
|
def search_photos(params = {})
|
631
|
-
search_media({:
|
635
|
+
search_media({media: 'photos'}.merge(params))
|
632
636
|
end
|
633
637
|
# Fetches videos matching a certain criteria.
|
634
638
|
#
|
635
639
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
636
640
|
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
637
641
|
def search_videos(params = {})
|
638
|
-
search_media({:
|
642
|
+
search_media({media: 'videos'}.merge(params))
|
639
643
|
end
|
640
644
|
|
641
645
|
# Sets the content type of a photo/video.
|
@@ -647,7 +651,7 @@ module Flickrie
|
|
647
651
|
#
|
648
652
|
# @note This method requires authentication with "write" permissions.
|
649
653
|
def set_media_content_type(media_id, content_type, params = {})
|
650
|
-
|
654
|
+
make_request(media_id, content_type, params)
|
651
655
|
nil
|
652
656
|
end
|
653
657
|
alias set_photo_content_type set_media_content_type
|
@@ -661,7 +665,7 @@ module Flickrie
|
|
661
665
|
#
|
662
666
|
# @note This method requires authentication with "write" permissions.
|
663
667
|
def set_media_dates(media_id, params = {})
|
664
|
-
|
668
|
+
make_request(media_id, params)
|
665
669
|
nil
|
666
670
|
end
|
667
671
|
alias set_photo_dates set_media_dates
|
@@ -675,7 +679,7 @@ module Flickrie
|
|
675
679
|
#
|
676
680
|
# @note This method requires authentication with "write" permissions.
|
677
681
|
def set_media_meta(media_id, params = {})
|
678
|
-
|
682
|
+
make_request(media_id, params)
|
679
683
|
nil
|
680
684
|
end
|
681
685
|
alias set_photo_meta set_media_meta
|
@@ -689,7 +693,7 @@ module Flickrie
|
|
689
693
|
#
|
690
694
|
# @note This method requires authentication with "write" permissions.
|
691
695
|
def set_media_permissions(media_id, params = {})
|
692
|
-
|
696
|
+
make_request(media_id, params)
|
693
697
|
nil
|
694
698
|
end
|
695
699
|
alias set_photo_permissions set_media_permissions
|
@@ -703,7 +707,7 @@ module Flickrie
|
|
703
707
|
#
|
704
708
|
# @note This method requires authentication with "write" permissions.
|
705
709
|
def set_media_safety_level(media_id, params = {})
|
706
|
-
|
710
|
+
make_request(media_id, params)
|
707
711
|
nil
|
708
712
|
end
|
709
713
|
alias set_photo_safety_level set_media_safety_level
|
@@ -711,24 +715,106 @@ module Flickrie
|
|
711
715
|
|
712
716
|
# Sets tags for a photo/video.
|
713
717
|
#
|
714
|
-
# @param
|
718
|
+
# @param tags [String] A space-delimited string with tags
|
715
719
|
# @return [nil]
|
716
720
|
# @api_method [flickr.photos.setTags](http://www.flickr.com/services/api/flickr.photos.setTags.html)
|
717
721
|
#
|
718
722
|
# @note This method requires authentication with "write" permissions.
|
719
723
|
def set_media_tags(media_id, tags, params = {})
|
720
|
-
|
724
|
+
make_request(media_id, tags, params)
|
721
725
|
nil
|
722
726
|
end
|
723
727
|
alias set_photo_tags set_media_tags
|
724
728
|
alias set_video_tags set_media_tags
|
725
729
|
|
730
|
+
# Comment on a photo/video.
|
731
|
+
#
|
732
|
+
# @return [String] Comment's ID
|
733
|
+
# @api_method [flickr.photos.comments.addComment](http://www.flickr.com/services/api/flickr.photos.comments.addComment.html)
|
734
|
+
#
|
735
|
+
# @note This method requires authentication with "write" permissions.
|
736
|
+
def comment_media(media_id, comment, params = {})
|
737
|
+
response = make_request(media_id, comment, params)
|
738
|
+
response.body["comment"]["id"]
|
739
|
+
end
|
740
|
+
alias comment_photo comment_media
|
741
|
+
alias comment_video comment_media
|
742
|
+
|
743
|
+
# Delete a comment.
|
744
|
+
#
|
745
|
+
# @return [nil]
|
746
|
+
# @api_method [flickr.photos.comments.deleteComment](http://www.flickr.com/services/api/flickr.photos.comments.deleteComment.html)
|
747
|
+
#
|
748
|
+
# @note This method requires authentication with "write" permissions.
|
749
|
+
def delete_media_comment(comment_id, params = {})
|
750
|
+
make_request(comment_id, params)
|
751
|
+
nil
|
752
|
+
end
|
753
|
+
alias delete_photo_comment delete_media_comment
|
754
|
+
alias delete_video_comment delete_media_comment
|
755
|
+
|
756
|
+
# Edit a specific comment.
|
757
|
+
#
|
758
|
+
# @return [nil]
|
759
|
+
# @api_method [flickr.photos.comments.editComment](http://www.flickr.com/services/api/flickr.photos.comments.editComment.html)
|
760
|
+
#
|
761
|
+
# @note This method requires authentication with "write" permissions.
|
762
|
+
def edit_media_comment(comment_id, comment, params = {})
|
763
|
+
make_request(comment_id, comment, params)
|
764
|
+
nil
|
765
|
+
end
|
766
|
+
alias edit_photo_comment edit_media_comment
|
767
|
+
alias edit_video_comment edit_media_comment
|
768
|
+
|
769
|
+
# Get list of comments of a photo/video.
|
770
|
+
#
|
771
|
+
# @return [Array<Flickrie::Comment>]
|
772
|
+
# @api_method [flickr.photos.comments.getList](http://www.flickr.com/services/api/flickr.photos.comments.getList.html)
|
773
|
+
def get_media_comments(media_id, params = {})
|
774
|
+
response = make_request(media_id, params)
|
775
|
+
response.body["comments"]["comment"].map { |hash| Flickrie::Comment.new(hash, self) }
|
776
|
+
end
|
777
|
+
alias get_photo_comments get_media_comments
|
778
|
+
alias get_video_comments get_media_comments
|
779
|
+
|
780
|
+
# Get list of photos/videos that have been recently commented by
|
781
|
+
# the contacts of the authenticated user.
|
782
|
+
#
|
783
|
+
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
784
|
+
# @api_method [flickr.photos.comments.getRecentForContacts](http://www.flickr.com/services/api/flickr.photos.comments.getRecentForContacts.html)
|
785
|
+
#
|
786
|
+
# @note This method requires authentication with "read" permissions.
|
787
|
+
def get_recently_commented_media_from_contacts(params = {})
|
788
|
+
response = make_request(params)
|
789
|
+
Media.new_collection(response.body["photos"], self)
|
790
|
+
end
|
791
|
+
# Get list of photos that have been recently commented by
|
792
|
+
# the contacts of the authenticated user.
|
793
|
+
#
|
794
|
+
# @return [Flickrie::Collection<Flickrie::Photo>]
|
795
|
+
# @api_method [flickr.photos.comments.getRecentForContacts](http://www.flickr.com/services/api/flickr.photos.comments.getRecentForContacts.html)
|
796
|
+
#
|
797
|
+
# @note This method requires authentication with "read" permissions.
|
798
|
+
def get_recently_commented_photos_from_contacts(params = {})
|
799
|
+
get_recently_commented_media_from_contacts(params).select { |media| media.is_a?(Photo) }
|
800
|
+
end
|
801
|
+
# Get list of videos that have been recently commented by
|
802
|
+
# the contacts of the authenticated user.
|
803
|
+
#
|
804
|
+
# @return [Flickrie::Collection<Flickrie::Video>]
|
805
|
+
# @api_method [flickr.photos.comments.getRecentForContacts](http://www.flickr.com/services/api/flickr.photos.comments.getRecentForContacts.html)
|
806
|
+
#
|
807
|
+
# @note This method requires authentication with "read" permissions.
|
808
|
+
def get_recently_commented_videos_from_contacts(params = {})
|
809
|
+
get_recently_commented_media_from_contacts(params).select { |media| media.is_a?(Video) }
|
810
|
+
end
|
811
|
+
|
726
812
|
# Fetches all available types of licenses.
|
727
813
|
#
|
728
814
|
# @return [Array<Flickrie::License>]
|
729
815
|
# @api_method [flickr.photos.licenses.getInfo](http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html)
|
730
816
|
def get_licenses(params = {})
|
731
|
-
response =
|
817
|
+
response = make_request(params)
|
732
818
|
License.from_hash(response.body['licenses']['license'])
|
733
819
|
end
|
734
820
|
|
@@ -739,7 +825,7 @@ module Flickrie
|
|
739
825
|
#
|
740
826
|
# @note This method requires authentication with "write" permissions.
|
741
827
|
def set_media_license(media_id, license_id, params = {})
|
742
|
-
|
828
|
+
make_request(media_id, license_id, params)
|
743
829
|
nil
|
744
830
|
end
|
745
831
|
alias set_photo_license set_media_license
|
@@ -752,7 +838,7 @@ module Flickrie
|
|
752
838
|
#
|
753
839
|
# @note This method requires authentication with "write" permissions.
|
754
840
|
def rotate_media(media_id, degrees, params = {})
|
755
|
-
|
841
|
+
make_request(media_id, degrees, params)
|
756
842
|
nil
|
757
843
|
end
|
758
844
|
alias rotate_photo rotate_media
|
@@ -761,7 +847,7 @@ module Flickrie
|
|
761
847
|
# Fetches upload tickets with given IDs. Example:
|
762
848
|
#
|
763
849
|
# photo = File.open("...")
|
764
|
-
# ticket_id = Flickrie.upload(photo, :
|
850
|
+
# ticket_id = Flickrie.upload(photo, async: 1)
|
765
851
|
# sleep(10)
|
766
852
|
#
|
767
853
|
# ticket = Flickrie.check_upload_tickets(ticket_id)
|
@@ -774,7 +860,7 @@ module Flickrie
|
|
774
860
|
# @api_method [flickr.photos.upload.checkTickets](http://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html)
|
775
861
|
def check_upload_tickets(tickets, params = {})
|
776
862
|
ticket_ids = tickets.join(',') rescue tickets
|
777
|
-
response =
|
863
|
+
response = make_request(ticket_ids, params)
|
778
864
|
response.body['uploader']['ticket'].
|
779
865
|
map { |info| Ticket.new(info) }
|
780
866
|
end
|
@@ -787,7 +873,7 @@ module Flickrie
|
|
787
873
|
#
|
788
874
|
# @note This method requires authentication with "write" permissions.
|
789
875
|
def add_media_to_set(set_id, media_id, params = {})
|
790
|
-
|
876
|
+
make_request(set_id, media_id, params)
|
791
877
|
end
|
792
878
|
alias add_photo_to_set add_media_to_set
|
793
879
|
alias add_video_to_set add_media_to_set
|
@@ -799,7 +885,7 @@ module Flickrie
|
|
799
885
|
#
|
800
886
|
# @note This method requires authentication with "write" permissions.
|
801
887
|
def create_set(params = {})
|
802
|
-
response =
|
888
|
+
response = make_request(params)
|
803
889
|
Set.new(response.body['photoset'], self)
|
804
890
|
end
|
805
891
|
|
@@ -811,7 +897,7 @@ module Flickrie
|
|
811
897
|
#
|
812
898
|
# @note This method requires authentication with "write" permissions.
|
813
899
|
def delete_set(set_id, params = {})
|
814
|
-
|
900
|
+
make_request(set_id, params)
|
815
901
|
nil
|
816
902
|
end
|
817
903
|
|
@@ -823,7 +909,7 @@ module Flickrie
|
|
823
909
|
#
|
824
910
|
# @note This method requires authentication with "write" permissions.
|
825
911
|
def edit_set_metadata(set_id, params = {})
|
826
|
-
|
912
|
+
make_request(set_id, params)
|
827
913
|
nil
|
828
914
|
end
|
829
915
|
|
@@ -835,88 +921,87 @@ module Flickrie
|
|
835
921
|
#
|
836
922
|
# @note This method requires authentication with "write" permissions.
|
837
923
|
def edit_set_media(set_id, params = {})
|
838
|
-
|
924
|
+
make_request(set_id, params)
|
839
925
|
nil
|
840
926
|
end
|
841
927
|
alias edit_set_photos edit_set_media
|
842
928
|
alias edit_set_videos edit_set_media
|
843
929
|
|
844
930
|
# Returns next and previous photos/videos for a photo/video in a set
|
931
|
+
#
|
932
|
+
# @return [Flickrie::MediaContext]
|
933
|
+
# @api_method [flickr.photosets.getContext](http://www.flickr.com/services/api/flickr.photosets.getContext.html)
|
845
934
|
def get_set_context(set_id, media_id, params = {})
|
846
|
-
response =
|
935
|
+
response = make_request(set_id, media_id, params)
|
847
936
|
MediaContext.new(response.body, self)
|
848
937
|
end
|
849
938
|
|
850
939
|
# Fetches information about the set with the given ID.
|
851
940
|
#
|
852
|
-
# @param set_id [String, Fixnum]
|
853
941
|
# @return [Flickrie::Set]
|
854
942
|
# @api_method [flickr.photosets.getInfo](http://www.flickr.com/services/api/flickr.photosets.getInfo.html)
|
855
943
|
def get_set_info(set_id, params = {})
|
856
|
-
response =
|
944
|
+
response = make_request(set_id, params)
|
857
945
|
Set.new(response.body['photoset'], self)
|
858
946
|
end
|
859
947
|
|
860
948
|
# Fetches sets from a user with the given NSID.
|
861
949
|
#
|
862
|
-
# @param nsid [String]
|
863
950
|
# @return [Flickrie::Collection<Flickrie::Set>]
|
864
951
|
# @api_method [flickr.photosets.getList](http://www.flickr.com/services/api/flickr.photosets.getList.html)
|
865
|
-
def
|
866
|
-
response =
|
952
|
+
def get_sets_from_user(nsid, params = {})
|
953
|
+
response = make_request(nsid, params)
|
867
954
|
Set.new_collection(response.body['photosets'], self)
|
868
955
|
end
|
956
|
+
deprecated_alias :sets_from_user, :get_sets_from_user
|
869
957
|
|
870
958
|
# Fetches photos and videos from a set with the given ID.
|
871
959
|
#
|
872
|
-
# @param set_id [String]
|
873
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
874
960
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
875
961
|
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
876
|
-
def
|
877
|
-
response =
|
962
|
+
def get_media_from_set(set_id, params = {})
|
963
|
+
response = make_request(set_id, {media: 'all'}.merge(params))
|
878
964
|
Media.new_collection(response.body['photoset'], self)
|
879
965
|
end
|
966
|
+
deprecated_alias :media_from_set, :get_media_from_set
|
880
967
|
# Fetches photos from a set with the given ID.
|
881
968
|
#
|
882
|
-
# @param set_id [String]
|
883
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
884
969
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
885
970
|
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
886
|
-
def
|
887
|
-
|
971
|
+
def get_photos_from_set(set_id, params = {})
|
972
|
+
get_media_from_set(set_id, {media: 'photos'}.merge(params))
|
888
973
|
end
|
974
|
+
deprecated_alias :photos_from_set, :get_photos_from_set
|
889
975
|
# Fetches videos from a set with the given ID.
|
890
976
|
#
|
891
|
-
# @param set_id [String]
|
892
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
893
977
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
894
978
|
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
895
|
-
def
|
896
|
-
|
979
|
+
def get_videos_from_set(set_id, params = {})
|
980
|
+
get_media_from_set(set_id, {media: 'videos'}.merge(params))
|
897
981
|
end
|
982
|
+
deprecated_alias :videos_from_set, :get_videos_from_set
|
898
983
|
|
899
984
|
# Sets the order of sets belonging to the authenticated user.
|
900
985
|
#
|
901
|
-
# @param set_ids [String
|
986
|
+
# @param set_ids [String] A comma delimited list of set IDs
|
902
987
|
# @return [nil]
|
903
988
|
# @api_method [flickr.photosets.orderSets](http://www.flickr.com/services/api/flickr.photosets.orderSets.html)
|
904
989
|
#
|
905
990
|
# @note This method requires authentication with "write" permissions.
|
906
991
|
def order_sets(set_ids, params = {})
|
907
|
-
|
992
|
+
make_request(set_ids, params)
|
908
993
|
nil
|
909
994
|
end
|
910
995
|
|
911
996
|
# Removes photos/videos from a set.
|
912
997
|
#
|
913
|
-
# @param
|
914
|
-
# @
|
998
|
+
# @param media_ids [String] A comma delimited list of photo/video IDs
|
999
|
+
# @return [nil]
|
915
1000
|
# @api_method [flickr.photosets.removePhotos](http://www.flickr.com/services/api/flickr.photosets.removePhotos.html)
|
916
1001
|
#
|
917
1002
|
# @note This method requires authentication with "write" permissions.
|
918
1003
|
def remove_media_from_set(set_id, media_ids, params = {})
|
919
|
-
|
1004
|
+
make_request(set_id, media_ids, params)
|
920
1005
|
nil
|
921
1006
|
end
|
922
1007
|
alias remove_photos_from_set remove_media_from_set
|
@@ -924,13 +1009,13 @@ module Flickrie
|
|
924
1009
|
|
925
1010
|
# Reorders photos/videos inside a set.
|
926
1011
|
#
|
927
|
-
# @param
|
928
|
-
# @
|
1012
|
+
# @param media_ids [String] A comma delimited list of photo/video IDs
|
1013
|
+
# @return [nil]
|
929
1014
|
# @api_method [flickr.photosets.reorderPhotos](http://www.flickr.com/services/api/flickr.photosets.reorderPhotos.html)
|
930
1015
|
#
|
931
1016
|
# @note This method requires authentication with "write" permissions.
|
932
1017
|
def reorder_media_in_set(set_id, media_ids, params = {})
|
933
|
-
|
1018
|
+
make_request(set_id, media_ids, params)
|
934
1019
|
nil
|
935
1020
|
end
|
936
1021
|
alias reorder_photos_in_set reorder_media_in_set
|
@@ -938,17 +1023,28 @@ module Flickrie
|
|
938
1023
|
|
939
1024
|
# Sets set's primary photo/video.
|
940
1025
|
#
|
941
|
-
# @
|
942
|
-
# @param media_id [String]
|
1026
|
+
# @return [nil]
|
943
1027
|
# @api_method [flickr.photosets.setPrimaryPhoto](http://www.flickr.com/services/api/flickr.photosets.setPrimaryPhoto.html)
|
944
1028
|
#
|
945
1029
|
# @note This method requires authentication with "write" permissions.
|
946
|
-
def
|
947
|
-
|
1030
|
+
def set_set_primary_media(set_id, media_id, params = {})
|
1031
|
+
make_request(set_id, media_id, params)
|
948
1032
|
nil
|
949
1033
|
end
|
950
|
-
|
951
|
-
alias
|
1034
|
+
deprecated_alias :set_primary_media_to_set, :set_set_primary_media
|
1035
|
+
alias set_set_primary_photo set_set_primary_media
|
1036
|
+
deprecated_alias :set_primary_photo_to_set, :set_set_primary_photo
|
1037
|
+
alias set_set_primary_video set_set_primary_media
|
1038
|
+
deprecated_alias :set_primary_video_to_set, :set_set_primary_video
|
1039
|
+
|
1040
|
+
# Fetches the list of all API methods.
|
1041
|
+
#
|
1042
|
+
# @return [Array<String>]
|
1043
|
+
# @api_method [flickr.reflection.getMethods](http://www.flickr.com/services/api/flickr.reflection.getMethods.html)
|
1044
|
+
def get_methods(params = {})
|
1045
|
+
response = make_request(params)
|
1046
|
+
response.body["methods"]["method"]
|
1047
|
+
end
|
952
1048
|
|
953
1049
|
# Tests if the authentication was successful. If it was, it
|
954
1050
|
# returns info of the user who just authenticated.
|
@@ -958,8 +1054,19 @@ module Flickrie
|
|
958
1054
|
#
|
959
1055
|
# @note This method requires authentication with "read" permissions.
|
960
1056
|
def test_login(params = {})
|
961
|
-
response =
|
1057
|
+
response = make_request(params)
|
962
1058
|
User.new(response.body['user'], self)
|
963
1059
|
end
|
1060
|
+
|
1061
|
+
private
|
1062
|
+
|
1063
|
+
def make_request(*args)
|
1064
|
+
method = caller.first[/`.*'/][1..-2]
|
1065
|
+
if ["upload", "replace"].include?(method)
|
1066
|
+
upload_client.send(method, *args)
|
1067
|
+
else
|
1068
|
+
client.send(method, *args)
|
1069
|
+
end
|
1070
|
+
end
|
964
1071
|
end
|
965
1072
|
end
|