flickrie 1.5.0 → 1.5.1
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/README.md +1 -1
- data/lib/flickrie.rb +18 -92
- data/lib/flickrie/api_methods.rb +759 -11
- data/lib/flickrie/base58.rb +15 -0
- data/lib/flickrie/callable.rb +78 -0
- data/lib/flickrie/client.rb +25 -17
- data/lib/flickrie/instance.rb +10 -15
- data/lib/flickrie/middleware.rb +4 -21
- data/lib/flickrie/middleware/fix_flickr_data.rb +215 -0
- data/lib/flickrie/middleware/retry.rb +23 -0
- data/lib/flickrie/{license.rb → objects/license.rb} +0 -0
- data/lib/flickrie/{location.rb → objects/location.rb} +13 -13
- data/lib/flickrie/{media.rb → objects/media.rb} +30 -25
- data/lib/flickrie/{media → objects/media}/exif.rb +0 -0
- data/lib/flickrie/{media → objects/media}/note.rb +11 -12
- data/lib/flickrie/{media → objects/media}/tag.rb +10 -9
- data/lib/flickrie/objects/media/visibility.rb +28 -0
- data/lib/flickrie/objects/media_context.rb +17 -0
- data/lib/flickrie/objects/media_count.rb +46 -0
- data/lib/flickrie/{photo.rb → objects/photo.rb} +2 -3
- data/lib/flickrie/{set.rb → objects/set.rb} +9 -30
- data/lib/flickrie/{ticket.rb → objects/ticket.rb} +0 -0
- data/lib/flickrie/{user.rb → objects/user.rb} +10 -50
- data/lib/flickrie/{user → objects/user}/upload_status.rb +0 -0
- data/lib/flickrie/{video.rb → objects/video.rb} +3 -4
- data/lib/flickrie/version.rb +1 -1
- metadata +38 -37
- data/lib/flickrie/api_methods/media.rb +0 -698
- data/lib/flickrie/api_methods/set.rb +0 -23
- data/lib/flickrie/api_methods/user.rb +0 -45
- data/lib/flickrie/media/class_methods.rb +0 -217
- data/lib/flickrie/media/visibility.rb +0 -29
- data/lib/flickrie/media_count.rb +0 -54
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'date'
|
2
|
-
require 'flickrie/user/upload_status'
|
2
|
+
require 'flickrie/objects/user/upload_status'
|
3
3
|
|
4
4
|
module Flickrie
|
5
5
|
class User
|
@@ -72,38 +72,38 @@ module Flickrie
|
|
72
72
|
#
|
73
73
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
74
74
|
def public_photos(params = {})
|
75
|
-
|
75
|
+
@api_caller.public_photos_from_user(nsid || id, params)
|
76
76
|
end
|
77
77
|
# Same as calling `Flickrie.public_videos_from_user(user.nsid)`.
|
78
78
|
#
|
79
79
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
80
80
|
def public_videos(params = {})
|
81
|
-
|
81
|
+
@api_caller.public_videos_from_user(nsid || id, params)
|
82
82
|
end
|
83
83
|
# Same as calling `Flickrie.public_media_from_user(user.nsid)`.
|
84
84
|
#
|
85
85
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
86
86
|
def public_media(params = {})
|
87
|
-
|
87
|
+
@api_caller.public_media_from_user(nsid || id, params)
|
88
88
|
end
|
89
89
|
|
90
90
|
# Same as calling `Flickrie.photos_from_user(user.nsid)`.
|
91
91
|
#
|
92
92
|
# @return [Flickrie::Collection<Flickrie::Photo>]
|
93
93
|
def photos(params = {})
|
94
|
-
|
94
|
+
@api_caller.photos_from_user(nsid || id, params)
|
95
95
|
end
|
96
96
|
# Same as calling `Flickrie.videos_from_user(user.nsid)`.
|
97
97
|
#
|
98
98
|
# @return [Flickrie::Collection<Flickrie::Video>]
|
99
99
|
def videos(params = {})
|
100
|
-
|
100
|
+
@api_caller.videos_from_user(nsid || id, params)
|
101
101
|
end
|
102
102
|
# Same as calling `Flickrie.media_from_user(user.nsid)`.
|
103
103
|
#
|
104
104
|
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
105
105
|
def media(params = {})
|
106
|
-
|
106
|
+
@api_caller.media_from_user(nsid || id, params)
|
107
107
|
end
|
108
108
|
|
109
109
|
# @return [Boolean]
|
@@ -122,55 +122,15 @@ module Flickrie
|
|
122
122
|
#
|
123
123
|
# @return [self]
|
124
124
|
def get_info(params = {})
|
125
|
-
hash
|
126
|
-
self.class.fix_info(hash)
|
127
|
-
@hash.update(hash)
|
128
|
-
|
125
|
+
@hash.deep_merge!(@api_caller.get_user_info(nsid || id, params).hash)
|
129
126
|
self
|
130
127
|
end
|
131
128
|
|
132
129
|
private
|
133
130
|
|
134
|
-
def initialize(hash
|
135
|
-
raise ArgumentError if hash.nil?
|
136
|
-
|
131
|
+
def initialize(hash, api_caller)
|
137
132
|
@hash = hash
|
138
|
-
|
139
|
-
|
140
|
-
def self.from_info(hash)
|
141
|
-
fix_info(hash)
|
142
|
-
new(hash)
|
143
|
-
end
|
144
|
-
|
145
|
-
def self.from_find(hash)
|
146
|
-
hash['username'] = hash['username']['_content']
|
147
|
-
new(hash)
|
148
|
-
end
|
149
|
-
|
150
|
-
def self.from_test(hash)
|
151
|
-
from_find(hash)
|
152
|
-
end
|
153
|
-
|
154
|
-
def self.from_upload_status(hash)
|
155
|
-
hash['username'] = hash['username']['_content']
|
156
|
-
hash['upload_status'] = {
|
157
|
-
'bandwidth' => hash.delete('bandwidth'),
|
158
|
-
'filesize' => hash.delete('filesize'),
|
159
|
-
'sets' => hash.delete('sets'),
|
160
|
-
'videosize' => hash.delete('videosize'),
|
161
|
-
'videos' => hash.delete('videos')
|
162
|
-
}
|
163
|
-
new(hash)
|
164
|
-
end
|
165
|
-
|
166
|
-
def self.fix_info(hash)
|
167
|
-
%w[username realname location description profileurl
|
168
|
-
mobileurl photosurl].each do |attribute|
|
169
|
-
hash[attribute] = hash[attribute]['_content']
|
170
|
-
end
|
171
|
-
%w[count firstdatetaken firstdate].each do |photo_attribute|
|
172
|
-
hash['photos'][photo_attribute] = hash['photos'][photo_attribute]['_content']
|
173
|
-
end
|
133
|
+
@api_caller = api_caller
|
174
134
|
end
|
175
135
|
end
|
176
136
|
end
|
File without changes
|
@@ -32,8 +32,7 @@ module Flickrie
|
|
32
32
|
#
|
33
33
|
# @return [self]
|
34
34
|
def get_sizes(params = {})
|
35
|
-
|
36
|
-
@hash.deep_merge!(video.hash)
|
35
|
+
@hash.deep_merge!(@api_caller.get_video_sizes(id, params).hash)
|
37
36
|
@video = @hash['video']
|
38
37
|
self
|
39
38
|
end
|
@@ -49,9 +48,9 @@ module Flickrie
|
|
49
48
|
|
50
49
|
private
|
51
50
|
|
52
|
-
def initialize(
|
51
|
+
def initialize(*args)
|
53
52
|
super
|
54
|
-
@video = hash['video'] || {}
|
53
|
+
@video = @hash['video'] || {}
|
55
54
|
end
|
56
55
|
end
|
57
56
|
end
|
data/lib/flickrie/version.rb
CHANGED
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: 1.5.
|
4
|
+
version: 1.5.1
|
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-
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday_middleware
|
16
|
-
requirement: &
|
16
|
+
requirement: &70109122251160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: '0.9'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70109122251160
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: faraday
|
30
|
-
requirement: &
|
30
|
+
requirement: &70109122250400 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
version: '0.9'
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
|
-
version_requirements: *
|
41
|
+
version_requirements: *70109122250400
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: simple_oauth
|
44
|
-
requirement: &
|
44
|
+
requirement: &70109122249660 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
@@ -49,10 +49,10 @@ dependencies:
|
|
49
49
|
version: '0.1'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
|
-
version_requirements: *
|
52
|
+
version_requirements: *70109122249660
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: multi_xml
|
55
|
-
requirement: &
|
55
|
+
requirement: &70109122249180 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
58
|
- - ~>
|
@@ -60,10 +60,10 @@ dependencies:
|
|
60
60
|
version: '0.4'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
|
-
version_requirements: *
|
63
|
+
version_requirements: *70109122249180
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: bundler
|
66
|
-
requirement: &
|
66
|
+
requirement: &70109122248720 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ~>
|
@@ -71,10 +71,10 @@ dependencies:
|
|
71
71
|
version: '1.0'
|
72
72
|
type: :development
|
73
73
|
prerelease: false
|
74
|
-
version_requirements: *
|
74
|
+
version_requirements: *70109122248720
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rake
|
77
|
-
requirement: &
|
77
|
+
requirement: &70109122248260 !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
@@ -82,10 +82,10 @@ dependencies:
|
|
82
82
|
version: '0.9'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
|
-
version_requirements: *
|
85
|
+
version_requirements: *70109122248260
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: rspec
|
88
|
-
requirement: &
|
88
|
+
requirement: &70109122247780 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
@@ -96,10 +96,10 @@ dependencies:
|
|
96
96
|
version: '3'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
|
-
version_requirements: *
|
99
|
+
version_requirements: *70109122247780
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: vcr
|
102
|
-
requirement: &
|
102
|
+
requirement: &70109122247040 !ruby/object:Gem::Requirement
|
103
103
|
none: false
|
104
104
|
requirements:
|
105
105
|
- - ~>
|
@@ -107,40 +107,41 @@ dependencies:
|
|
107
107
|
version: '2.1'
|
108
108
|
type: :development
|
109
109
|
prerelease: false
|
110
|
-
version_requirements: *
|
110
|
+
version_requirements: *70109122247040
|
111
111
|
description: This gem wraps the Flickr API with a nice object-oriented interface.
|
112
112
|
email: janko.marohnic@gmail.com
|
113
113
|
executables: []
|
114
114
|
extensions: []
|
115
115
|
extra_rdoc_files: []
|
116
116
|
files:
|
117
|
-
- lib/flickrie/api_methods/media.rb
|
118
|
-
- lib/flickrie/api_methods/set.rb
|
119
|
-
- lib/flickrie/api_methods/user.rb
|
120
117
|
- lib/flickrie/api_methods.rb
|
118
|
+
- lib/flickrie/base58.rb
|
119
|
+
- lib/flickrie/callable.rb
|
121
120
|
- lib/flickrie/client.rb
|
122
121
|
- lib/flickrie/collection.rb
|
123
122
|
- lib/flickrie/core_ext.rb
|
124
123
|
- lib/flickrie/instance.rb
|
125
|
-
- lib/flickrie/
|
126
|
-
- lib/flickrie/
|
127
|
-
- lib/flickrie/media/class_methods.rb
|
128
|
-
- lib/flickrie/media/exif.rb
|
129
|
-
- lib/flickrie/media/note.rb
|
130
|
-
- lib/flickrie/media/tag.rb
|
131
|
-
- lib/flickrie/media/visibility.rb
|
132
|
-
- lib/flickrie/media.rb
|
133
|
-
- lib/flickrie/media_count.rb
|
124
|
+
- lib/flickrie/middleware/fix_flickr_data.rb
|
125
|
+
- lib/flickrie/middleware/retry.rb
|
134
126
|
- lib/flickrie/middleware.rb
|
135
127
|
- lib/flickrie/oauth.rb
|
136
|
-
- lib/flickrie/
|
137
|
-
- lib/flickrie/
|
138
|
-
- lib/flickrie/
|
128
|
+
- lib/flickrie/objects/license.rb
|
129
|
+
- lib/flickrie/objects/location.rb
|
130
|
+
- lib/flickrie/objects/media/exif.rb
|
131
|
+
- lib/flickrie/objects/media/note.rb
|
132
|
+
- lib/flickrie/objects/media/tag.rb
|
133
|
+
- lib/flickrie/objects/media/visibility.rb
|
134
|
+
- lib/flickrie/objects/media.rb
|
135
|
+
- lib/flickrie/objects/media_context.rb
|
136
|
+
- lib/flickrie/objects/media_count.rb
|
137
|
+
- lib/flickrie/objects/photo.rb
|
138
|
+
- lib/flickrie/objects/set.rb
|
139
|
+
- lib/flickrie/objects/ticket.rb
|
140
|
+
- lib/flickrie/objects/user/upload_status.rb
|
141
|
+
- lib/flickrie/objects/user.rb
|
142
|
+
- lib/flickrie/objects/video.rb
|
139
143
|
- lib/flickrie/upload_client.rb
|
140
|
-
- lib/flickrie/user/upload_status.rb
|
141
|
-
- lib/flickrie/user.rb
|
142
144
|
- lib/flickrie/version.rb
|
143
|
-
- lib/flickrie/video.rb
|
144
145
|
- lib/flickrie.rb
|
145
146
|
- README.md
|
146
147
|
- LICENSE
|
@@ -166,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
167
|
version: '0'
|
167
168
|
segments:
|
168
169
|
- 0
|
169
|
-
hash:
|
170
|
+
hash: 3993820191450085043
|
170
171
|
requirements: []
|
171
172
|
rubyforge_project:
|
172
173
|
rubygems_version: 1.8.11
|
@@ -1,698 +0,0 @@
|
|
1
|
-
module Flickrie
|
2
|
-
module ApiMethods
|
3
|
-
# Fetches photos and videos from the Flickr user with the given NSID.
|
4
|
-
#
|
5
|
-
# @param nsid [String]
|
6
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
7
|
-
# @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
|
8
|
-
#
|
9
|
-
# @note This method requires authentication with "read" permissions.
|
10
|
-
def media_from_user(nsid, params = {})
|
11
|
-
response = client.media_from_user(nsid, params)
|
12
|
-
Media.from_user(response.body['photos'])
|
13
|
-
end
|
14
|
-
# Fetches photos from the Flickr user with the given NSID.
|
15
|
-
#
|
16
|
-
# @param nsid [String]
|
17
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
18
|
-
# @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
|
19
|
-
#
|
20
|
-
# @note This method requires authentication with "read" permissions.
|
21
|
-
def photos_from_user(nsid, params = {})
|
22
|
-
media_from_user(nsid, params).select { |media| media.is_a?(Photo) }
|
23
|
-
end
|
24
|
-
# Fetches videos from the Flickr user with the given NSID.
|
25
|
-
#
|
26
|
-
# @param nsid [String]
|
27
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
28
|
-
# @api_method [flickr.people.getPhotos](http://www.flickr.com/services/api/flickr.people.getPhotos.html)
|
29
|
-
#
|
30
|
-
# @note This method requires authentication with "read" permissions.
|
31
|
-
def videos_from_user(nsid, params = {})
|
32
|
-
media_from_user(nsid, params).select { |media| media.is_a?(Video) }
|
33
|
-
end
|
34
|
-
|
35
|
-
# Fetches photos and videos containing a Flickr user with the given NSID.
|
36
|
-
#
|
37
|
-
# @param nsid [String]
|
38
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
39
|
-
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
40
|
-
def media_of_user(nsid, params = {})
|
41
|
-
response = client.media_of_user(nsid, params)
|
42
|
-
Media.of_user(response.body['photos'])
|
43
|
-
end
|
44
|
-
# Fetches photos containing a Flickr user with the given NSID.
|
45
|
-
#
|
46
|
-
# @param nsid [String]
|
47
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
48
|
-
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
49
|
-
def photos_of_user(nsid, params = {})
|
50
|
-
media_of_user(nsid, params).select { |media| media.is_a?(Photo) }
|
51
|
-
end
|
52
|
-
# Fetches videos containing a Flickr user with the given NSID.
|
53
|
-
#
|
54
|
-
# @param nsid [String]
|
55
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
56
|
-
# @api_method [flickr.people.getPhotosOf](http://www.flickr.com/services/api/flickr.people.getPhotosOf.html)
|
57
|
-
def videos_of_user(nsid, params = {})
|
58
|
-
media_of_user(nsid, params).select { |media| media.is_a?(Video) }
|
59
|
-
end
|
60
|
-
|
61
|
-
# Fetches public photos and videos from the Flickr user with the given
|
62
|
-
# NSID.
|
63
|
-
#
|
64
|
-
# @param nsid [String]
|
65
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
66
|
-
# @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
|
67
|
-
def public_media_from_user(nsid, params = {})
|
68
|
-
response = client.public_media_from_user(nsid, params)
|
69
|
-
Media.from_user(response.body['photos'])
|
70
|
-
end
|
71
|
-
# Fetches public photos from the Flickr user with the given NSID.
|
72
|
-
#
|
73
|
-
# @param nsid [String]
|
74
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
75
|
-
# @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
|
76
|
-
def public_photos_from_user(nsid, params = {})
|
77
|
-
public_media_from_user(nsid, params).select { |media| media.is_a?(Photo) }
|
78
|
-
end
|
79
|
-
# Fetches public videos from the Flickr user with the given NSID.
|
80
|
-
#
|
81
|
-
# @param nsid [String]
|
82
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
83
|
-
# @api_method [flickr.people.getPublicPhotos](http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html)
|
84
|
-
def public_videos_from_user(nsid, params = {})
|
85
|
-
public_media_from_user(nsid, params).select { |media| media.is_a?(Video) }
|
86
|
-
end
|
87
|
-
|
88
|
-
# Add tags to the photo/video with the given ID.
|
89
|
-
#
|
90
|
-
# @param media_id [String, Fixnum]
|
91
|
-
# @param tags [String] A space delimited string with tags
|
92
|
-
# @return [nil]
|
93
|
-
# @api_method [flickr.photos.addTags](http://www.flickr.com/services/api/flickr.photos.addTags.html)
|
94
|
-
#
|
95
|
-
# @note This method requires authentication with "write" permissions.
|
96
|
-
def add_media_tags(media_id, tags, params = {})
|
97
|
-
client.add_media_tags(media_id, tags, params)
|
98
|
-
nil
|
99
|
-
end
|
100
|
-
alias add_photo_tags add_media_tags
|
101
|
-
alias add_video_tags add_media_tags
|
102
|
-
|
103
|
-
# Deletes the photo/video with the given ID.
|
104
|
-
#
|
105
|
-
# @param media_id [String, Fixnum]
|
106
|
-
# @return [nil]
|
107
|
-
# @api_method [flickr.photos.delete](http://www.flickr.com/services/api/flickr.photos.delete.html)
|
108
|
-
#
|
109
|
-
# @note This method requires authentication with "delete" permissions.
|
110
|
-
def delete_media(media_id, params = {})
|
111
|
-
client.delete_media(media_id, params)
|
112
|
-
nil
|
113
|
-
end
|
114
|
-
alias delete_photo delete_media
|
115
|
-
alias delete_video delete_media
|
116
|
-
|
117
|
-
# Fetches photos and videos from contacts of the user who authenticated.
|
118
|
-
#
|
119
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
120
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
121
|
-
# @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
|
122
|
-
#
|
123
|
-
# @note This method requires authentication with "read" permissions.
|
124
|
-
def media_from_contacts(params = {})
|
125
|
-
response = client.media_from_contacts(params)
|
126
|
-
Media.from_contacts(response.body['photos'])
|
127
|
-
end
|
128
|
-
# Fetches photos from contacts of the user who authenticated.
|
129
|
-
#
|
130
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
131
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
132
|
-
# @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
|
133
|
-
#
|
134
|
-
# @note This method requires authentication with "read" permissions.
|
135
|
-
def photos_from_contacts(params = {})
|
136
|
-
media_from_contacts(params).select { |media| media.is_a?(Photo) }
|
137
|
-
end
|
138
|
-
# Fetches videos from contacts of the user who authenticated.
|
139
|
-
#
|
140
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
141
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
142
|
-
# @api_method [flickr.photos.getContactsPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html)
|
143
|
-
#
|
144
|
-
# @note This method requires authentication with "read" permissions.
|
145
|
-
def videos_from_contacts(params = {})
|
146
|
-
media_from_contacts(params).select { |media| media.is_a?(Video) }
|
147
|
-
end
|
148
|
-
|
149
|
-
# Fetches public photos and videos from contacts of the user with the
|
150
|
-
# given NSID.
|
151
|
-
#
|
152
|
-
# @param nsid [String]
|
153
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
154
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
155
|
-
# @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
|
156
|
-
def public_media_from_user_contacts(nsid, params = {})
|
157
|
-
response = client.public_media_from_user_contacts(nsid, params)
|
158
|
-
Media.from_contacts(response.body['photos'])
|
159
|
-
end
|
160
|
-
# Fetches public photos from contacts of the user with the
|
161
|
-
# given NSID.
|
162
|
-
#
|
163
|
-
# @param nsid [String]
|
164
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
165
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
166
|
-
# @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
|
167
|
-
def public_photos_from_user_contacts(nsid, params = {})
|
168
|
-
public_media_from_user_contacts(nsid, params).
|
169
|
-
select { |media| media.is_a?(Photo) }
|
170
|
-
end
|
171
|
-
# Fetches public videos from contacts of the user with the
|
172
|
-
# given NSID.
|
173
|
-
#
|
174
|
-
# @param nsid [String]
|
175
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
176
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
177
|
-
# @api_method [flickr.photos.getContactsPublicPhotos](http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html)
|
178
|
-
def public_videos_from_user_contacts(nsid, params = {})
|
179
|
-
public_media_from_user_contacts(nsid, params).
|
180
|
-
select { |media| media.is_a?(Video) }
|
181
|
-
end
|
182
|
-
|
183
|
-
# Fetches context of the photo/video with the given ID. Example:
|
184
|
-
#
|
185
|
-
# context = Flickrie.get_photo_context(37124234)
|
186
|
-
# context.count # => 23
|
187
|
-
# context.previous # => #<Photo: id=2433240, ...>
|
188
|
-
# context.next # => #<Video: id=1282404, ...>
|
189
|
-
#
|
190
|
-
# @param media_id [String, Fixnum]
|
191
|
-
# @return [Struct]
|
192
|
-
# @api_method [flickr.photos.getContext](http://www.flickr.com/services/api/flickr.photos.getContext.html)
|
193
|
-
def get_media_context(media_id, params = {})
|
194
|
-
response = client.get_media_context(media_id, params)
|
195
|
-
Media.from_context(response.body)
|
196
|
-
end
|
197
|
-
alias get_photo_context get_media_context
|
198
|
-
alias get_video_context get_media_context
|
199
|
-
|
200
|
-
# Fetches numbers of photos and videos for given date ranges. Example:
|
201
|
-
#
|
202
|
-
# require 'date'
|
203
|
-
# dates = [DateTime.parse("3rd Jan 2011").to_time, DateTime.parse("11th Aug 2011").to_time]
|
204
|
-
# counts = Flickrie.get_media_counts(:taken_dates => dates.map(&:to_i).join(','))
|
205
|
-
#
|
206
|
-
# count = counts.first
|
207
|
-
# count.value # => 24
|
208
|
-
# count.date_range # => 2011-01-03 01:00:00 +0100..2011-08-11 02:00:00 +0200
|
209
|
-
# count.date_range.begin # => 2011-01-03 01:00:00 +0100
|
210
|
-
# count.from # => 2011-01-03 01:00:00 +0100
|
211
|
-
#
|
212
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
213
|
-
# @return [Flickrie::MediaCount]
|
214
|
-
# @api_method [flickr.photos.getCounts](http://www.flickr.com/services/api/flickr.photos.getCounts.html)
|
215
|
-
def get_media_counts(params = {})
|
216
|
-
response = client.get_media_counts \
|
217
|
-
MediaCount.ensure_utc(params)
|
218
|
-
response.body['photocounts']['photocount'].
|
219
|
-
map { |info| MediaCount.new(info, params) }
|
220
|
-
end
|
221
|
-
alias get_photos_counts get_media_counts
|
222
|
-
alias get_videos_counts get_media_counts
|
223
|
-
|
224
|
-
# Fetches the exif for the photo with the given ID. Example:
|
225
|
-
#
|
226
|
-
# photo = Flickrie.get_photo_exif(27234987)
|
227
|
-
# photo.exif.get('Model') # => 'Canon PowerShot G12'
|
228
|
-
#
|
229
|
-
# photo.exif.get('X-Resolution', :data => 'raw') # => '180'
|
230
|
-
# photo.exif.get('X-Resolution', :data => 'clean') # => '180 dpi'
|
231
|
-
# photo.exif.get('X-Resolution') # => '180 dpi'
|
232
|
-
#
|
233
|
-
# @param photo_id [String, Fixnum]
|
234
|
-
# @return [Flickrie::Photo]
|
235
|
-
# @api_method [flickr.photos.getExif](http://www.flickr.com/services/api/flickr.photos.getExif.html)
|
236
|
-
def get_photo_exif(photo_id, params = {})
|
237
|
-
response = client.get_media_exif(photo_id, params)
|
238
|
-
Photo.new(response.body['photo'])
|
239
|
-
end
|
240
|
-
# Fetches the exif for the video with the given ID. Example:
|
241
|
-
#
|
242
|
-
# video = Flickrie.get_video_exif(27234987)
|
243
|
-
# video.exif.get('Model') # => 'Canon PowerShot G12'
|
244
|
-
#
|
245
|
-
# video.exif.get('X-Resolution', :data => 'raw') # => '180'
|
246
|
-
# video.exif.get('X-Resolution', :data => 'clean') # => '180 dpi'
|
247
|
-
# video.exif.get('X-Resolution') # => '180 dpi'
|
248
|
-
#
|
249
|
-
# @param video_id [String, Fixnum]
|
250
|
-
# @return [Flickrie::Video]
|
251
|
-
# @api_method [flickr.photos.getExif](http://www.flickr.com/services/api/flickr.photos.getExif.html)
|
252
|
-
def get_video_exif(video_id, params = {})
|
253
|
-
response = client.get_media_exif(video_id, params)
|
254
|
-
Video.new(response.body['photo'])
|
255
|
-
end
|
256
|
-
|
257
|
-
# Fetches the list of users who favorited the photo with the given ID.
|
258
|
-
# Example:
|
259
|
-
#
|
260
|
-
# photo = Flickrie.get_photo_favorites(24810948)
|
261
|
-
# photo.favorites.first.username # => "John Smith"
|
262
|
-
#
|
263
|
-
# @param photo_id [String, Fixnum]
|
264
|
-
# @return [Flickrie::Photo]
|
265
|
-
# @api_method [flickr.photos.getFavorites](http://www.flickr.com/services/api/flickr.photos.getFavorites.html)
|
266
|
-
def get_photo_favorites(photo_id, params = {})
|
267
|
-
response = client.get_media_favorites(photo_id, params)
|
268
|
-
Photo.new(response.body['photo'])
|
269
|
-
end
|
270
|
-
# Fetches the list of users who favorited the video with the given ID.
|
271
|
-
# Example:
|
272
|
-
#
|
273
|
-
# video = Flickrie.get_video_favorites(24810948)
|
274
|
-
# video.favorites.first.username # => "John Smith"
|
275
|
-
#
|
276
|
-
# @param video_id [String, Fixnum]
|
277
|
-
# @return [Flickrie::Video]
|
278
|
-
# @api_method [flickr.photos.getFavorites](http://www.flickr.com/services/api/flickr.photos.getFavorites.html)
|
279
|
-
def get_video_favorites(video_id, params = {})
|
280
|
-
response = client.get_media_favorites(video_id, params)
|
281
|
-
Video.new(response.body['photo'])
|
282
|
-
end
|
283
|
-
|
284
|
-
# Fetches info of the photo/video with the given ID.
|
285
|
-
#
|
286
|
-
# @param media_id [String, Fixnum]
|
287
|
-
# @return [Flickrie::Photo, Flickrie::Video]
|
288
|
-
# @api_method [flickr.photos.getInfo](http://www.flickr.com/services/api/flickr.photos.getInfo.html)
|
289
|
-
def get_media_info(media_id, params = {})
|
290
|
-
response = client.get_media_info(media_id, params)
|
291
|
-
Media.from_info(response.body['photo'])
|
292
|
-
end
|
293
|
-
alias get_photo_info get_media_info
|
294
|
-
alias get_video_info get_media_info
|
295
|
-
|
296
|
-
# Fetches photos and videos from the authenticated user
|
297
|
-
# that are not in any set.
|
298
|
-
#
|
299
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
300
|
-
# @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
|
301
|
-
#
|
302
|
-
# @note This method requires authentication with "read" permissions.
|
303
|
-
def media_not_in_set(params = {})
|
304
|
-
response = client.media_not_in_set({:media => 'all'}.merge(params))
|
305
|
-
Media.from_not_in_set(response.body['photos'])
|
306
|
-
end
|
307
|
-
# Fetches photos from the authenticated user
|
308
|
-
# that are not in any set.
|
309
|
-
#
|
310
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
311
|
-
# @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
|
312
|
-
#
|
313
|
-
# @note This method requires authentication with "read" permissions.
|
314
|
-
def photos_not_in_set(params = {})
|
315
|
-
media_not_in_set({:media => "photos"}.merge(params))
|
316
|
-
end
|
317
|
-
# Fetches videos from the authenticated user
|
318
|
-
# that are not in any set.
|
319
|
-
#
|
320
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
321
|
-
# @api_method [flickr.photos.getNotInSet](http://www.flickr.com/services/api/flickr.photos.getNotInSet.html)
|
322
|
-
#
|
323
|
-
# @note This method requires authentication with "read" permissions.
|
324
|
-
def videos_not_in_set(params = {})
|
325
|
-
media_not_in_set({:media => "videos"}.merge(params))
|
326
|
-
end
|
327
|
-
|
328
|
-
# Gets permissions of a photo with the given ID.
|
329
|
-
#
|
330
|
-
# @return [Flickrie::Photo]
|
331
|
-
# @api_method [flickr.photos.getPerms](http://www.flickr.com/services/api/flickr.photos.getPerms.html)
|
332
|
-
#
|
333
|
-
# @note This method requires authentication with "read" permissions.
|
334
|
-
def get_photo_permissions(photo_id, params = {})
|
335
|
-
response = client.get_media_permissions(photo_id, params)
|
336
|
-
Photo.from_perms(response.body['perms'])
|
337
|
-
end
|
338
|
-
# Gets permissions of a video with the given ID.
|
339
|
-
#
|
340
|
-
# @return [Flickrie::Video]
|
341
|
-
# @api_method [flickr.photos.getPerms](http://www.flickr.com/services/api/flickr.photos.getPerms.html)
|
342
|
-
#
|
343
|
-
# @note This method requires authentication with "read" permissions.
|
344
|
-
def get_video_permissions(video_id, params = {})
|
345
|
-
response = client.get_media_permissions(video_id, params)
|
346
|
-
Video.from_perms(response.body['perms'])
|
347
|
-
end
|
348
|
-
|
349
|
-
# Fetches the latest photos and videos uploaded to Flickr.
|
350
|
-
#
|
351
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
352
|
-
# @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
|
353
|
-
def get_recent_media(params = {})
|
354
|
-
response = client.get_recent_media(params)
|
355
|
-
Media.from_recent(response.body['photos'])
|
356
|
-
end
|
357
|
-
# Fetches the latest photos uploaded to Flickr.
|
358
|
-
#
|
359
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
360
|
-
# @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
|
361
|
-
def get_recent_photos(params = {})
|
362
|
-
get_recent_media(params).select { |media| media.is_a?(Photo) }
|
363
|
-
end
|
364
|
-
# Fetches the latest videos uploaded to Flickr.
|
365
|
-
#
|
366
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
367
|
-
# @api_method [flickr.photos.getRecent](http://www.flickr.com/services/api/flickr.photos.getRecent.html)
|
368
|
-
def get_recent_videos(params = {})
|
369
|
-
get_recent_media(params).select { |media| media.is_a?(Video) }
|
370
|
-
end
|
371
|
-
|
372
|
-
# Fetches the sizes of the photo with the given ID. Example:
|
373
|
-
#
|
374
|
-
# photo = Flickrie.get_photo_sizes(242348)
|
375
|
-
# photo.medium!(500)
|
376
|
-
# photo.size # => "Medium 500"
|
377
|
-
# photo.source_url # => "http://farm8.staticflickr.com/7090/7093101501_9337f28800.jpg"
|
378
|
-
#
|
379
|
-
# @param photo_id [String, Fixnum]
|
380
|
-
# @return [Flickrie::Photo]
|
381
|
-
# @api_method [flickr.photos.getSizes](http://www.flickr.com/services/api/flickr.photos.getSizes.html)
|
382
|
-
def get_photo_sizes(photo_id, params = {})
|
383
|
-
response = client.get_media_sizes(photo_id, params)
|
384
|
-
Photo.from_sizes(response.body['sizes'].merge('id' => photo_id.to_s))
|
385
|
-
end
|
386
|
-
# Fetches the sizes of the video with the given ID. Example:
|
387
|
-
#
|
388
|
-
# video = Flickrie.get_video_sizes(438492)
|
389
|
-
# video.download_url # => "..."
|
390
|
-
#
|
391
|
-
# @param video_id [String, Fixnum]
|
392
|
-
# @return [Flickrie::Video]
|
393
|
-
# @api_method [flickr.photos.getSizes](http://www.flickr.com/services/api/flickr.photos.getSizes.html)
|
394
|
-
def get_video_sizes(video_id, params = {})
|
395
|
-
response = client.get_media_sizes(video_id, params)
|
396
|
-
Video.from_sizes(response.body['sizes'].merge('id' => video_id.to_s))
|
397
|
-
end
|
398
|
-
|
399
|
-
# Fetches photos and videos from the authenticated user that have no
|
400
|
-
# tags.
|
401
|
-
#
|
402
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
403
|
-
# @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
|
404
|
-
#
|
405
|
-
# @note This method requires authentication with "read" permissions.
|
406
|
-
def get_untagged_media(params = {})
|
407
|
-
response = client.get_untagged_media({:media => 'all'}.merge(params))
|
408
|
-
Media.from_untagged(response.body['photos'])
|
409
|
-
end
|
410
|
-
# Fetches photos from the authenticated user that have no tags.
|
411
|
-
#
|
412
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
413
|
-
# @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
|
414
|
-
#
|
415
|
-
# @note This method requires authentication with "read" permissions.
|
416
|
-
def get_untagged_photos(params = {})
|
417
|
-
get_untagged_media({:media => 'photos'}.merge(params))
|
418
|
-
end
|
419
|
-
# Fetches videos from the authenticated user that have no tags.
|
420
|
-
#
|
421
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
422
|
-
# @api_method [flickr.photos.getUntagged](http://www.flickr.com/services/api/flickr.photos.getUntagged.html)
|
423
|
-
#
|
424
|
-
# @note This method requires authentication with "read" permissions.
|
425
|
-
def get_untagged_videos(params = {})
|
426
|
-
get_untagged_media({:media => 'videos'}.merge(params))
|
427
|
-
end
|
428
|
-
|
429
|
-
# Fetches geo-tagged photos and videos from the authenticated user.
|
430
|
-
#
|
431
|
-
# @return [Flickrie:Collection<Flickrie:Photo, Flickrie::Video>]
|
432
|
-
# @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
|
433
|
-
#
|
434
|
-
# @note This method requires authentication with "read" permissions.
|
435
|
-
def get_media_with_geo_data(params = {})
|
436
|
-
response = client.get_media_with_geo_data({:media => 'all'}.merge(params))
|
437
|
-
Media.from_geo_data(response.body['photos'])
|
438
|
-
end
|
439
|
-
# Fetches geo-tagged photos from the authenticated user.
|
440
|
-
#
|
441
|
-
# @return [Flickrie:Collection<Flickrie:Photo>]
|
442
|
-
# @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
|
443
|
-
#
|
444
|
-
# @note This method requires authentication with "read" permissions.
|
445
|
-
def get_photos_with_geo_data(params = {})
|
446
|
-
get_media_with_geo_data({:media => 'photos'}.merge(params))
|
447
|
-
end
|
448
|
-
# Fetches geo-tagged videos from the authenticated user.
|
449
|
-
#
|
450
|
-
# @return [Flickrie:Collection<Flickrie::Video>]
|
451
|
-
# @api_method [flickr.photos.getWithGeoData](http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html)
|
452
|
-
#
|
453
|
-
# @note This method requires authentication with "read" permissions.
|
454
|
-
def get_videos_with_geo_data(params = {})
|
455
|
-
get_media_with_geo_data({:media => 'videos'}.merge(params))
|
456
|
-
end
|
457
|
-
|
458
|
-
# Fetches photos and videos from the authenticated user that are not
|
459
|
-
# geo-tagged.
|
460
|
-
#
|
461
|
-
# @return [Flickrie:Collection<Flickrie:Photo, Flickrie::Video>]
|
462
|
-
# @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
|
463
|
-
#
|
464
|
-
# @note This method requires authentication with "read" permissions.
|
465
|
-
def get_media_without_geo_data(params = {})
|
466
|
-
response = client.get_media_with_geo_data({:media => 'all'}.merge(params))
|
467
|
-
Media.from_geo_data(response.body['photos'])
|
468
|
-
end
|
469
|
-
# Fetches photos from the authenticated user that are not geo-tagged.
|
470
|
-
#
|
471
|
-
# @return [Flickrie:Collection<Flickrie:Photo>]
|
472
|
-
# @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
|
473
|
-
#
|
474
|
-
# @note This method requires authentication with "read" permissions.
|
475
|
-
def get_photos_without_geo_data(params = {})
|
476
|
-
get_media_with_geo_data({:media => 'photos'}.merge(params))
|
477
|
-
end
|
478
|
-
# Fetches videos from the authenticated user that are not geo-tagged.
|
479
|
-
#
|
480
|
-
# @return [Flickrie:Collection<Flickrie::Video>]
|
481
|
-
# @api_method [flickr.photos.getWithoutGeoData](http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html)
|
482
|
-
#
|
483
|
-
# @note This method requires authentication with "read" permissions.
|
484
|
-
def get_videos_without_geo_data(params = {})
|
485
|
-
get_media_with_geo_data({:media => 'videos'}.merge(params))
|
486
|
-
end
|
487
|
-
|
488
|
-
# Fetches photos and videos from the authenticated user that have
|
489
|
-
# recently been updated.
|
490
|
-
#
|
491
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
492
|
-
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
493
|
-
#
|
494
|
-
# @note This method requires authentication with "read" permissions.
|
495
|
-
def recently_updated_media(params = {})
|
496
|
-
response = client.recently_updated_media(params)
|
497
|
-
Media.from_recently_updated(response.body['photos'])
|
498
|
-
end
|
499
|
-
# Fetches photos from the authenticated user that have recently been updated.
|
500
|
-
#
|
501
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
502
|
-
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
503
|
-
#
|
504
|
-
# @note This method requires authentication with "read" permissions.
|
505
|
-
def recently_updated_photos(params = {})
|
506
|
-
recently_updated_media(params).select { |media| media.is_a?(Photo) }
|
507
|
-
end
|
508
|
-
# Fetches videos from the authenticated user that have recently been updated.
|
509
|
-
#
|
510
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
511
|
-
# @api_method [flickr.photos.recentlyUpdated](http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html)
|
512
|
-
#
|
513
|
-
# @note This method requires authentication with "read" permissions.
|
514
|
-
def recently_updated_videos(params = {})
|
515
|
-
recently_updated_media(params).select { |media| media.is_a?(Video) }
|
516
|
-
end
|
517
|
-
|
518
|
-
# Remove the tag with the given ID
|
519
|
-
#
|
520
|
-
# @param tag_id [String]
|
521
|
-
# @return [nil]
|
522
|
-
# @api_method [flickr.photos.removeTag](http://www.flickr.com/services/api/flickr.photos.removeTag.html)
|
523
|
-
#
|
524
|
-
# @note This method requires authentication with "write" permissions.
|
525
|
-
def remove_media_tag(tag_id, params = {})
|
526
|
-
client.remove_media_tag(tag_id, params)
|
527
|
-
nil
|
528
|
-
end
|
529
|
-
alias remove_photo_tag remove_media_tag
|
530
|
-
alias remove_video_tag remove_media_tag
|
531
|
-
|
532
|
-
# Fetches photos and videos matching a certain criteria.
|
533
|
-
#
|
534
|
-
# @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
|
535
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
536
|
-
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
537
|
-
def search_media(params = {})
|
538
|
-
response = client.search_media({:media => 'all'}.merge(params))
|
539
|
-
Media.from_search(response.body['photos'])
|
540
|
-
end
|
541
|
-
# Fetches photos matching a certain criteria.
|
542
|
-
#
|
543
|
-
# @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
|
544
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
545
|
-
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
546
|
-
def search_photos(params = {})
|
547
|
-
search_media({:media => 'photos'}.merge(params))
|
548
|
-
end
|
549
|
-
# Fetches videos matching a certain criteria.
|
550
|
-
#
|
551
|
-
# @param search_params [Hash] Options for searching (see the link below under "Flickr API method")
|
552
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
553
|
-
# @api_method [flickr.photos.search](http://www.flickr.com/services/api/flickr.photos.search.html)
|
554
|
-
def search_videos(params = {})
|
555
|
-
search_media({:media => 'videos'}.merge(params))
|
556
|
-
end
|
557
|
-
|
558
|
-
# Sets the content type of a photo/video.
|
559
|
-
#
|
560
|
-
# @param media_id [String, Fixnum]
|
561
|
-
# @param content_type [String, Fixnum]
|
562
|
-
# @return [nil]
|
563
|
-
# @api_method [flickr.photos.setContentType](http://www.flickr.com/services/api/flickr.photos.setContentType.html)
|
564
|
-
#
|
565
|
-
# @note This method requires authentication with "write" permissions.
|
566
|
-
def set_media_content_type(media_id, content_type, params = {})
|
567
|
-
client.set_media_content_type(media_id, content_type, params)
|
568
|
-
nil
|
569
|
-
end
|
570
|
-
alias set_photo_content_type set_media_content_type
|
571
|
-
alias set_video_content_type set_media_content_type
|
572
|
-
|
573
|
-
# Sets dates for a photo/video.
|
574
|
-
#
|
575
|
-
# @param media_id [String, Fixnum]
|
576
|
-
# @return [nil]
|
577
|
-
# @api_method [flickr.photos.setDates](http://www.flickr.com/services/api/flickr.photos.setDates.html)
|
578
|
-
#
|
579
|
-
# @note This method requires authentication with "write" permissions.
|
580
|
-
def set_media_dates(media_id, params = {})
|
581
|
-
client.set_media_dates(media_id, params)
|
582
|
-
nil
|
583
|
-
end
|
584
|
-
alias set_photo_dates set_media_dates
|
585
|
-
alias set_video_dates set_media_dates
|
586
|
-
|
587
|
-
# Sets meta information for a photo/video.
|
588
|
-
#
|
589
|
-
# @param media_id [String, Fixnum]
|
590
|
-
# @return [nil]
|
591
|
-
# @api_method [flickr.photos.setMeta](http://www.flickr.com/services/api/flickr.photos.setMeta.html)
|
592
|
-
#
|
593
|
-
# @note This method requires authentication with "write" permissions.
|
594
|
-
def set_media_meta(media_id, params = {})
|
595
|
-
client.set_media_meta(media_id, params)
|
596
|
-
nil
|
597
|
-
end
|
598
|
-
alias set_photo_meta set_media_meta
|
599
|
-
alias set_video_meta set_media_meta
|
600
|
-
|
601
|
-
# Sets permissions for a photo/video.
|
602
|
-
#
|
603
|
-
# @param media_id [String, Fixnum]
|
604
|
-
# @return [nil]
|
605
|
-
# @api_method [flickr.photos.setPerms](http://www.flickr.com/services/api/flickr.photos.setPerms.html)
|
606
|
-
#
|
607
|
-
# @note This method requires authentication with "write" permissions.
|
608
|
-
def set_media_permissions(media_id, params = {})
|
609
|
-
client.set_media_permissions(media_id, params)
|
610
|
-
nil
|
611
|
-
end
|
612
|
-
alias set_photo_permissions set_media_permissions
|
613
|
-
alias set_video_permissions set_media_permissions
|
614
|
-
|
615
|
-
# Sets the safety level of a photo/video.
|
616
|
-
#
|
617
|
-
# @param media_id [String, Fixnum]
|
618
|
-
# @return [nil]
|
619
|
-
# @api_method [flickr.photos.setSafetyLevel](http://www.flickr.com/services/api/flickr.photos.setSafetyLevel.html)
|
620
|
-
#
|
621
|
-
# @note This method requires authentication with "write" permissions.
|
622
|
-
def set_media_safety_level(media_id, params = {})
|
623
|
-
client.set_media_safety_level(media_id, params)
|
624
|
-
nil
|
625
|
-
end
|
626
|
-
alias set_photo_safety_level set_media_safety_level
|
627
|
-
alias set_video_safety_level set_media_safety_level
|
628
|
-
|
629
|
-
# Sets tags for a photo/video.
|
630
|
-
#
|
631
|
-
# @params media_id [String, Fixnum]
|
632
|
-
# @return [nil]
|
633
|
-
# @api_method [flickr.photos.setTags](http://www.flickr.com/services/api/flickr.photos.setTags.html)
|
634
|
-
#
|
635
|
-
# @note This method requires authentication with "write" permissions.
|
636
|
-
def set_media_tags(media_id, tags, params = {})
|
637
|
-
client.set_media_tags(media_id, tags, params)
|
638
|
-
nil
|
639
|
-
end
|
640
|
-
alias set_photo_tags set_media_tags
|
641
|
-
alias set_video_tags set_media_tags
|
642
|
-
|
643
|
-
# Sets the license of a photo/video.
|
644
|
-
#
|
645
|
-
# @return [nil]
|
646
|
-
# @api_method [flickr.photos.licenses.setLicense](http://www.flickr.com/services/api/flickr.photos.licenses.setLicense.html)
|
647
|
-
#
|
648
|
-
# @note This method requires authentication with "write" permissions.
|
649
|
-
def set_media_license(media_id, license_id, params = {})
|
650
|
-
client.set_media_license(media_id, license_id, params)
|
651
|
-
nil
|
652
|
-
end
|
653
|
-
alias set_photo_license set_media_license
|
654
|
-
alias set_video_license set_media_license
|
655
|
-
|
656
|
-
# Rotates a photo/video.
|
657
|
-
#
|
658
|
-
# @return [nil]
|
659
|
-
# @api_method [flickr.photos.transform.rotate](http://www.flickr.com/services/api/flickr.photos.transform.rotate.html)
|
660
|
-
#
|
661
|
-
# @note This method requires authentication with "write" permissions.
|
662
|
-
def rotate_media(media_id, degrees, params = {})
|
663
|
-
client.rotate_media(media_id, degrees, params)
|
664
|
-
nil
|
665
|
-
end
|
666
|
-
alias rotate_photo rotate_media
|
667
|
-
alias rotate_video rotate_media
|
668
|
-
|
669
|
-
# Fetches photos and videos from a set with the given ID.
|
670
|
-
#
|
671
|
-
# @param set_id [String]
|
672
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
673
|
-
# @return [Flickrie::Collection<Flickrie::Photo, Flickrie::Video>]
|
674
|
-
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
675
|
-
def media_from_set(set_id, params = {})
|
676
|
-
response = client.media_from_set(set_id, {:media => 'all'}.merge(params))
|
677
|
-
Media.from_set(response.body['photoset'])
|
678
|
-
end
|
679
|
-
# Fetches photos from a set with the given ID.
|
680
|
-
#
|
681
|
-
# @param set_id [String]
|
682
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
683
|
-
# @return [Flickrie::Collection<Flickrie::Photo>]
|
684
|
-
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
685
|
-
def photos_from_set(set_id, params = {})
|
686
|
-
media_from_set(set_id, {:media => 'photos'}.merge(params))
|
687
|
-
end
|
688
|
-
# Fetches videos from a set with the given ID.
|
689
|
-
#
|
690
|
-
# @param set_id [String]
|
691
|
-
# @param params [Hash] Options for this API method (see the link below under "Flickr API method")
|
692
|
-
# @return [Flickrie::Collection<Flickrie::Video>]
|
693
|
-
# @api_method [flickr.photosets.getPhotos](http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
|
694
|
-
def videos_from_set(set_id, params = {})
|
695
|
-
media_from_set(set_id, {:media => 'videos'}.merge(params))
|
696
|
-
end
|
697
|
-
end
|
698
|
-
end
|