rmm5t-flickr_fu 0.3.3 → 0.3.4
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/VERSION.yml +1 -1
- data/lib/flickr/photo.rb +4 -5
- data/lib/flickr/photos.rb +41 -40
- data/rmm5t-flickr_fu.gemspec +2 -2
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/flickr/photo.rb
CHANGED
@@ -3,10 +3,10 @@ class Flickr::Photos::Photo
|
|
3
3
|
attr_accessor :id, :owner, :secret, :server, :farm, :title, :is_public, :is_friend, :is_family # standard attributes
|
4
4
|
attr_accessor :license_id, :uploaded_at, :taken_at, :owner_name, :icon_server, :original_format, :updated_at, :geo, :tags, :machine_tags, :o_dims, :views, :media # extra attributes
|
5
5
|
attr_accessor :info_added, :description, :original_secret, :owner_username, :owner_realname, :url_photopage, :notes # info attributes
|
6
|
-
attr_accessor :comments # comment attributes
|
7
|
-
|
6
|
+
attr_accessor :comment_count, :comments # comment attributes
|
7
|
+
|
8
8
|
# create a new instance of a flickr photo.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Params
|
11
11
|
# * flickr (Required)
|
12
12
|
# the flickr object
|
@@ -276,8 +276,7 @@ class Flickr::Photos::Photo
|
|
276
276
|
end
|
277
277
|
|
278
278
|
private
|
279
|
-
|
280
|
-
|
279
|
+
|
281
280
|
# convert the size to the key used in the flickr url
|
282
281
|
def size_key(size)
|
283
282
|
case size.to_sym
|
data/lib/flickr/photos.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
class Flickr::Photos < Flickr::Base
|
2
3
|
def initialize(flickr)
|
3
4
|
@flickr = flickr
|
4
5
|
end
|
5
6
|
|
6
|
-
# Return a list of photos matching some criteria. Only photos visible to the calling user will be returned. To return private or semi-private photos,
|
7
|
+
# Return a list of photos matching some criteria. Only photos visible to the calling user will be returned. To return private or semi-private photos,
|
7
8
|
# the caller must be authenticated with 'read' permissions, and have permission to view the photos. Unauthenticated calls will only return public photos.
|
8
|
-
#
|
9
|
+
#
|
9
10
|
# == Authentication
|
10
11
|
# This method does not require authentication.
|
11
|
-
#
|
12
|
+
#
|
12
13
|
# == Options
|
13
14
|
# * user_id (Optional)
|
14
|
-
# The NSID of the user who's photo to search. If this parameter isn't passed then everybody's public photos will be searched. A value of "me" will
|
15
|
+
# The NSID of the user who's photo to search. If this parameter isn't passed then everybody's public photos will be searched. A value of "me" will
|
15
16
|
# search against the calling user's photos for authenticated calls.
|
16
17
|
# * tags (Optional)
|
17
18
|
# A comma-delimited list of tags. Photos with one or more of the tags listed will be returned.
|
@@ -30,7 +31,7 @@ class Flickr::Photos < Flickr::Base
|
|
30
31
|
# * license (Optional)
|
31
32
|
# The license id for photos (for possible values see the flickr.photos.licenses.getInfo method). Multiple licenses may be comma-separated.
|
32
33
|
# * sort (Optional)
|
33
|
-
# The order in which to sort returned photos. Deafults to date-posted-desc. The possible values are: date-posted-asc, date-posted-desc, date-taken-asc,
|
34
|
+
# The order in which to sort returned photos. Deafults to date-posted-desc. The possible values are: date-posted-asc, date-posted-desc, date-taken-asc,
|
34
35
|
# date-taken-desc, interestingness-desc, interestingness-asc, and relevance.
|
35
36
|
# * privacy_filter (Optional)
|
36
37
|
# Return photos only matching a certain privacy level. This only applies when making an authenticated call to view photos you own. Valid values are:
|
@@ -40,18 +41,18 @@ class Flickr::Photos < Flickr::Base
|
|
40
41
|
# 4 private photos visible to friends & family
|
41
42
|
# 5 completely private photos
|
42
43
|
# * bbox (Optional)
|
43
|
-
# A comma-delimited list of 4 values defining the Bounding Box of the area that will be searched.
|
44
|
-
#
|
45
|
-
# The 4 values represent the bottom-left corner of the box and the top-right corner, minimum_longitude, minimum_latitude, maximum_longitude, maximum_latitude.
|
46
|
-
#
|
47
|
-
# Longitude has a range of -180 to 180 , latitude of -90 to 90. Defaults to -180, -90, 180, 90 if not specified.
|
48
|
-
#
|
49
|
-
# Unlike standard photo queries, geo (or bounding box) queries will only return 250 results per page.
|
50
|
-
#
|
51
|
-
# Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches"
|
52
|
-
# for queries without a geo component.
|
53
|
-
#
|
54
|
-
# A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters — If no limiting factor is passed we
|
44
|
+
# A comma-delimited list of 4 values defining the Bounding Box of the area that will be searched.
|
45
|
+
#
|
46
|
+
# The 4 values represent the bottom-left corner of the box and the top-right corner, minimum_longitude, minimum_latitude, maximum_longitude, maximum_latitude.
|
47
|
+
#
|
48
|
+
# Longitude has a range of -180 to 180 , latitude of -90 to 90. Defaults to -180, -90, 180, 90 if not specified.
|
49
|
+
#
|
50
|
+
# Unlike standard photo queries, geo (or bounding box) queries will only return 250 results per page.
|
51
|
+
#
|
52
|
+
# Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches"
|
53
|
+
# for queries without a geo component.
|
54
|
+
#
|
55
|
+
# A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters — If no limiting factor is passed we
|
55
56
|
# return only photos added in the last 12 hours (though we may extend the limit in the future).
|
56
57
|
# * accuracy (Optional)
|
57
58
|
# Recorded accuracy level of the location information. Current range is 1-16 :
|
@@ -85,27 +86,27 @@ class Flickr::Photos < Flickr::Base
|
|
85
86
|
# Find photos that have a title, in any namespace : "machine_tags" => "*:title="
|
86
87
|
# Find photos that have a title, in any namespace, whose value is "mr. camera" : "machine_tags" => "*:title=\"mr. camera\""
|
87
88
|
# Find photos, in the 'dc' namespace whose value is "mr. camera" : "machine_tags" => "dc:*=\"mr. camera\""
|
88
|
-
# Multiple machine tags may be queried by passing a comma-separated list. The number of machine tags you can pass in a single query depends on
|
89
|
+
# Multiple machine tags may be queried by passing a comma-separated list. The number of machine tags you can pass in a single query depends on
|
89
90
|
# the tag mode (AND or OR) that you are querying with. "AND" queries are limited to (16) machine tags. "OR" queries are limited to (8).
|
90
91
|
# * machine_tag_mode (Required)
|
91
92
|
# Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.
|
92
93
|
# * group_id (Optional)
|
93
94
|
# The id of a group who's pool to search. If specified, only matching photos posted to the group's pool will be returned.
|
94
95
|
# * woe_id (Optional)
|
95
|
-
# A 32-bit identifier that uniquely represents spatial entities. (not used if bbox argument is present). Experimental.
|
96
|
-
#
|
97
|
-
# Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches"
|
98
|
-
# for queries without a geo component.
|
99
|
-
#
|
100
|
-
# A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters &emdash; If no limiting factor is passed
|
96
|
+
# A 32-bit identifier that uniquely represents spatial entities. (not used if bbox argument is present). Experimental.
|
97
|
+
#
|
98
|
+
# Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches"
|
99
|
+
# for queries without a geo component.
|
100
|
+
#
|
101
|
+
# A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters &emdash; If no limiting factor is passed
|
101
102
|
# we return only photos added in the last 12 hours (though we may extend the limit in the future).
|
102
103
|
# * place_id (Optional)
|
103
|
-
# A Flickr place id. (not used if bbox argument is present). Experimental.
|
104
|
-
#
|
105
|
-
# Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches"
|
106
|
-
# for queries without a geo component.
|
107
|
-
#
|
108
|
-
# A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters &emdash; If no limiting factor is passed
|
104
|
+
# A Flickr place id. (not used if bbox argument is present). Experimental.
|
105
|
+
#
|
106
|
+
# Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches"
|
107
|
+
# for queries without a geo component.
|
108
|
+
#
|
109
|
+
# A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters &emdash; If no limiting factor is passed
|
109
110
|
# we return only photos added in the last 12 hours (though we may extend the limit in the future).
|
110
111
|
# * per_page (Optional)
|
111
112
|
# Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
|
@@ -113,7 +114,7 @@ class Flickr::Photos < Flickr::Base
|
|
113
114
|
# The page of results to return. If this argument is omitted, it defaults to 1.
|
114
115
|
# * media (Optional)
|
115
116
|
# The type of media to search for. 'photo', 'video', or 'both' are allowed arguments, with 'both' being the default.
|
116
|
-
#
|
117
|
+
#
|
117
118
|
def search(options)
|
118
119
|
options.merge!({:extras => "license,date_upload,date_taken,owner_name,icon_server,original_format,last_update,geo,tags,machine_tags,o_dims,views,media"})
|
119
120
|
|
@@ -134,12 +135,12 @@ class Flickr::Photos < Flickr::Base
|
|
134
135
|
end if rsp.photos.photo
|
135
136
|
end
|
136
137
|
end
|
137
|
-
|
138
|
+
|
138
139
|
# Returns a list of the latest public photos uploaded to flickr.
|
139
|
-
#
|
140
|
+
#
|
140
141
|
# == Authentication
|
141
142
|
# This method does not require authentication.
|
142
|
-
#
|
143
|
+
#
|
143
144
|
# == Options
|
144
145
|
# * per_page (Optional)
|
145
146
|
# Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
|
@@ -147,7 +148,7 @@ class Flickr::Photos < Flickr::Base
|
|
147
148
|
# The page of results to return. If this argument is omitted, it defaults to 1.
|
148
149
|
# * media (Optional)
|
149
150
|
# The type of media to search for. 'photo', 'video', or 'both' are allowed arguments, with 'both' being the default.
|
150
|
-
#
|
151
|
+
#
|
151
152
|
def get_recent(options = {})
|
152
153
|
options.merge!({:extras => "license,date_upload,date_taken,owner_name,icon_server,original_format,last_update,geo,tags,machine_tags,o_dims,views,media"})
|
153
154
|
|
@@ -167,7 +168,7 @@ class Flickr::Photos < Flickr::Base
|
|
167
168
|
end if rsp.photos.photo
|
168
169
|
end
|
169
170
|
end
|
170
|
-
|
171
|
+
|
171
172
|
def interesting(options)
|
172
173
|
options.merge!({:extras => "license,date_upload,date_taken,owner_name,icon_server,original_format,last_update,geo,tags,machine_tags,o_dims,views,media"})
|
173
174
|
|
@@ -189,11 +190,11 @@ class Flickr::Photos < Flickr::Base
|
|
189
190
|
end if rsp.photos.photo
|
190
191
|
end
|
191
192
|
end
|
192
|
-
|
193
|
+
|
193
194
|
def licenses
|
194
195
|
@licenses ||= begin
|
195
196
|
rsp = @flickr.send_request('flickr.photos.licenses.getInfo')
|
196
|
-
|
197
|
+
|
197
198
|
returning Hash.new do |licenses|
|
198
199
|
rsp.licenses.license.each do |license|
|
199
200
|
licenses[license[:id].to_i] = Flickr::Photos::License.new(:id => license[:id].to_i, :name => license[:name], :url => license[:url])
|
@@ -213,7 +214,7 @@ class Flickr::Photos < Flickr::Base
|
|
213
214
|
rsp = @flickr.send_request('flickr.photos.getInfo', :photo_id => photo_id)
|
214
215
|
Photo.new(@flickr, :id => rsp.photo[:id].to_i, :owner => rsp.photo.owner,
|
215
216
|
:secret => rsp.photo[:secret], :server => rsp.photo[:server].to_i, :farm => rsp.photo[:farm], :views => rsp.photo[:views],
|
216
|
-
:title => rsp.photo.title,
|
217
|
+
:title => rsp.photo.title.to_s, :comment_count => rsp.photo.comments.to_s.to_i,
|
217
218
|
:is_public => rsp.photo.visibility[:public], :is_friend => rsp.photo.visibility[:is_friend], :is_family => rsp.photo.visibility[:is_family])
|
218
219
|
end
|
219
220
|
|
@@ -242,5 +243,5 @@ class Flickr::Photos < Flickr::Base
|
|
242
243
|
:views => photo[:views].to_i,
|
243
244
|
:media => photo[:media]}
|
244
245
|
end
|
245
|
-
|
246
|
+
|
246
247
|
end
|
data/rmm5t-flickr_fu.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rmm5t-flickr_fu}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Wyrosdick", "Maciej Bilas"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-06}
|
13
13
|
s.description = %q{Provides a ruby interface to flickr via the REST api}
|
14
14
|
s.email = %q{ben@commonthread.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmm5t-flickr_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Wyrosdick
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-06 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|