digitalpardoe-rflickr 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/{README.rdoc → README.markdown} +5 -9
- data/Rakefile +40 -33
- data/VERSION.yml +1 -1
- data/lib/flickr/auth.rb +5 -7
- data/lib/flickr/base.rb +55 -57
- data/lib/flickr/contacts.rb +4 -4
- data/lib/flickr/groups.rb +2 -2
- data/lib/flickr/interestingness.rb +2 -2
- data/lib/flickr/licenses.rb +1 -1
- data/lib/flickr/people.rb +4 -4
- data/lib/flickr/photos.rb +33 -33
- data/lib/flickr/photosets.rb +4 -4
- data/lib/flickr/pools.rb +2 -2
- data/lib/flickr/reflection.rb +4 -4
- data/lib/flickr/tags.rb +2 -2
- data/lib/flickr/upload.rb +25 -25
- data/lib/flickr/urls.rb +4 -4
- data/test/test_suite.rb +3 -0
- metadata +22 -12
- data/spec/rflickr_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -9
data/.gitignore
ADDED
@@ -1,28 +1,24 @@
|
|
1
|
-
|
1
|
+
# rFlickr
|
2
2
|
|
3
3
|
To use this version of rFlickr, first you will need to install
|
4
4
|
the RubyGem you can do by (from a command line):
|
5
5
|
|
6
|
-
$ gem sources -a http://gems.github.com (you only have to do this once)
|
7
|
-
$ sudo gem install digitalpardoe-rflickr
|
6
|
+
$ gem sources -a http://gems.github.com (you only have to do this once)
|
7
|
+
$ sudo gem install digitalpardoe-rflickr
|
8
8
|
|
9
9
|
Then you'll need to get a Flickr API key as detailed here:
|
10
10
|
|
11
|
-
http://www.flickr.com/services/api/misc.api_keys.html
|
11
|
+
[http://www.flickr.com/services/api/misc.api_keys.html](http://www.flickr.com/services/api/misc.api_keys.html)
|
12
12
|
|
13
13
|
You'll need to authorize your application's API key from each
|
14
14
|
Flickr user account which wants to use it.
|
15
15
|
|
16
16
|
A short guide to get you started can be found here:
|
17
17
|
|
18
|
-
http://digitalpardoe.co.uk/blog/show/87
|
18
|
+
[http://digitalpardoe.co.uk/blog/show/87](http://digitalpardoe.co.uk/blog/show/87)
|
19
19
|
|
20
20
|
The guide is a little out of date in it's gem installation technique,
|
21
21
|
use the instructions above instead.
|
22
22
|
|
23
23
|
This project is still a work in progress, bear with me whilst it is
|
24
24
|
set up.
|
25
|
-
|
26
|
-
== Copyright
|
27
|
-
|
28
|
-
Copyright (c) 2009 Alex Pardoe. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -2,48 +2,55 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
begin
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "digitalpardoe-rflickr"
|
8
|
+
gem.summary = "rFlickr is a Ruby interface to the Flickr API"
|
9
|
+
gem.email = "contact@digitalpardoe.co.uk"
|
10
|
+
gem.homepage = "http://github.com/digitalpardoe/rflickr"
|
11
|
+
gem.authors = ["digital:pardoe"]
|
12
|
+
gem.description = "rFlickr is a clone of the original RubyForge based rflickr, a Ruby implementation of the Flickr API. It includes a faithful albeit old reproduction of the published API."
|
13
|
+
gem.add_dependency('mime-types')
|
14
|
+
end
|
16
15
|
rescue LoadError
|
17
|
-
|
16
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
18
17
|
end
|
19
18
|
|
20
|
-
require '
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
23
|
+
test.verbose = true
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |test|
|
29
|
+
test.libs << 'test'
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :rcov do
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
36
|
+
end
|
30
37
|
end
|
31
38
|
|
32
|
-
|
33
|
-
task :default => :spec
|
39
|
+
task :default => :test
|
34
40
|
|
35
41
|
require 'rake/rdoctask'
|
36
42
|
Rake::RDocTask.new do |rdoc|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
if File.exist?('VERSION.yml')
|
44
|
+
config = YAML.load(File.read('VERSION.yml'))
|
45
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
46
|
+
else
|
47
|
+
version = ""
|
48
|
+
end
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "rflickr #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('LICENSE*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
48
55
|
end
|
49
56
|
|
data/VERSION.yml
CHANGED
data/lib/flickr/auth.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
# rFlickr: A Ruby based Flickr API implementation.
|
4
2
|
# Copyright (C) 2009, Alex Pardoe (digital:pardoe)
|
5
3
|
#
|
@@ -45,7 +43,7 @@ class Flickr::Auth < Flickr::APIBase
|
|
45
43
|
args['frob'] = self.frob
|
46
44
|
args['api_sig'] = @flickr.sign(args)
|
47
45
|
return "http://flickr.com/services/auth/?"+
|
48
|
-
|
46
|
+
args.to_a.map{|arr| arr.join('=')}.join('&')
|
49
47
|
end
|
50
48
|
|
51
49
|
def frob=(frob) @frob = frob end
|
@@ -63,20 +61,20 @@ class Flickr::Auth < Flickr::APIBase
|
|
63
61
|
#
|
64
62
|
# Backwwards compatible with old token storage.
|
65
63
|
@token = token.include?('<') ?
|
66
|
-
|
67
|
-
|
64
|
+
Flickr::Token.from_xml(REXML::Document.new(token)) :
|
65
|
+
@token = checkToken(token)
|
68
66
|
end
|
69
67
|
|
70
68
|
def getToken(frob=nil)
|
71
69
|
frob ||= @frob
|
72
70
|
res=@flickr.call_unauth_method('flickr.auth.getToken',
|
73
|
-
|
71
|
+
'frob'=>frob)
|
74
72
|
@token = Flickr::Token.from_xml(res)
|
75
73
|
end
|
76
74
|
|
77
75
|
def getFullToken(mini_token)
|
78
76
|
res = flickr.call_unauth_method('flickr.auth.getFullToken',
|
79
|
-
|
77
|
+
'mini_token' => mini_token)
|
80
78
|
@token = Flickr::Token.from_xml(res)
|
81
79
|
end
|
82
80
|
|
data/lib/flickr/base.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
# rFlickr: A Ruby based Flickr API implementation.
|
4
2
|
# Copyright (C) 2009, Alex Pardoe (digital:pardoe)
|
5
3
|
#
|
@@ -36,7 +34,7 @@ class Flickr
|
|
36
34
|
attr_reader :api_key
|
37
35
|
attr_accessor :async, :debug, :caching, :auth_mode
|
38
36
|
|
39
|
-
############################### CACHE ACCESSORS ###########################
|
37
|
+
############################### CACHE ACCESSORS ###########################
|
40
38
|
def ticket_cache_lookup(id) @ticket_by_id[id] if @caching end
|
41
39
|
|
42
40
|
def ticket_cache_store(ticket)
|
@@ -82,23 +80,23 @@ class Flickr
|
|
82
80
|
def group_cache_store(group)
|
83
81
|
@group_by_id[group.id] = group if @caching
|
84
82
|
end
|
85
|
-
############################################################################
|
83
|
+
############################################################################
|
86
84
|
|
87
85
|
def debug(*args) $stderr.puts(sprintf(*args)) if @debug end
|
88
86
|
|
89
87
|
def Flickr.todo
|
90
88
|
[
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
89
|
+
'Refactor, especially more Class.from_xml methods',
|
90
|
+
'More logical OO design, wrap the API methods to make transparent',
|
91
|
+
'Class & method documentation',
|
92
|
+
'Unit tests',
|
93
|
+
'Implement missing methods (see flickr.reflection.missing_methods)'
|
96
94
|
]
|
97
95
|
end
|
96
|
+
|
98
97
|
def todo()
|
99
98
|
Flickr.todo+reflection.missing_methods.map{|m| 'Implement '+m}
|
100
99
|
end
|
101
|
-
|
102
100
|
|
103
101
|
def initialize(token_cache=nil,api_key=API_KEY,
|
104
102
|
shared_secret=SHARED_SECRET,
|
@@ -112,7 +110,7 @@ class Flickr
|
|
112
110
|
@endpoint=endpoint
|
113
111
|
proto,host,port,path,user,pass=parse_url(@endpoint)
|
114
112
|
raise ProtoUnknownError.new("Unhandled protocol '#{proto}'") if
|
115
|
-
|
113
|
+
proto.downcase != 'http'
|
116
114
|
@client=XMLRPC::Client.new(host,path,port)
|
117
115
|
clear_cache
|
118
116
|
end
|
@@ -155,7 +153,7 @@ class Flickr
|
|
155
153
|
|
156
154
|
def call_method(method,args={})
|
157
155
|
@auth_mode ? call_auth_method(method,args) :
|
158
|
-
|
156
|
+
call_unauth_method(method,args)
|
159
157
|
end
|
160
158
|
|
161
159
|
def call_unauth_method(method,args={})
|
@@ -168,7 +166,7 @@ class Flickr
|
|
168
166
|
begin
|
169
167
|
tries -= 1;
|
170
168
|
str = @async ? @client.call_async(method,args) :
|
171
|
-
|
169
|
+
@client.call(method,args)
|
172
170
|
debug('RETURN: %s',str)
|
173
171
|
return REXML::Document.new(str)
|
174
172
|
rescue Timeout::Error => te
|
@@ -180,7 +178,7 @@ class Flickr
|
|
180
178
|
end
|
181
179
|
rescue REXML::ParseException => pe
|
182
180
|
return REXML::Document.new('<rsp>'+str+'</rsp>').
|
183
|
-
|
181
|
+
elements['/rsp']
|
184
182
|
rescue XMLRPC::FaultException => fe
|
185
183
|
$stderr.puts "ERR: #{fe.faultString} (#{fe.faultCode})"
|
186
184
|
raise fe
|
@@ -251,11 +249,11 @@ class Flickr::Token
|
|
251
249
|
end
|
252
250
|
|
253
251
|
def to_xml
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
252
|
+
return "<auth><token>#{self.token}</token>"+
|
253
|
+
"<perms>#{self.perms}</perms>"+
|
254
|
+
"<user nsid=\"#{self.user.nsid}\" "+
|
255
|
+
"username=\"#{self.user.username}\" "+
|
256
|
+
"fullname=\"#{self.user.realname}\" /></auth>"
|
259
257
|
end
|
260
258
|
end
|
261
259
|
|
@@ -272,10 +270,10 @@ end
|
|
272
270
|
|
273
271
|
class Flickr::Person
|
274
272
|
attr_accessor :nsid, :username, :realname, :mbox_sha1sum, :location,
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
273
|
+
:photosurl, :profileurl, :photos_firstdate, :photos_firstdatetaken,
|
274
|
+
:photos_count, :info_fetched, :isadmin, :ispro, :iconserver,
|
275
|
+
:bandwidth_max, :bandwidth_used, :filesize_max, :upload_fetched,
|
276
|
+
:friend, :family, :ignored
|
279
277
|
|
280
278
|
def initialize(flickr, nsid, username)
|
281
279
|
@flickr = flickr
|
@@ -307,11 +305,11 @@ class Flickr::Person
|
|
307
305
|
|
308
306
|
p.username = username
|
309
307
|
p.isadmin = cond_attr(att,'isadmin') &&
|
310
|
-
|
308
|
+
cond_attr(att,'isadmin') == '1'
|
311
309
|
p.ispro = cond_attr(att,'ispro') &&
|
312
|
-
|
310
|
+
cond_attr(att,'ispro') == '1'
|
313
311
|
p.iconserver = cond_attr(att,'iconserver') &&
|
314
|
-
|
312
|
+
cond_attr(att,'iconserver').to_i
|
315
313
|
p.realname = cond_text(els,'/person/realname')
|
316
314
|
p.mbox_sha1sum = cond_text(els,'/person/mbox_sha1sum')
|
317
315
|
p.location = cond_text(els,'/person/location')
|
@@ -321,7 +319,7 @@ class Flickr::Person
|
|
321
319
|
p.photos_firstdate = Time.at(tstr.to_i) if tstr
|
322
320
|
tstr = cond_text(els, '/person/photos/firstdatetaken')
|
323
321
|
p.photos_firstdatetaken = Time.gm(*ParseDate.parsedate(tstr)) if
|
324
|
-
|
322
|
+
tstr
|
325
323
|
p.photos_count = cond_text(els,'/person/photos/count')
|
326
324
|
p.photos_count = p.photos_count if p.photos_count
|
327
325
|
|
@@ -330,14 +328,14 @@ class Flickr::Person
|
|
330
328
|
if els['/user/bandwidth']
|
331
329
|
att = els['/user/bandwidth'].attributes
|
332
330
|
p.bandwidth_max = cond_attr(att,'max') &&
|
333
|
-
|
331
|
+
cond_attr(att,'max').to_i
|
334
332
|
p.bandwidth_used = cond_attr(att,'used') &&
|
335
|
-
|
333
|
+
cond_attr(att,'used').to_i
|
336
334
|
end
|
337
335
|
if els['/user/filesize']
|
338
336
|
att = els['/user/filesize'].attributes
|
339
337
|
p.filesize_max = cond_attr(att,'max') &&
|
340
|
-
|
338
|
+
cond_attr(att,'max').to_i
|
341
339
|
end
|
342
340
|
|
343
341
|
p.upload_fetched = true if p.bandwidth_max
|
@@ -374,11 +372,11 @@ end
|
|
374
372
|
|
375
373
|
class Flickr::Photo
|
376
374
|
attr_accessor :id, :owner_id, :secret, :server, :title, :ispublic,
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
375
|
+
:isfriend, :isfamily, :ownername, :dateadded,
|
376
|
+
:license_id, :description, :dates, :taken,
|
377
|
+
:lastupdate, :takengranularity, :cancomment, :canaddmeta,
|
378
|
+
:comments, :rotation, :notes, :urls, :permaddmeta,
|
379
|
+
:permcomment, :originalformat, :farm
|
382
380
|
|
383
381
|
attr_reader :flickr
|
384
382
|
|
@@ -388,7 +386,7 @@ class Flickr::Photo
|
|
388
386
|
|
389
387
|
def max_size
|
390
388
|
sizes[:Original] || sizes[:Large] || sizes[:Medium] ||
|
391
|
-
|
389
|
+
sizes[:Small]
|
392
390
|
end
|
393
391
|
|
394
392
|
def initialize(flickr,id)
|
@@ -410,8 +408,8 @@ class Flickr::Photo
|
|
410
408
|
base = "http://farm#{@farm}.static.flickr.com"
|
411
409
|
ext = (size == 'o') ? self.originalformat : 'jpg'
|
412
410
|
return size ?
|
413
|
-
|
414
|
-
|
411
|
+
"#{base}/#@server/#{@id}_#{@secret}_#{size}.#{ext}" :
|
412
|
+
"#{base}/#@server/#{@id}_#{@secret}.jpg"
|
415
413
|
end
|
416
414
|
|
417
415
|
def delete() @flickr.photos.delete(self) end
|
@@ -424,10 +422,10 @@ class Flickr::Photo
|
|
424
422
|
photo ||= Flickr::Photo.new(flickr,phid)
|
425
423
|
|
426
424
|
photo.owner_id ||= att['owner'] || (xml.elements['owner'] &&
|
427
|
-
|
425
|
+
xml.elements['owner'].attributes['nsid'])
|
428
426
|
photo.secret = att['secret'] if att['secret']
|
429
427
|
photo.originalformat = att['originalformat'] if
|
430
|
-
|
428
|
+
att['originalformat']
|
431
429
|
photo.server = att['server'].to_i if att['server']
|
432
430
|
photo.title = att['title'] || cond_text(xml.elements,'title')
|
433
431
|
photo.license_id = att['license']
|
@@ -438,10 +436,10 @@ class Flickr::Photo
|
|
438
436
|
photo.isfriend = (att['isfriend'].to_i == 1) if att['isfriend']
|
439
437
|
photo.isfamily = (att['isfamily'].to_i == 1) if att['isfamily']
|
440
438
|
photo.ownername = att['ownername'] || (xml.elements['owner'] &&
|
441
|
-
|
439
|
+
xml.elements['owner'].attributes['username'])
|
442
440
|
photo.description = cond_text(xml.elements,'description')
|
443
441
|
photo.dateadded = Time.at(att['dateadded'].to_i) if
|
444
|
-
|
442
|
+
att['dateadded']
|
445
443
|
if xml.elements['exif']
|
446
444
|
list = []
|
447
445
|
xml.elements.each('exif') do |el|
|
@@ -521,7 +519,7 @@ class Flickr::Exif
|
|
521
519
|
att['tag'],att['label'])
|
522
520
|
exif.raw=element.elements['raw'].text if element.elements['raw']
|
523
521
|
exif.clean=element.elements['clean'].text if
|
524
|
-
|
522
|
+
element.elements['clean']
|
525
523
|
return exif
|
526
524
|
end
|
527
525
|
end
|
@@ -571,13 +569,13 @@ class Flickr::SubCategory
|
|
571
569
|
end
|
572
570
|
|
573
571
|
class Flickr::Group
|
574
|
-
# The privacy attribute is 1 for private groups, 2 for invite-only public
|
575
|
-
# groups and 3 for open public groups.
|
572
|
+
# The privacy attribute is 1 for private groups, 2 for invite-only public
|
573
|
+
# groups and 3 for open public groups.
|
576
574
|
PRIVACY = [nil,:private,:invite,:public]
|
577
575
|
|
578
576
|
attr_accessor :nsid, :name, :members, :online, :chatnsid, :inchat,
|
579
|
-
|
580
|
-
|
577
|
+
:description, :privacy, :eighteenplus, :fully_fetched, :admin,
|
578
|
+
:photo_count, :iconserver
|
581
579
|
|
582
580
|
def initialize(flickr,nsid, name=nil, members=nil, online=nil,
|
583
581
|
chatnsid=nil, inchat=nil)
|
@@ -609,10 +607,10 @@ end
|
|
609
607
|
|
610
608
|
class Flickr::Context
|
611
609
|
attr_reader :prev_id,:prev_secret,:prev_title,:prev_url,
|
612
|
-
|
610
|
+
:next_id,:next_secret,:next_title,:next_url
|
613
611
|
|
614
612
|
def initialize(prev_id,prev_secret,prev_title,prev_url,
|
615
|
-
|
613
|
+
next_id,next_secret,next_title,next_url)
|
616
614
|
@prev_id = prev_id
|
617
615
|
@prev_secret = prev_secret
|
618
616
|
@prev_title = prev_title
|
@@ -643,7 +641,7 @@ class Flickr::License
|
|
643
641
|
def self.from_xml(xml)
|
644
642
|
att = xml.attributes
|
645
643
|
return Flickr::License.new(att['id'],att['name'],
|
646
|
-
|
644
|
+
att['url'])
|
647
645
|
end
|
648
646
|
end
|
649
647
|
|
@@ -682,8 +680,8 @@ class Flickr::Count
|
|
682
680
|
def self.from_xml(xml)
|
683
681
|
att = xml.attributes
|
684
682
|
return Flickr::Count.new(att['count'].to_i,
|
685
|
-
|
686
|
-
|
683
|
+
Time.at(att['fromdate'].to_i),
|
684
|
+
Time.at(att['todate'].to_i))
|
687
685
|
end
|
688
686
|
end
|
689
687
|
|
@@ -710,7 +708,7 @@ end
|
|
710
708
|
|
711
709
|
class Flickr::PhotoSet < Array
|
712
710
|
attr_accessor :id, :title, :url, :server, :primary_id,
|
713
|
-
|
711
|
+
:photo_count, :description, :secret, :owner
|
714
712
|
|
715
713
|
def initialize(id,flickr)
|
716
714
|
@id = id
|
@@ -746,7 +744,7 @@ class Flickr::PhotoSet < Array
|
|
746
744
|
set.photo_count = att['photos'].to_i
|
747
745
|
set.title = xml.elements['title'].text if xml.elements['title']
|
748
746
|
set.description = xml.elements['description'].text if
|
749
|
-
|
747
|
+
xml.elements['description']
|
750
748
|
if xml.elements['photo']
|
751
749
|
set.clear
|
752
750
|
xml.elements.each('photo') do |el|
|
@@ -798,9 +796,9 @@ class Flickr::PhotoPool < Array
|
|
798
796
|
pool.perpage = att['perpage'].to_i if att['perpage']
|
799
797
|
pool.total = att['total'].to_i if att['total']
|
800
798
|
if xml.elements['photo']
|
801
|
-
# I'd like to clear the pool, but I can't because I don't know if I'm
|
802
|
-
# parsing the full set or just a single "page".
|
803
|
-
# pool.clear
|
799
|
+
# I'd like to clear the pool, but I can't because I don't know if I'm
|
800
|
+
# parsing the full set or just a single "page".
|
801
|
+
# pool.clear
|
804
802
|
xml.elements.each('photo') do |el|
|
805
803
|
pool.<<(Flickr::Photo.from_xml(el,flickr),true)
|
806
804
|
end
|
data/lib/flickr/contacts.rb
CHANGED
@@ -23,9 +23,9 @@ require 'flickr/base'
|
|
23
23
|
class Flickr::Contacts < Flickr::APIBase
|
24
24
|
def getList(filter=nil)
|
25
25
|
res = filter ?
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
@flickr.call_method('flickr.contacts.getList') :
|
27
|
+
@flickr.call_method('flickr.contacts.getList',
|
28
|
+
'filter'=>filter)
|
29
29
|
list = []
|
30
30
|
res.elements['/contacts'].each_element do |e|
|
31
31
|
att = e.attributes
|
@@ -50,7 +50,7 @@ class Flickr::Contacts < Flickr::APIBase
|
|
50
50
|
def getPublicList(user)
|
51
51
|
user = user.nsid if user.class == Flickr::Person
|
52
52
|
res = @flickr.call_method('flickr.contacts.getPublicList',
|
53
|
-
|
53
|
+
'user_id'=>user)
|
54
54
|
list = []
|
55
55
|
res.elements['/contacts'].each_element do |e|
|
56
56
|
att = e.attributes
|
data/lib/flickr/groups.rb
CHANGED
@@ -26,7 +26,7 @@ class Flickr::Groups < Flickr::APIBase
|
|
26
26
|
# category can be a Category or nsid string
|
27
27
|
def browse(category=nil)
|
28
28
|
category=category.id if (category.class == Flickr::Category ||
|
29
|
-
|
29
|
+
category.class == Flickr::SubCategory )
|
30
30
|
|
31
31
|
args = category ? {'cat_id' => category } : {}
|
32
32
|
res = @flickr.call_method('flickr.groups.browse',args)
|
@@ -89,7 +89,7 @@ class Flickr::Groups < Flickr::APIBase
|
|
89
89
|
att = e.attributes
|
90
90
|
nsid = att['nsid']
|
91
91
|
g = @flickr.group_cache_lookup(nsid) ||
|
92
|
-
|
92
|
+
Flickr::Group.new(@flickr,nsid)
|
93
93
|
g.name = att['name']
|
94
94
|
g.eighteenplus = att['eighteenplus'].to_i == 1
|
95
95
|
|
@@ -27,13 +27,13 @@ class Flickr::Interestingness < Flickr::APIBase
|
|
27
27
|
args['date'] = date if date.is_a?(String)
|
28
28
|
args['date'] = date.to_s if date.is_a?(Date)
|
29
29
|
args['date'] = @flickr.mysql_date(date) if
|
30
|
-
|
30
|
+
date.is_a?(Time)
|
31
31
|
end
|
32
32
|
extras = extras.join(',') if extras.class == Array
|
33
33
|
args['extras'] = extras if extras
|
34
34
|
args['per_page'] = per_page if per_page
|
35
35
|
args['page'] = page if page
|
36
|
-
|
36
|
+
res = @flickr.call_method('flickr.interestingness.getList',args)
|
37
37
|
return Flickr::PhotoSet.from_xml(res.root,@flickr)
|
38
38
|
end
|
39
39
|
end
|
data/lib/flickr/licenses.rb
CHANGED
@@ -23,7 +23,7 @@ require 'flickr/base'
|
|
23
23
|
class Flickr::Licenses < Flickr::APIBase
|
24
24
|
def getInfo
|
25
25
|
return @flickr.license_cache_lookup if
|
26
|
-
|
26
|
+
@flickr.license_cache_lookup
|
27
27
|
list = {}
|
28
28
|
res = @flickr.call_method('flickr.photos.licenses.getInfo')
|
29
29
|
res.elements['/licenses'].each_element do |el|
|
data/lib/flickr/people.rb
CHANGED
@@ -39,14 +39,14 @@ class Flickr::People < Flickr::APIBase
|
|
39
39
|
def getInfo(user)
|
40
40
|
user = user.nsid if user.class == Flickr::Person
|
41
41
|
res = @flickr.call_method('flickr.people.getInfo',
|
42
|
-
|
42
|
+
'user_id'=>user)
|
43
43
|
person = Flickr::Person.from_xml(res,@flickr)
|
44
44
|
return person
|
45
45
|
end
|
46
46
|
|
47
47
|
# user can be a Person or an nsid
|
48
48
|
def getPublicGroups(user)
|
49
|
-
|
49
|
+
require 'flickr/groups'
|
50
50
|
groups = @flickr.groups
|
51
51
|
user = user.nsid if user.class == Flickr::Person
|
52
52
|
res = @flickr.call_method('flickr.people.getPublicGroups',
|
@@ -57,7 +57,7 @@ class Flickr::People < Flickr::APIBase
|
|
57
57
|
nsid = att['nsid']
|
58
58
|
|
59
59
|
g = @flickr.group_cache_lookup(nsid) ||
|
60
|
-
|
60
|
+
Flickr::Group.new(@flickr,nsid)
|
61
61
|
|
62
62
|
g.name = att['name']
|
63
63
|
g.eighteenplus = att['eighteenplus'].to_i == 1
|
@@ -92,7 +92,7 @@ class Flickr::People < Flickr::APIBase
|
|
92
92
|
def getUploadStatus(user)
|
93
93
|
user = user.nsid if user.class == Flickr::Person
|
94
94
|
res = @flickr.call_method('flickr.people.getUploadStatus',
|
95
|
-
|
95
|
+
'user_id'=>user)
|
96
96
|
person = Flickr::Person.from_xml(res,@flickr)
|
97
97
|
return person
|
98
98
|
end
|
data/lib/flickr/photos.rb
CHANGED
@@ -22,22 +22,22 @@ require 'flickr/base'
|
|
22
22
|
|
23
23
|
class Flickr::Photos < Flickr::APIBase
|
24
24
|
def upload
|
25
|
-
|
25
|
+
require 'flickr/upload'
|
26
26
|
@upload ||= Flickr::Upload.new(@flickr)
|
27
27
|
end
|
28
28
|
|
29
29
|
def licenses
|
30
|
-
|
30
|
+
require 'flickr/licenses'
|
31
31
|
@licenses ||= Flickr::Licenses.new(@flickr)
|
32
32
|
end
|
33
33
|
|
34
34
|
def notes
|
35
|
-
|
35
|
+
require 'flickr/notes'
|
36
36
|
@notes ||= Flickr::Notes.new(@flickr)
|
37
37
|
end
|
38
38
|
|
39
39
|
def transform
|
40
|
-
|
40
|
+
require 'flickr/transform'
|
41
41
|
@transform ||= Flickr::Transform.new(@flickr)
|
42
42
|
end
|
43
43
|
|
@@ -79,7 +79,7 @@ class Flickr::Photos < Flickr::APIBase
|
|
79
79
|
att = set.attributes
|
80
80
|
psid = att['id']
|
81
81
|
set = @flickr.photoset_cache_lookup(psid) ||
|
82
|
-
|
82
|
+
Flickr::PhotoSet.new(att['id'],@flickr)
|
83
83
|
set.title = att['title']
|
84
84
|
|
85
85
|
@flickr.photoset_cache_store(set)
|
@@ -90,7 +90,7 @@ class Flickr::Photos < Flickr::APIBase
|
|
90
90
|
ppid = att['id']
|
91
91
|
|
92
92
|
p = @flickr.photopool_cache_lookup(ppid) ||
|
93
|
-
|
93
|
+
Flickr::PhotoPool.new(ppid,@flickr)
|
94
94
|
p.title = att['title']
|
95
95
|
@flickr.photopool_cache_store(ppid)
|
96
96
|
list << p
|
@@ -106,8 +106,8 @@ class Flickr::Photos < Flickr::APIBase
|
|
106
106
|
att = perms.attributes
|
107
107
|
phid = att['id']
|
108
108
|
photo = (photo.class == Flickr::Photo) ? photo :
|
109
|
-
|
110
|
-
|
109
|
+
(@flickr.photo_cache_lookup(phid) ||
|
110
|
+
Flickr::Photo.new(@flickr,phid))
|
111
111
|
photo.ispublic = (att['ispublic'].to_i == 1)
|
112
112
|
photo.isfriend = (att['isfriend'].to_i == 1)
|
113
113
|
photo.isfamily = (att['isfamily'].to_i == 1)
|
@@ -120,12 +120,12 @@ class Flickr::Photos < Flickr::APIBase
|
|
120
120
|
perm_addmeta)
|
121
121
|
photo = photo.id if photo.class == Flickr::Photo
|
122
122
|
args = {
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
123
|
+
'photo_id' => photo,
|
124
|
+
'is_public' => (is_public == true || is_public == 1) ? 1 : 0,
|
125
|
+
'is_friend' => (is_friend == true || is_friend == 1) ? 1 : 0,
|
126
|
+
'is_family' => (is_family == true || is_family == 1) ? 1 : 0,
|
127
|
+
'perm_comment' => perm_comment,
|
128
|
+
'perm_addmeta' => perm_addmeta
|
129
129
|
}
|
130
130
|
res = @flickr.call_method('flickr.photos.setPerms',args)
|
131
131
|
end
|
@@ -135,11 +135,11 @@ class Flickr::Photos < Flickr::APIBase
|
|
135
135
|
args = {}
|
136
136
|
args['count'] = count if count
|
137
137
|
args['just_friends'] = just_friends ? '1' : '0' if
|
138
|
-
|
138
|
+
just_friends != nil
|
139
139
|
args['single_photo'] = single_photo ? '1' : '0' if
|
140
|
-
|
140
|
+
single_photo != nil
|
141
141
|
args['include_self'] = include_self ? '1' : '0' if
|
142
|
-
|
142
|
+
include_self != nil
|
143
143
|
res= @flickr.call_method('flickr.photos.getContactsPhotos',args)
|
144
144
|
return Flickr::PhotoList.from_xml(res,@flickr)
|
145
145
|
end
|
@@ -153,14 +153,14 @@ class Flickr::Photos < Flickr::APIBase
|
|
153
153
|
args['count'] = count if count
|
154
154
|
args['user_id'] = user
|
155
155
|
args['just_friends'] = just_friends ? '1' : '0' if
|
156
|
-
|
156
|
+
just_friends != nil
|
157
157
|
args['single_photo'] = single_photo ? '1' : '0' if
|
158
|
-
|
158
|
+
single_photo != nil
|
159
159
|
args['include_self'] = include_self ? '1' : '0' if
|
160
|
-
|
160
|
+
include_self != nil
|
161
161
|
res=@flickr.call_method('flickr.photos.getContactsPublicPhotos',
|
162
|
-
|
163
|
-
|
162
|
+
args)
|
163
|
+
return Flickr::PhotoList.from_xml(res,@flickr)
|
164
164
|
end
|
165
165
|
|
166
166
|
def getContext(photo)
|
@@ -174,7 +174,7 @@ class Flickr::Photos < Flickr::APIBase
|
|
174
174
|
args = {}
|
175
175
|
args['dates'] = dates.map{|d| d.to_i}.join(',') if dates
|
176
176
|
args['taken_dates'] = taken_dates.map{|d| d.to_i}.join(',') if
|
177
|
-
|
177
|
+
taken_dates
|
178
178
|
res = @flickr.call_method('flickr.photos.getCounts',args)
|
179
179
|
list = []
|
180
180
|
res.elements['/photocounts'].each_element('photocount') do |el|
|
@@ -232,8 +232,8 @@ class Flickr::Photos < Flickr::APIBase
|
|
232
232
|
def getSizes(photo)
|
233
233
|
photo_id = (photo.class == Flickr::Photo) ? photo.id : photo
|
234
234
|
photo = (photo.class == Flickr::Photo) ? photo :
|
235
|
-
|
236
|
-
|
235
|
+
(@flickr.photo_cache_lookup(photo_id) ||
|
236
|
+
Flickr::Photo.new(@flickr,photo_id))
|
237
237
|
res = @flickr.call_method('flickr.photos.getSizes',
|
238
238
|
'photo_id' => photo_id )
|
239
239
|
photo.sizes = {}
|
@@ -250,12 +250,12 @@ class Flickr::Photos < Flickr::APIBase
|
|
250
250
|
photo = photo.id if photo.class == Flickr::Photo
|
251
251
|
date_posted = date_posted.to_i if date_posted.class == Time
|
252
252
|
date_taken = @flickr.mysql_datetime(date_taken) if
|
253
|
-
|
253
|
+
date_taken.class == Time
|
254
254
|
args = {'photo_id' => photo}
|
255
255
|
args['date_posted'] = date_posted if date_posted
|
256
256
|
args['date_taken'] = date_taken if date_taken
|
257
257
|
args['date_taken_granularity'] = date_taken_granularity if
|
258
|
-
|
258
|
+
date_taken_granularity
|
259
259
|
@flickr.call_method('flickr.photos.setDates',args)
|
260
260
|
end
|
261
261
|
|
@@ -268,19 +268,19 @@ class Flickr::Photos < Flickr::APIBase
|
|
268
268
|
end
|
269
269
|
|
270
270
|
def search(user=nil,tags=nil,tag_mode=nil,text=nil,min_upload_date=nil,
|
271
|
-
|
272
|
-
|
271
|
+
max_upload_date=nil,min_taken_date=nil,max_taken_date=nil,
|
272
|
+
license=nil,extras=nil,per_page=nil,page=nil,sort=nil)
|
273
273
|
|
274
274
|
user = user.nsid if user.respond_to?(:nsid)
|
275
275
|
tags = tags.join(',') if tags.class == Array
|
276
276
|
min_upload_date = min_upload_date.to_i if
|
277
|
-
|
277
|
+
min_upload_date.class == Time
|
278
278
|
max_upload_date = max_upload_date.to_i if
|
279
|
-
|
279
|
+
max_upload_date.class == Time
|
280
280
|
min_taken_date = @flickr.mysql_datetime(min_taken_date) if
|
281
|
-
|
281
|
+
min_taken_date.class == Time
|
282
282
|
max_taken_date = @flickr.mysql_datetime(max_taken_date) if
|
283
|
-
|
283
|
+
max_taken_date.class == Time
|
284
284
|
license = license.id if license.class == Flickr::License
|
285
285
|
extras = extras.join(',') if extras.class == Array
|
286
286
|
|
data/lib/flickr/photosets.rb
CHANGED
@@ -33,9 +33,9 @@ class Flickr::PhotoSets < Flickr::APIBase
|
|
33
33
|
|
34
34
|
def create(title,primary_photo, description = nil)
|
35
35
|
primary_photo = primary_photo.id if
|
36
|
-
|
36
|
+
primary_photo.class == Flickr::Photo
|
37
37
|
args = { 'title' => title, 'primary_photo_id' =>
|
38
|
-
|
38
|
+
primary_photo}
|
39
39
|
args['description'] = description if description
|
40
40
|
res = @flickr.call_method('flickr.photosets.create',args)
|
41
41
|
id = res.elements['/photoset'].attributes['id']
|
@@ -64,7 +64,7 @@ class Flickr::PhotoSets < Flickr::APIBase
|
|
64
64
|
def editPhotos(photoset,primary_photo,photos)
|
65
65
|
photoset = photoset.id if photoset.class == Flickr::PhotoSet
|
66
66
|
primary_photo = primary_photo.id if
|
67
|
-
|
67
|
+
primary_photo.class == Flickr::Photo
|
68
68
|
photos=photos.map{|p| p.id if p.class==Flickr::Photo}.join(',')
|
69
69
|
args = {'photoset_id' => photoset,
|
70
70
|
'primary_photo_id' => primary_photo,
|
@@ -119,6 +119,6 @@ class Flickr::PhotoSets < Flickr::APIBase
|
|
119
119
|
photosets=photosets.map { |ps|
|
120
120
|
(ps.class==Flickr::PhotoSet) ? ps.id : ps}.join(',')
|
121
121
|
@flickr.call_method('flickr.photosets.orderSets',
|
122
|
-
|
122
|
+
'photoset_ids' => photosets)
|
123
123
|
end
|
124
124
|
end
|
data/lib/flickr/pools.rb
CHANGED
@@ -61,7 +61,7 @@ class Flickr::Pools < Flickr::APIBase
|
|
61
61
|
att = el.attributes
|
62
62
|
nsid = att['nsid']
|
63
63
|
g = @flickr.group_cache_lookup(nsid) ||
|
64
|
-
|
64
|
+
Flickr::Group.new(@flickr,nsid,att['name'])
|
65
65
|
g.name = att['name']
|
66
66
|
g.admin = att['admin'].to_i == 1
|
67
67
|
g.privacy = Flickr::Group::PRIVACY[att['privacy'].to_i]
|
@@ -79,7 +79,7 @@ class Flickr::Pools < Flickr::APIBase
|
|
79
79
|
group = group.id.to_s if group.class == Flickr::PhotoPool
|
80
80
|
args = { 'group_id' => group }
|
81
81
|
args['tags'] = tags.map{|t| t.clean if t.class ==
|
82
|
-
|
82
|
+
Flick::Tag}.join(',') if tags
|
83
83
|
args['extras'] = extras.join(',') if extras.class == Array
|
84
84
|
args['per_page'] = per_page if per_page
|
85
85
|
args['page'] = page if page
|
data/lib/flickr/reflection.rb
CHANGED
@@ -22,7 +22,7 @@ require 'flickr/base'
|
|
22
22
|
|
23
23
|
class Flickr::Method
|
24
24
|
attr_reader :name,:authenticated,:description,:response,:explanation,
|
25
|
-
|
25
|
+
:arguments, :errors
|
26
26
|
|
27
27
|
def initialize(name,authenticated,description,response,explanation)
|
28
28
|
@name = name
|
@@ -54,11 +54,11 @@ class Flickr::Reflection < Flickr::APIBase
|
|
54
54
|
els = res.elements
|
55
55
|
att = res.root.attributes
|
56
56
|
desc = els['/method/description'] ?
|
57
|
-
|
57
|
+
els['/method/description'].text : nil
|
58
58
|
resp = els['/method/response'] ?
|
59
|
-
|
59
|
+
els['/method/response'].text : nil
|
60
60
|
expl = els['/method/explanation'] ?
|
61
|
-
|
61
|
+
els['/method/explanation'].text : nil
|
62
62
|
meth = Flickr::Method.new(att['name'],att['needslogin'].to_i==1,
|
63
63
|
desc,resp,expl)
|
64
64
|
els['/method/arguments'].each_element do |el|
|
data/lib/flickr/tags.rb
CHANGED
@@ -28,8 +28,8 @@ class Flickr::Tags < Flickr::APIBase
|
|
28
28
|
xml = res.root
|
29
29
|
phid = xml.attributes['id']
|
30
30
|
photo = (photo.class == Flickr::Photo) ? photo :
|
31
|
-
|
32
|
-
|
31
|
+
(@flickr.photo_cache_lookup(phid) ||
|
32
|
+
Flickr::Photo.new(@flickr,phid))
|
33
33
|
if xml.elements['tags']
|
34
34
|
tags = []
|
35
35
|
xml.elements['tags'].each_element do |el|
|
data/lib/flickr/upload.rb
CHANGED
@@ -54,10 +54,10 @@ class Flickr::FormPart
|
|
54
54
|
|
55
55
|
def to_s
|
56
56
|
([ "Content-Disposition: form-data" ] +
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
attributes.map{|k,v| "#{k}=\"#{v}\""}).
|
58
|
+
join('; ') + "\r\n"+
|
59
|
+
(@mime_type ? "Content-Type: #{@mime_type}\r\n" : '')+
|
60
|
+
"\r\n#{data}"
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -66,26 +66,26 @@ class Flickr::MultiPartForm
|
|
66
66
|
|
67
67
|
def initialize(boundary=nil)
|
68
68
|
@boundary = boundary ||
|
69
|
-
|
69
|
+
"----------------------------Ruby#{rand(1000000000000)}"
|
70
70
|
@parts = []
|
71
71
|
end
|
72
72
|
|
73
73
|
def to_s
|
74
74
|
"--#@boundary\r\n"+
|
75
|
-
|
76
|
-
|
75
|
+
parts.map{|p| p.to_s}.join("\r\n--#@boundary\r\n")+
|
76
|
+
"\r\n--#@boundary--\r\n"
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
class Flickr::Upload < Flickr::APIBase
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
# TODO: It would probably be better if we wrapped the fault
|
83
|
+
# in something more meaningful. At the very least, a broad
|
84
|
+
# division of errors, such as retryable and fatal.
|
85
85
|
def error(el)
|
86
86
|
att = el.attributes
|
87
87
|
fe = XMLRPC::FaultException.new(att['code'].to_i,
|
88
|
-
|
88
|
+
att['msg'])
|
89
89
|
$stderr.puts "ERR: #{fe.faultString} (#{fe.faultCode})"
|
90
90
|
raise fe
|
91
91
|
end
|
@@ -96,7 +96,7 @@ class Flickr::Upload < Flickr::APIBase
|
|
96
96
|
parts = []
|
97
97
|
parts << Flickr::FormPart.new('title',title) if title
|
98
98
|
parts << Flickr::FormPart.new('description',description) if
|
99
|
-
|
99
|
+
description
|
100
100
|
parts << Flickr::FormPart.new('tags',tags.join(',')) if tags
|
101
101
|
parts << Flickr::FormPart.new('is_public',
|
102
102
|
is_public ? '1' : '0') if is_public != nil
|
@@ -109,7 +109,7 @@ class Flickr::Upload < Flickr::APIBase
|
|
109
109
|
|
110
110
|
parts << Flickr::FormPart.new('api_key',@flickr.api_key)
|
111
111
|
parts << Flickr::FormPart.new('auth_token',
|
112
|
-
|
112
|
+
@flickr.auth.token.token)
|
113
113
|
parts << Flickr::FormPart.new('api_sig',sig)
|
114
114
|
|
115
115
|
parts << Flickr::FormPart.new('photo',data,mimetype)
|
@@ -133,10 +133,10 @@ class Flickr::Upload < Flickr::APIBase
|
|
133
133
|
|
134
134
|
def send_form(form)
|
135
135
|
headers = {"Content-Type" =>
|
136
|
-
|
136
|
+
"multipart/form-data; boundary=" + form.boundary}
|
137
137
|
|
138
138
|
http = Net::HTTP.new('www.flickr.com', 80)
|
139
|
-
# http.read_timeout = 900 # 15 minutes max upload time
|
139
|
+
# http.read_timeout = 900 # 15 minutes max upload time
|
140
140
|
tries = 3
|
141
141
|
begin
|
142
142
|
res=http.post('/services/upload/',form.to_s,headers)
|
@@ -156,7 +156,7 @@ class Flickr::Upload < Flickr::APIBase
|
|
156
156
|
data = f.read
|
157
157
|
f.close
|
158
158
|
return upload_image_async(data,mt,filename,title,description,
|
159
|
-
|
159
|
+
tags, is_public,is_friend,is_family)
|
160
160
|
end
|
161
161
|
|
162
162
|
|
@@ -167,7 +167,7 @@ class Flickr::Upload < Flickr::APIBase
|
|
167
167
|
data = f.read
|
168
168
|
f.close
|
169
169
|
return upload_image(data,mt,filename,title,description,tags,
|
170
|
-
|
170
|
+
is_public,is_friend,is_family)
|
171
171
|
end
|
172
172
|
|
173
173
|
def upload_image_async(data,mimetype,filename,title=nil,description=nil,
|
@@ -175,10 +175,10 @@ class Flickr::Upload < Flickr::APIBase
|
|
175
175
|
form = Flickr::MultiPartForm.new
|
176
176
|
|
177
177
|
sig = make_signature(title,description, tags, is_public,
|
178
|
-
|
178
|
+
is_friend, is_family, true)
|
179
179
|
form.parts += prepare_parts(data,mimetype,filename,title,
|
180
|
-
|
181
|
-
|
180
|
+
description, tags, is_public, is_friend,
|
181
|
+
is_family, sig, true)
|
182
182
|
res = REXML::Document.new(send_form(form).body)
|
183
183
|
error(res.elements['/rsp/err']) if res.elements['/rsp/err']
|
184
184
|
t = Flickr::Ticket.new(res.elements['/rsp/ticketid'].text, self)
|
@@ -191,10 +191,10 @@ class Flickr::Upload < Flickr::APIBase
|
|
191
191
|
form = Flickr::MultiPartForm.new
|
192
192
|
|
193
193
|
sig = make_signature(title,description, tags, is_public,
|
194
|
-
|
194
|
+
is_friend, is_family)
|
195
195
|
form.parts += prepare_parts(data,mimetype,filename,title,
|
196
|
-
|
197
|
-
|
196
|
+
description, tags, is_public, is_friend,
|
197
|
+
is_family, sig)
|
198
198
|
res = REXML::Document.new(send_form(form).body)
|
199
199
|
error(res.elements['/rsp/err']) if res.elements['/rsp/err']
|
200
200
|
val = res.elements['/rsp/photoid'].text
|
@@ -212,11 +212,11 @@ class Flickr::Upload < Flickr::APIBase
|
|
212
212
|
att = tick.attributes
|
213
213
|
tid = att['id']
|
214
214
|
t = @flickr.ticket_cache_lookup(tid) ||
|
215
|
-
|
215
|
+
Flickr::Ticket.new(tid,self)
|
216
216
|
t.complete = Flickr::Ticket::COMPLETE[att['complete'].to_i]
|
217
217
|
t.photoid = att['photoid']
|
218
218
|
t.invalid = true if (att['invalid'] &&
|
219
|
-
|
219
|
+
(att['invalid'].to_i == 1))
|
220
220
|
@flickr.ticket_cache_store(t)
|
221
221
|
tickets << t
|
222
222
|
end
|
data/lib/flickr/urls.rb
CHANGED
@@ -50,8 +50,8 @@ class Flickr::Urls < Flickr::APIBase
|
|
50
50
|
nsid = els['/group'].attributes['id']
|
51
51
|
|
52
52
|
g = @flickr.group_cache_lookup(nsid) ||
|
53
|
-
|
54
|
-
|
53
|
+
Flickr::Group.new(@flickr,nsid,
|
54
|
+
els['/group/groupname'].text)
|
55
55
|
@flickr.group_cache_store(g)
|
56
56
|
return g
|
57
57
|
end
|
@@ -61,8 +61,8 @@ class Flickr::Urls < Flickr::APIBase
|
|
61
61
|
els = res.elements
|
62
62
|
nsid = els['/user'].attributes['id']
|
63
63
|
p = @flickr.person_cache_lookup(nsid) ||
|
64
|
-
|
65
|
-
|
64
|
+
Flickr::Person.new(@flickr,nsid,
|
65
|
+
els['/user/username'].text)
|
66
66
|
@flickr.person_cache_store(p)
|
67
67
|
return p
|
68
68
|
end
|
data/test/test_suite.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digitalpardoe-rflickr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- digital:pardoe
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-08 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: mime-types
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
16
25
|
description: rFlickr is a clone of the original RubyForge based rflickr, a Ruby implementation of the Flickr API. It includes a faithful albeit old reproduction of the published API.
|
17
26
|
email: contact@digitalpardoe.co.uk
|
18
27
|
executables: []
|
@@ -21,10 +30,11 @@ extensions: []
|
|
21
30
|
|
22
31
|
extra_rdoc_files:
|
23
32
|
- LICENSE
|
24
|
-
- README.
|
33
|
+
- README.markdown
|
25
34
|
files:
|
35
|
+
- .gitignore
|
26
36
|
- LICENSE
|
27
|
-
- README.
|
37
|
+
- README.markdown
|
28
38
|
- Rakefile
|
29
39
|
- VERSION.yml
|
30
40
|
- lib/flickr.rb
|
@@ -46,10 +56,11 @@ files:
|
|
46
56
|
- lib/flickr/transform.rb
|
47
57
|
- lib/flickr/upload.rb
|
48
58
|
- lib/flickr/urls.rb
|
49
|
-
-
|
50
|
-
- spec/spec_helper.rb
|
59
|
+
- test/test_suite.rb
|
51
60
|
has_rdoc: true
|
52
61
|
homepage: http://github.com/digitalpardoe/rflickr
|
62
|
+
licenses: []
|
63
|
+
|
53
64
|
post_install_message:
|
54
65
|
rdoc_options:
|
55
66
|
- --charset=UTF-8
|
@@ -70,10 +81,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
81
|
requirements: []
|
71
82
|
|
72
83
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.3.4
|
74
85
|
signing_key:
|
75
|
-
specification_version:
|
86
|
+
specification_version: 3
|
76
87
|
summary: rFlickr is a Ruby interface to the Flickr API
|
77
88
|
test_files:
|
78
|
-
-
|
79
|
-
- spec/spec_helper.rb
|
89
|
+
- test/test_suite.rb
|
data/spec/rflickr_spec.rb
DELETED