flickrrb 1.1 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +2 -5
- data/lib/flickrrb.rb +156 -142
- data/test/flickrrb_test.rb +10 -21
- data/test/groups_test.rb +12 -32
- data/test/people_test.rb +16 -21
- data/test/photo_gne_test.rb +7 -7
- data/test/photos_test.rb +36 -50
- data/test/test_helper.rb +17 -17
- metadata +2 -2
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
require 'rake/testtask'
|
2
2
|
require 'rake/rdoctask'
|
3
|
-
#require 'rake/packagetask'
|
4
|
-
require 'rake/gempackagetask'
|
5
3
|
|
6
4
|
|
7
|
-
Rake::TestTask.new
|
5
|
+
Rake::TestTask.new do |t|
|
8
6
|
t.pattern = 'test/*.rb'
|
9
7
|
end
|
10
8
|
|
11
|
-
|
9
|
+
RDoc::Task.new do |rd|
|
12
10
|
rd.rdoc_files.include "README.rdoc", "lib/flickrrb.rb"
|
13
|
-
rd.options << "--inline-source"
|
14
11
|
end
|
15
12
|
|
16
13
|
task 'default' => ['test']
|
data/lib/flickrrb.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
require 'net/http'
|
2
4
|
require 'cgi'
|
3
5
|
require 'rexml/document'
|
@@ -15,9 +17,11 @@ class Flickr
|
|
15
17
|
@method = []
|
16
18
|
end
|
17
19
|
|
20
|
+
private
|
21
|
+
|
18
22
|
def method_missing name, *args
|
19
|
-
unless args.
|
20
|
-
@method
|
23
|
+
unless args.empty? || args.first.class == Hash
|
24
|
+
@method.clear
|
21
25
|
raise APIException, "Args must be a hash"
|
22
26
|
end
|
23
27
|
|
@@ -27,10 +31,10 @@ class Flickr
|
|
27
31
|
p @method if @debug
|
28
32
|
begin
|
29
33
|
command = build_command
|
30
|
-
@method
|
31
|
-
@flickr_client.
|
34
|
+
@method.clear
|
35
|
+
@flickr_client.request(command)
|
32
36
|
rescue
|
33
|
-
@method
|
37
|
+
@method.clear
|
34
38
|
raise
|
35
39
|
end
|
36
40
|
else
|
@@ -53,6 +57,7 @@ class Flickr
|
|
53
57
|
|
54
58
|
@method.each do |m|
|
55
59
|
method << ".#{m.name.to_s}"
|
60
|
+
# Make no args = {} not nil
|
56
61
|
args.merge!(m.args) unless m.args.nil?
|
57
62
|
end
|
58
63
|
|
@@ -64,121 +69,115 @@ class Flickr
|
|
64
69
|
"?method=#{method}&api_key=#{@api_key}&#{a}"
|
65
70
|
end
|
66
71
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
attr :description
|
71
|
-
attr :members
|
72
|
-
|
73
|
-
def initialize xml
|
74
|
-
if xml.elements['name'].nil?
|
75
|
-
init_from_attributes xml
|
76
|
-
else
|
77
|
-
init_from_elements xml
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
private
|
72
|
+
|
73
|
+
class Base
|
74
|
+
attr_accessor :id
|
82
75
|
|
83
|
-
|
84
|
-
@id = xml.attributes['nsid']
|
85
|
-
@name = xml.attributes['name']
|
86
|
-
end
|
76
|
+
alias_method :nsid=, :id=
|
87
77
|
|
88
|
-
def
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
78
|
+
def initialize params
|
79
|
+
params.each do |k,v|
|
80
|
+
if v.class == Hash
|
81
|
+
unless params[k]['_content'].nil?
|
82
|
+
v = params[k]['_content']
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
send "#{k.gsub('?', '')}=", v
|
87
|
+
end
|
93
88
|
end
|
94
|
-
end
|
95
89
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
90
|
+
end
|
91
|
+
|
92
|
+
class Group < Base
|
93
|
+
[:name,
|
94
|
+
:description,
|
95
|
+
:members,
|
96
|
+
:admin,
|
97
|
+
:eighteenplus,
|
98
|
+
:invitation_only,
|
99
|
+
:iconserver,
|
100
|
+
:iconfarm,
|
101
|
+
:privacy,
|
102
|
+
:lang,
|
103
|
+
:ispoolmoderated,
|
104
|
+
:blast,
|
105
|
+
:throttle,
|
106
|
+
:restrictions].each {|a| attr_accessor a}
|
106
107
|
|
107
|
-
|
108
|
-
|
109
|
-
@owner_user_name = xml.attributes['ownername']
|
110
|
-
@owner = xml.attributes['owner']
|
111
|
-
@title = xml.attributes['title']
|
112
|
-
|
113
|
-
if @title.nil?
|
114
|
-
@owner_real_name = xml.elements['owner'].attributes['realname']
|
115
|
-
@owner_user_name = xml.elements['owner'].attributes['username']
|
116
|
-
@owner = xml.elements['owner'].attributes['nsid']
|
117
|
-
@title = xml.elements['title'].text
|
118
|
-
@description = xml.elements['description'].text
|
119
|
-
@date = xml.elements['dates'].attributes['taken']
|
120
|
-
|
121
|
-
@tags = []
|
122
|
-
xml.elements.each('tags/tag') do |t|
|
123
|
-
@tags << t.text
|
124
|
-
end
|
125
|
-
end
|
108
|
+
# {"nsid"=>"34427469792@N01", "name"=>"FlickrCentral", "admin"=>0, "eighteenplus"=>0, "invitation_only"=>0}
|
109
|
+
end
|
126
110
|
|
127
|
-
|
128
|
-
|
111
|
+
class Photo < Base
|
112
|
+
[:owner,
|
113
|
+
:title,
|
114
|
+
:candownload,
|
115
|
+
:description,
|
116
|
+
:tags,
|
117
|
+
:date,
|
118
|
+
:secret,
|
119
|
+
:server,
|
120
|
+
:farm,
|
121
|
+
:ispublic,
|
122
|
+
:isfriend,
|
123
|
+
:isfamily,
|
124
|
+
:ownername,
|
125
|
+
:dateadded,
|
126
|
+
:dateuploaded,
|
127
|
+
:isfavorite,
|
128
|
+
:license,
|
129
|
+
:safety_level,
|
130
|
+
:rotation,
|
131
|
+
:originalsecret,
|
132
|
+
:originalformat,
|
133
|
+
:visibility,
|
134
|
+
:dates,
|
135
|
+
:views,
|
136
|
+
:editability,
|
137
|
+
:publiceditability,
|
138
|
+
:usage,
|
139
|
+
:comments,
|
140
|
+
:notes,
|
141
|
+
:location,
|
142
|
+
:geoperms,
|
143
|
+
:urls,
|
144
|
+
:media].each {|a| attr_accessor a}
|
129
145
|
|
130
|
-
def
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
user name; #{@owner_user_name}\n \
|
135
|
-
real name; #{@owner_real_name}\n \
|
136
|
-
date; #{@date}\n \
|
137
|
-
tags; #{@tags.inspect}"
|
146
|
+
def initialize data
|
147
|
+
super
|
148
|
+
@owner = Person.new(data['owner']) if data['owner'].class == Hash
|
149
|
+
@tags = data['tags']['tag'].collect {|t| t['raw']} unless data['tags'].nil?
|
138
150
|
end
|
139
151
|
end
|
140
152
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
@label = xml.attributes['label']
|
150
|
-
@width = xml.attributes['width']
|
151
|
-
@height = xml.attributes['height']
|
152
|
-
@source = xml.attributes['source']
|
153
|
-
@url = xml.attributes['url']
|
154
|
-
end
|
153
|
+
# {"label"=>"Square", "width"=>75, "height"=>75, "source"=>"http://farm3.static.flickr.com/2402/1848466274_cec90f64ba_s.jpg", "url"=>"http://www.flickr.com/photos/acute-distress/1848466274/sizes/sq/", "media"=>"photo"}
|
154
|
+
class Size < Base
|
155
|
+
[:label,
|
156
|
+
:width,
|
157
|
+
:height,
|
158
|
+
:source,
|
159
|
+
:url,
|
160
|
+
:media].each {|a| attr_accessor a}
|
155
161
|
end
|
156
162
|
|
157
|
-
class Person
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
@realname = xml.elements['realname'].text
|
173
|
-
@location = xml.elements['location'].text
|
174
|
-
@photosurl = xml.elements['photosurl'].text
|
175
|
-
@profileurl = xml.elements['profileurl'].text
|
176
|
-
@photos_count = xml.elements['photos'].elements['count'].text
|
177
|
-
end
|
178
|
-
end
|
163
|
+
class Person < Base
|
164
|
+
[:id,
|
165
|
+
:username,
|
166
|
+
:realname,
|
167
|
+
:ispro,
|
168
|
+
:location,
|
169
|
+
:photosurl,
|
170
|
+
:profileurl,
|
171
|
+
:photos_count,
|
172
|
+
:iconserver,
|
173
|
+
:iconfarm,
|
174
|
+
:path_alias,
|
175
|
+
:mobileurl,
|
176
|
+
:photos].each {|a| attr_accessor a}
|
177
|
+
|
179
178
|
end
|
180
179
|
|
181
|
-
class FlickrClient
|
180
|
+
class FlickrClient # :nodoc:
|
182
181
|
def initialize http = nil, debug = false
|
183
182
|
flickr_url = URI.parse "http://api.flickr.com/"
|
184
183
|
|
@@ -190,28 +189,33 @@ class Flickr
|
|
190
189
|
@debug = debug
|
191
190
|
end
|
192
191
|
|
193
|
-
def
|
194
|
-
p "/services/rest/#{command}" if @debug
|
195
|
-
build_response(@flickr_client.get("/services/rest/#{command}").body)
|
192
|
+
def request command
|
193
|
+
p "/services/rest/#{command}&format=json" if @debug
|
194
|
+
build_response(@flickr_client.get("/services/rest/#{command}&format=json").body)
|
196
195
|
end
|
197
196
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
raise APIException, "Invalid response from Flickr" if doc.root.nil?
|
197
|
+
##### "hello".capitalize Build class to call
|
198
|
+
def build_response j
|
199
|
+
p j if @debug
|
200
|
+
m = j.match(/^jsonFlickrApi\((.+)\)$/)
|
203
201
|
|
204
|
-
|
202
|
+
raise APIException, "Invalid response from Flickr" if m.nil?
|
205
203
|
|
206
|
-
|
207
|
-
|
204
|
+
data = JSON.parse m[1]
|
205
|
+
|
206
|
+
resp = nil
|
207
|
+
if !m.nil? && data['stat'] == 'ok'
|
208
|
+
data.keys.each do |k|
|
209
|
+
next if k == 'stat'
|
210
|
+
resp = self.send(k, data)
|
211
|
+
end
|
208
212
|
else
|
209
|
-
|
213
|
+
raise APIException, "#{data['code']}: #{data['message']}"
|
210
214
|
end
|
211
|
-
|
212
|
-
resp
|
215
|
+
|
216
|
+
resp
|
213
217
|
end
|
214
|
-
|
218
|
+
|
215
219
|
def handle_error xml
|
216
220
|
# This is a bit ugly!
|
217
221
|
code = xml.elements['rsp'].elements['err'].attributes['code']
|
@@ -219,48 +223,58 @@ class Flickr
|
|
219
223
|
raise APIException, "#{code}: #{message}"
|
220
224
|
end
|
221
225
|
|
222
|
-
def
|
223
|
-
|
224
|
-
|
226
|
+
def stat data
|
227
|
+
end
|
228
|
+
|
229
|
+
def groups data
|
230
|
+
data['groups']['group'].collect do |g|
|
231
|
+
group(g)
|
225
232
|
end
|
226
233
|
end
|
227
234
|
|
228
|
-
def group
|
229
|
-
Group.new
|
235
|
+
def group data
|
236
|
+
Group.new data
|
230
237
|
end
|
231
238
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
239
|
+
# {"page"=>1, "pages"=>1, "perpage"=>100, "total"=>"15", "photo"=>[{"id"=>"1848463798", "owner"=>"12656878@N06", "secret"=>"d9fcbdedb5", "server"=>"2103", "farm"=>3, "title"=>"IMG_5628_29_30", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1250311066"}, {"id"=>"1847616297", "owner"=>"12656878@N06", "secret"=>"71461d1f9a", "server"=>"2042", "farm"=>3, "title"=>"IMG_5547_8_9", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1250311040"}, {"id"=>"1847623411", "owner"=>"12656878@N06", "secret"=>"13dc200ffe", "server"=>"2007", "farm"=>3, "title"=>"IMG_5571_2_3", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1250311001"}, {"id"=>"2359596024", "owner"=>"12656878@N06", "secret"=>"2d8fde31d1", "server"=>"2267", "farm"=>3, "title"=>"Criss Cross Castle", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1206397646"}, {"id"=>"2356865849", "owner"=>"12656878@N06", "secret"=>"69697c85d3", "server"=>"3282", "farm"=>4, "title"=>"Alexander Library", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1206353910"}, {"id"=>"2150832683", "owner"=>"12656878@N06", "secret"=>"e97dfa334f", "server"=>"2122", "farm"=>3, "title"=>"IMG_0716_7_8", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1199095628"}, {"id"=>"2151623192", "owner"=>"12656878@N06", "secret"=>"81b8bdcc39", "server"=>"2099", "farm"=>3, "title"=>"IMG_0695_6_7", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1199095610"}, {"id"=>"2150834129", "owner"=>"12656878@N06", "secret"=>"19fb55ffdd", "server"=>"2156", "farm"=>3, "title"=>"IMG_0643_4_5", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1199095592"}, {"id"=>"2150812929", "owner"=>"12656878@N06", "secret"=>"f87fe0ba85", "server"=>"2252", "farm"=>3, "title"=>"IMG_0506_7_8", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1199095509"}, {"id"=>"2150812919", "owner"=>"12656878@N06", "secret"=>"ae39c7e214", "server"=>"2099", "farm"=>3, "title"=>"IMG_0494_5_6", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1199095483"}, {"id"=>"2150812917", "owner"=>"12656878@N06", "secret"=>"ca858d0646", "server"=>"2019", "farm"=>3, "title"=>"IMG_0491_2_3", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1199095461"}, {"id"=>"1848466274", "owner"=>"12656878@N06", "secret"=>"cec90f64ba", "server"=>"2402", "farm"=>3, "title"=>"IMG_5631_2_3", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1194217745"}, {"id"=>"1847626991", "owner"=>"12656878@N06", "secret"=>"a4d0774b17", "server"=>"2022", "farm"=>3, "title"=>"IMG_5574_5_6", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1194128771"}, {"id"=>"1847633163", "owner"=>"12656878@N06", "secret"=>"5089075c7a", "server"=>"2008", "farm"=>3, "title"=>"IMG_5598_599_600", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1194128720"}, {"id"=>"1848469604", "owner"=>"12656878@N06", "secret"=>"e0f8cfeab2", "server"=>"2140", "farm"=>3, "title"=>"IMG_5646_7_8", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0, "ownername"=>"Henry Maddocks", "dateadded"=>"1194128674"}]}
|
240
|
+
def photos data
|
241
|
+
pages = data['photos']['pages']
|
242
|
+
total = data['photos']['total']
|
243
|
+
|
244
|
+
photo_list = data['photos']['photo']
|
238
245
|
|
246
|
+
photos = photo_list.collect do |p|
|
247
|
+
self.photo p
|
248
|
+
end
|
249
|
+
|
239
250
|
return photos, pages.to_i, total.to_i
|
240
251
|
end
|
241
252
|
|
242
|
-
def photo
|
243
|
-
|
253
|
+
def photo data
|
254
|
+
data = data['photo'] unless data['photo'].nil?
|
255
|
+
Photo.new data
|
244
256
|
end
|
245
257
|
|
246
|
-
|
258
|
+
# {"canblog"=>0, "canprint"=>0, "candownload"=>1, "size"=>[{"label"=>"Square", "width"=>75, "height"=>75, "source"=>"http://farm3.static.flickr.com/2402/1848466274_cec90f64ba_s.jpg", "url"=>"http://www.flickr.com/photos/acute-distress/1848466274/sizes/sq/", "media"=>"photo"}, {"label"=>"Thumbnail", "width"=>"100", "height"=>"75", "source"=>"http://farm3.static.flickr.com/2402/1848466274_cec90f64ba_t.jpg", "url"=>"http://www.flickr.com/photos/acute-distress/1848466274/sizes/t/", "media"=>"photo"}, {"label"=>"Small", "width"=>"240", "height"=>"180", "source"=>"http://farm3.static.flickr.com/2402/1848466274_cec90f64ba_m.jpg", "url"=>"http://www.flickr.com/photos/acute-distress/1848466274/sizes/s/", "media"=>"photo"}, {"label"=>"Medium", "width"=>"500", "height"=>"375", "source"=>"http://farm3.static.flickr.com/2402/1848466274_cec90f64ba.jpg", "url"=>"http://www.flickr.com/photos/acute-distress/1848466274/sizes/m/", "media"=>"photo"}, {"label"=>"Medium 640", "width"=>"640", "height"=>480, "source"=>"http://farm3.static.flickr.com/2402/1848466274_cec90f64ba_z.jpg?zz=1", "url"=>"http://www.flickr.com/photos/acute-distress/1848466274/sizes/z/", "media"=>"photo"}, {"label"=>"Original", "width"=>"1280", "height"=>"960", "source"=>"http://farm3.static.flickr.com/2402/1848466274_b76775879a_o.jpg", "url"=>"http://www.flickr.com/photos/acute-distress/1848466274/sizes/o/", "media"=>"photo"}]}
|
259
|
+
def sizes data
|
247
260
|
sizes = []
|
248
|
-
|
261
|
+
data['sizes']['size'].each do |p|
|
249
262
|
s = Size.new(p)
|
250
263
|
sizes << s
|
251
264
|
(class << sizes; self;end).class_eval do
|
252
|
-
define_method(s.label.downcase.gsub(" ", "").to_sym) { s }
|
253
|
-
end
|
265
|
+
define_method(s.label.downcase.gsub(" ", "_").to_sym) { s }
|
266
|
+
end
|
254
267
|
end
|
268
|
+
|
255
269
|
sizes
|
256
270
|
end
|
257
271
|
|
258
|
-
def user
|
259
|
-
Person.new
|
272
|
+
def user data
|
273
|
+
Person.new data['user']
|
260
274
|
end
|
261
275
|
|
262
|
-
def person
|
263
|
-
Person.new
|
276
|
+
def person data
|
277
|
+
Person.new data['person']
|
264
278
|
end
|
265
279
|
end
|
266
280
|
|
data/test/flickrrb_test.rb
CHANGED
@@ -8,9 +8,9 @@ class Test_Flickr < MiniTest::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_api_key_exception
|
11
|
-
flickr = Flickr.new :api_key => "bad_key", :http => @http_client
|
11
|
+
flickr = Flickr.new :api_key => "bad_key", :http => @http_client, :debug => false
|
12
12
|
@http_client.expect :get, flickr_responses[:bad_api_key], flickr_commands[:bad_api_key]
|
13
|
-
|
13
|
+
|
14
14
|
assert_raises APIException do
|
15
15
|
flickr.photos.getInfo(:photo_id => '1848466274')
|
16
16
|
end
|
@@ -19,24 +19,15 @@ class Test_Flickr < MiniTest::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_create_objects
|
22
|
-
|
23
|
-
<?xml version="1.0" encoding="utf-8" ?> \
|
24
|
-
<rsp stat="ok"> \
|
25
|
-
<photos page="1" pages="1" perpage="100" total="4"> \
|
26
|
-
<photo id="1848466274" owner="12656878@N06" secret="cec90f64ba" server="2402" farm="3" title="IMG_5631_2_3" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194217745" /> \
|
27
|
-
<photo id="1847626991" owner="12656878@N06" secret="a4d0774b17" server="2022" farm="3" title="IMG_5574_5_6" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194128771" /> \
|
28
|
-
<photo id="1847633163" owner="12656878@N06" secret="5089075c7a" server="2008" farm="3" title="IMG_5598_599_600" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194128720" /> \
|
29
|
-
<photo id="1848469604" owner="12656878@N06" secret="e0f8cfeab2" server="2140" farm="3" title="IMG_5646_7_8" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194128674" /> \
|
30
|
-
</photos> \
|
31
|
-
</rsp>
|
32
|
-
EOS
|
22
|
+
data = "jsonFlickrApi({\"photos\":{\"page\":1, \"pages\":1, \"perpage\":100, \"total\":\"15\", \"photo\":[{\"id\":\"1848463798\", \"owner\":\"12656878@N06\", \"secret\":\"d9fcbdedb5\", \"server\":\"2103\", \"farm\":3, \"title\":\"IMG_5628_29_30\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1250311066\"}, {\"id\":\"1847616297\", \"owner\":\"12656878@N06\", \"secret\":\"71461d1f9a\", \"server\":\"2042\", \"farm\":3, \"title\":\"IMG_5547_8_9\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1250311040\"}, {\"id\":\"1847623411\", \"owner\":\"12656878@N06\", \"secret\":\"13dc200ffe\", \"server\":\"2007\", \"farm\":3, \"title\":\"IMG_5571_2_3\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1250311001\"}, {\"id\":\"2359596024\", \"owner\":\"12656878@N06\", \"secret\":\"2d8fde31d1\", \"server\":\"2267\", \"farm\":3, \"title\":\"Criss Cross Castle\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1206397646\"}, {\"id\":\"2356865849\", \"owner\":\"12656878@N06\", \"secret\":\"69697c85d3\", \"server\":\"3282\", \"farm\":4, \"title\":\"Alexander Library\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1206353910\"}, {\"id\":\"2150832683\", \"owner\":\"12656878@N06\", \"secret\":\"e97dfa334f\", \"server\":\"2122\", \"farm\":3, \"title\":\"IMG_0716_7_8\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095628\"}, {\"id\":\"2151623192\", \"owner\":\"12656878@N06\", \"secret\":\"81b8bdcc39\", \"server\":\"2099\", \"farm\":3, \"title\":\"IMG_0695_6_7\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095610\"}, {\"id\":\"2150834129\", \"owner\":\"12656878@N06\", \"secret\":\"19fb55ffdd\", \"server\":\"2156\", \"farm\":3, \"title\":\"IMG_0643_4_5\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095592\"}, {\"id\":\"2150812929\", \"owner\":\"12656878@N06\", \"secret\":\"f87fe0ba85\", \"server\":\"2252\", \"farm\":3, \"title\":\"IMG_0506_7_8\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095509\"}, {\"id\":\"2150812919\", \"owner\":\"12656878@N06\", \"secret\":\"ae39c7e214\", \"server\":\"2099\", \"farm\":3, \"title\":\"IMG_0494_5_6\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095483\"}, {\"id\":\"2150812917\", \"owner\":\"12656878@N06\", \"secret\":\"ca858d0646\", \"server\":\"2019\", \"farm\":3, \"title\":\"IMG_0491_2_3\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095461\"}, {\"id\":\"1848466274\", \"owner\":\"12656878@N06\", \"secret\":\"cec90f64ba\", \"server\":\"2402\", \"farm\":3, \"title\":\"IMG_5631_2_3\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1194217745\"}, {\"id\":\"1847626991\", \"owner\":\"12656878@N06\", \"secret\":\"a4d0774b17\", \"server\":\"2022\", \"farm\":3, \"title\":\"IMG_5574_5_6\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1194128771\"}, {\"id\":\"1847633163\", \"owner\":\"12656878@N06\", \"secret\":\"5089075c7a\", \"server\":\"2008\", \"farm\":3, \"title\":\"IMG_5598_599_600\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1194128720\"}, {\"id\":\"1848469604\", \"owner\":\"12656878@N06\", \"secret\":\"e0f8cfeab2\", \"server\":\"2140\", \"farm\":3, \"title\":\"IMG_5646_7_8\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1194128674\"}]}, \"stat\":\"ok\"})"
|
33
23
|
|
34
24
|
flickr = Flickr::FlickrClient.new
|
35
25
|
|
36
|
-
photos, pages, total = flickr.build_response
|
26
|
+
photos, pages, total = flickr.build_response data
|
37
27
|
|
38
|
-
assert_equal
|
39
|
-
assert_equal "
|
28
|
+
assert_equal 15, photos.length
|
29
|
+
assert_equal "IMG_5571_2_3", photos[2].title
|
30
|
+
assert_equal "12656878@N06", photos[2].owner
|
40
31
|
end
|
41
32
|
|
42
33
|
def test_all_together
|
@@ -56,6 +47,7 @@ EOS
|
|
56
47
|
end
|
57
48
|
|
58
49
|
def test_argument_format
|
50
|
+
@http_client.expect :get, flickr_responses[:people_get_info], flickr_commands[:people_get_info]
|
59
51
|
@flickr.people.getInfo
|
60
52
|
|
61
53
|
assert_raises APIException do
|
@@ -95,12 +87,9 @@ EOS
|
|
95
87
|
def test_nice_ids
|
96
88
|
@http_client.expect :get, flickr_responses[:photos_get_sizes], flickr_commands[:photos_get_sizes]
|
97
89
|
|
98
|
-
data =
|
99
|
-
<photo id="1848466274" owner="12656878@N06" secret="cec90f64ba" server="2402" farm="3" title="IMG_5631_2_3" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194217745" />
|
100
|
-
EOS
|
90
|
+
data = "{\"id\":\"6043998263\", \"owner\":\"12656878@N06\", \"secret\":\"4993702a27\", \"server\":\"6073\", \"farm\":7, \"title\":\"Netball\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}"
|
101
91
|
|
102
|
-
|
103
|
-
photo = Flickr::Photo.new xml.root
|
92
|
+
photo = Flickr::Photo.new JSON.parse(data)
|
104
93
|
|
105
94
|
assert @flickr.photos.getSizes(:photo_id => photo.id)
|
106
95
|
assert @flickr.photos.getSizes(:photo_id => photo)
|
data/test/groups_test.rb
CHANGED
@@ -8,46 +8,26 @@ class GroupsTest < MiniTest::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_group
|
11
|
-
|
12
|
-
|
13
|
-
<name>GNEverybody</name>
|
14
|
-
<description>The group for GNE players</description>
|
15
|
-
<members>69</members>
|
16
|
-
<privacy>3</privacy>
|
17
|
-
<throttle count="10" mode="month" remaining="3"/>
|
18
|
-
</group>
|
19
|
-
EOS
|
11
|
+
# @flickr.groups.getInfo :group_id => "34427465497@N01"
|
12
|
+
data = "{\"id\":\"34427465497@N01\", \"iconserver\":\"1\", \"iconfarm\":1, \"name\":{\"_content\":\"GNEverybody\"}, \"description\":{\"_content\":\"GNE is short for "Game Neverending" and this is a group started by GNE players. But it's open to everybody!!\\n\\nGame NeverEnding was the precursor to Flickr and so this group also contains most of Flickr's earliest members.\\n\\n<a href=\\\"http:\\/\\/en.wikipedia.org\\/wiki\\/Game_Neverending\\\">en.wikipedia.org\\/wiki\\/Game_Neverending<\\/a>\\n\\nWhat was Game NeverEnding like? The best overview is here:\\n\\n<a href=\\\"http:\\/\\/www.gnespy.com\\/museum\\/\\\">www.gnespy.com\\/museum\\/<\\/a>\"}, \"members\":{\"_content\":\"244\"}, \"privacy\":{\"_content\":\"3\"}, \"lang\":null, \"ispoolmoderated\":0, \"blast\":{\"_content\":\"<a href=\\\"http:\\/\\/alpha.glitch.com\\\" rel=\\\"nofollow\\\">Glitch<\\/a> <a href=\\\"http:\\/\\/alpha.glitch.com\\\" rel=\\\"nofollow\\\">Glitch<\\/a> <a href=\\\"http:\\/\\/alpha.glitch.com\\\" rel=\\\"nofollow\\\">Glitch<\\/a> <a href=\\\"http:\\/\\/alpha.glitch.com\\\" rel=\\\"nofollow\\\">Glitch<\\/a>\", \"date_blast_added\":\"1268277847\", \"user_id\":\"5649\"}, \"throttle\":{\"mode\":\"none\"}, \"restrictions\":{\"photos_ok\":1, \"videos_ok\":1, \"images_ok\":1, \"screens_ok\":1, \"art_ok\":1, \"safe_ok\":1, \"moderate_ok\":0, \"restricted_ok\":0, \"has_geo\":0}}"
|
20
13
|
|
21
|
-
|
22
|
-
group = Flickr::Group.new xml.root
|
14
|
+
group = Flickr::Group.new JSON.parse(data)
|
23
15
|
|
24
16
|
assert_equal "34427465497@N01", group.id
|
25
17
|
assert_equal "GNEverybody", group.name
|
26
|
-
assert_equal "
|
27
|
-
|
18
|
+
assert_equal "244", group.members
|
19
|
+
assert ! group.admin
|
28
20
|
|
29
21
|
end
|
30
22
|
|
31
23
|
def test_groups
|
32
|
-
|
33
|
-
|
34
|
-
<rsp stat="ok">
|
35
|
-
<groups>
|
36
|
-
<group nsid="34427469792@N01" name="FlickrCentral" admin="0" eighteenplus="0" />
|
37
|
-
<group nsid="37996584485@N01" name="Motorcycles" admin="0" eighteenplus="0" />
|
38
|
-
<group nsid="41894169203@N01" name="Wellington, New Zealand" admin="0" eighteenplus="0" />
|
39
|
-
<group nsid="51035612836@N01" name="Flickr API" admin="0" eighteenplus="0" />
|
40
|
-
<group nsid="52240148330@N01" name="BEER" admin="0" eighteenplus="0" />
|
41
|
-
<group nsid="52241691728@N01" name="Glitch Art" admin="0" eighteenplus="0" />
|
42
|
-
<group nsid="55475894@N00" name="* Vanishing Points *" admin="0" eighteenplus="0" />
|
43
|
-
</groups>
|
44
|
-
</rsp>
|
45
|
-
EOS
|
24
|
+
# @flickr.people.getPublicGroups :user_id => "12656878@N06"
|
25
|
+
data = "jsonFlickrApi({\"groups\":{\"group\":[{\"nsid\":\"34427469792@N01\", \"name\":\"FlickrCentral\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"37996584485@N01\", \"name\":\"Motorcycles\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"41894169203@N01\", \"name\":\"Wellington, New Zealand\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"51035612836@N01\", \"name\":\"Flickr API\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"52240148330@N01\", \"name\":\"BEER\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"52241691728@N01\", \"name\":\"Glitch Art\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"55475894@N00\", \"name\":\"* Vanishing Points *\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"66639191@N00\", \"name\":\"Triumph Motorcycles\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"88412962@N00\", \"name\":\"What's that in your fridge?\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"90587578@N00\", \"name\":\"Twins\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"34246345@N00\", \"name\":\"DoF\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"42239651@N00\", \"name\":\"Manawatu, New Zealand\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"58146428@N00\", \"name\":\"Portrait\\u2605Faces\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"20023350@N00\", \"name\":\"Zen and the Art of Motorcycle Photography\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"89888984@N00\", \"name\":\"HDR\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"53283318@N00\", \"name\":\"Wairarapa, New Zealand\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"89438260@N00\", \"name\":\"Self-Portraits!\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"51988071@N00\", \"name\":\"SportBikes\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"99404851@N00\", \"name\":\"Wanganui, New Zealand-\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"16582005@N00\", \"name\":\"Guess Where Wellington\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"38343303@N00\", \"name\":\"Bokeh: Smooth & Silky\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"72468951@N00\", \"name\":\"TTHDR (True Tone High Dynamic Range)\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"38072161@N00\", \"name\":\"Quality HDR\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"23374016@N00\", \"name\":\"italia in HDR\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"81187335@N00\", \"name\":\"HDR Skies (please read the rules!!!!)\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"65141193@N00\", \"name\":\"My First HDR - beginners group\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"20421382@N00\", \"name\":\"The Portrait Group\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"91672167@N00\", \"name\":\"Gummistiefel, Wellies, Rubberboots, Gumboots\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"29592336@N00\", \"name\":\"Stuck in Customs' Brilliant Cabal - My Cool and Clever Friends\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"59755016@N00\", \"name\":\"Triumph Daytona\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"62454704@N00\", \"name\":\"HDR Unlimited\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"66357807@N00\", \"name\":\"MOTO GUZZI\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"24208866@N00\", \"name\":\"iPhone\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"85243584@N00\", \"name\":\"My Flailing Limbs: a faceless self portrait (feet, arms, legs, h\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"288449@N25\", \"name\":\"This is New Zealand too... (life as we live it) - GROUP CLOSED\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"317731@N24\", \"name\":\"secret New Zealand\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"369386@N21\", \"name\":\"Boatsheds\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"423524@N23\", \"name\":\"Girls in Wellies\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"435980@N21\", \"name\":\"Wellington NZ - Abandoned\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"492041@N22\", \"name\":\"Kiwibiker\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"442819@N24\", \"name\":\"Gandang Pinay(Beautiful Filipina)\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"467839@N20\", \"name\":\"Flickr Fine Art Portrait Gallery\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"499909@N21\", \"name\":\"Weather Photography\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"501290@N25\", \"name\":\"Hyosung Comet Riders (250, 650, GT, R)\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"555892@N21\", \"name\":\"Te Ara - the Encyclopedia of New Zealand\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"587967@N20\", \"name\":\"HDReal\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"623089@N23\", \"name\":\"IN YOUR FACE - the illustrated portrait\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"627001@N23\", \"name\":\"500x500\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"610198@N20\", \"name\":\"Ponoko\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"688206@N23\", \"name\":\"Wellington Boots\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"688798@N23\", \"name\":\"[HDR B&W and Sepia Photos] [HDR ONLY]\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"695165@N21\", \"name\":\"Epic Beer\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"811645@N22\", \"name\":\"Panasonic Micro and Four Thirds Photographers\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"799767@N23\", \"name\":\"Motorcycle On The Road - (Only bike with landscape, no racing)\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"798116@N21\", \"name\":\"Flickr 888\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"836323@N21\", \"name\":\"Galoshes!\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"895739@N23\", \"name\":\"The Official Pano Panorama Group\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"866118@N20\", \"name\":\"[CameraBag]\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"955385@N22\", \"name\":\"Iphone Camera Art\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"926286@N25\", \"name\":\"HDR - The Way It's Supposed To Look\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1013977@N22\", \"name\":\"Brushes Gallery \\u2013 iPhone\\/iPad Art\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"946087@N25\", \"name\":\"Hunter Wellingtons\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1049385@N24\", \"name\":\"Iphone \\/ Ipad art\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1079681@N20\", \"name\":\"TiltShift Generator\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1081745@N24\", \"name\":\"Cosina Voigtlander Nokton 50\\/1.1\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1083518@N25\", \"name\":\"Mill Colour Image Gallery\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1151932@N21\", \"name\":\"PetaPixel.com\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1222142@N22\", \"name\":\"Panasonic Lumix DMC-GF1\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1244767@N22\", \"name\":\"Micro Four Thirds (Micro 4\\/3)\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1254640@N22\", \"name\":\"SketchBook\\u00ae\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1251121@N24\", \"name\":\"The Daily Shoot\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1292122@N21\", \"name\":\"TrueHDR\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1303089@N20\", \"name\":\"Voigtl\\u00e4nder lenses on FourThirds (FT) & \\u00b5FourThirds (\\u00b5FT) \", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1505867@N20\", \"name\":\"Voigtl\\u00e4nder Nokton 25mm f\\/0.95 for micro four thirds\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1533591@N20\", \"name\":\"Voigtlander Nokton 25mm\\/f0.95\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1590379@N23\", \"name\":\"Wanderlust Cameras\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1560583@N20\", \"name\":\"Pinwide\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}, {\"nsid\":\"1590200@N25\", \"name\":\"Inkpad Art - iPad Vector Drawings\", \"admin\":0, \"eighteenplus\":0, \"invitation_only\":0}]}, \"stat\":\"ok\"})"
|
46
26
|
|
47
27
|
flickr = Flickr::FlickrClient.new
|
28
|
+
groups = flickr.build_response data
|
48
29
|
|
49
|
-
|
50
|
-
assert_equal 7, groups.length
|
30
|
+
assert_equal 78, groups.length
|
51
31
|
assert_equal 'Wellington, New Zealand', groups[2].name
|
52
32
|
assert_equal '41894169203@N01', groups[2].id
|
53
33
|
|
@@ -59,14 +39,14 @@ EOS
|
|
59
39
|
groups_photos, pages, total = @flickr.groups.pools.getPhotos :user_id => "12656878@N06", :group_id => "99404851@N00"
|
60
40
|
|
61
41
|
@http_client.verify
|
62
|
-
assert_equal 15, groups_photos.length
|
63
42
|
assert_equal 1, pages
|
64
43
|
assert_equal 15, total
|
44
|
+
assert_equal 15, groups_photos.length
|
65
45
|
|
66
46
|
groups_photos.each do |photo|
|
67
|
-
assert_equal '
|
47
|
+
assert_equal '12656878@N06', photo.owner
|
68
48
|
end
|
69
49
|
end
|
70
50
|
|
71
51
|
|
72
|
-
end
|
52
|
+
end
|
data/test/people_test.rb
CHANGED
@@ -16,33 +16,28 @@ class PeopleTest < MiniTest::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_person
|
19
|
-
|
20
|
-
|
21
|
-
<username>henry.maddocks</username>
|
22
|
-
<realname>Henry Maddocks</realname>
|
23
|
-
<mbox_sha1sum>4e20b6c8b0fade15dcb37181c65de45b6205cecc</mbox_sha1sum>
|
24
|
-
<location>Wellington, New Zealand</location>
|
25
|
-
<photosurl>http://www.flickr.com/photos/12656878@N06/</photosurl>
|
26
|
-
<profileurl>http://www.flickr.com/people/12656878@N06/</profileurl>
|
27
|
-
<mobileurl>http://m.flickr.com/photostream.gne?id=12611556</mobileurl>
|
28
|
-
<photos>
|
29
|
-
<firstdatetaken>2005-09-24 16:20:11</firstdatetaken>
|
30
|
-
<firstdate>1188878270</firstdate>
|
31
|
-
<count>57</count>
|
32
|
-
</photos>
|
33
|
-
</person>
|
34
|
-
EOS
|
19
|
+
# @flickr.people.getInfo :user_id => '12656878@N06'
|
20
|
+
data = "{\"id\":\"12656878@N06\", \"nsid\":\"12656878@N06\", \"ispro\":1, \"iconserver\":\"1011\", \"iconfarm\":2, \"path_alias\":\"acute-distress\", \"username\":{\"_content\":\"Henry Maddocks\"}, \"realname\":{\"_content\":\"Henry Maddocks\"}, \"location\":{\"_content\":\"Wellington, New Zealand\"}, \"photosurl\":{\"_content\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/\"}, \"profileurl\":{\"_content\":\"http:\\/\\/www.flickr.com\\/people\\/acute-distress\\/\"}, \"mobileurl\":{\"_content\":\"http:\\/\\/m.flickr.com\\/photostream.gne?id=12611556\"}, \"photos\":{\"firstdatetaken\":{\"_content\":\"1970-01-01 15:08:34\"}, \"firstdate\":{\"_content\":\"1188878270\"}, \"count\":{\"_content\":1803}}}"
|
35
21
|
|
36
|
-
|
37
|
-
me = Flickr::Person.new xml.root
|
22
|
+
me = Flickr::Person.new JSON.parse(data)
|
38
23
|
|
39
24
|
assert_equal '12656878@N06', me.id
|
40
|
-
assert_equal '
|
25
|
+
assert_equal 'Henry Maddocks', me.username
|
41
26
|
assert_equal 'Henry Maddocks', me.realname
|
42
27
|
assert_equal 'Wellington, New Zealand', me.location
|
43
|
-
|
44
28
|
end
|
45
29
|
|
30
|
+
def test_short_person
|
31
|
+
data = "{\"nsid\":\"12656878@N06\", \"username\":\"Henry Maddocks\", \"realname\":\"Henry Maddocks\", \"location\":\"Wellington, New Zealand\", \"iconserver\":\"1011\", \"iconfarm\":2}"
|
32
|
+
|
33
|
+
me = Flickr::Person.new JSON.parse(data)
|
34
|
+
|
35
|
+
assert_equal '12656878@N06', me.id
|
36
|
+
assert_equal 'Henry Maddocks', me.username
|
37
|
+
assert_equal 'Henry Maddocks', me.realname
|
38
|
+
assert_equal 'Wellington, New Zealand', me.location
|
39
|
+
end
|
40
|
+
|
46
41
|
def test_find_by_user_name
|
47
42
|
@http_client.expect :get, flickr_responses[:people_by_user_name], flickr_commands[:people_by_user_name]
|
48
43
|
|
@@ -52,4 +47,4 @@ EOS
|
|
52
47
|
assert_equal '12656878@N06', me.id
|
53
48
|
end
|
54
49
|
|
55
|
-
end
|
50
|
+
end
|
data/test/photo_gne_test.rb
CHANGED
@@ -7,19 +7,19 @@ require 'photo_gne.rb'
|
|
7
7
|
|
8
8
|
class Test_Parse_ID < MiniTest::Unit::TestCase
|
9
9
|
def test_url
|
10
|
-
assert_equal 4254104021, parse_id("http://farm5.static.flickr.com/4024/4254104021_4a69ed0cc0_b.jpg")
|
11
|
-
assert_equal 4254104021, parse_id("http://farm5.static.flickr.com/4024/4254104021_4a69ed0cc0.jpg")
|
10
|
+
assert_equal 4254104021, parse_id("http://farm5.static.flickr.com/4024/4254104021_4a69ed0cc0_b.jpg").to_i
|
11
|
+
assert_equal 4254104021, parse_id("http://farm5.static.flickr.com/4024/4254104021_4a69ed0cc0.jpg").to_i
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_integer
|
15
|
-
assert_equal 4254104021, parse_id("4254104021")
|
15
|
+
assert_equal 4254104021, parse_id("4254104021").to_i
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_partial
|
19
|
-
assert_equal 4254104021, parse_id("4254104021_4a69ed0cc0.jpg")
|
20
|
-
assert_equal 4254104021, parse_id("4254104021_4a69ed0cc0_b.jpg")
|
21
|
-
assert_equal 4254104021, parse_id("4254104021_4a69ed0cc0_b")
|
22
|
-
assert_equal 4254104021, parse_id("4254104021_4a69ed0cc0")
|
19
|
+
assert_equal 4254104021, parse_id("4254104021_4a69ed0cc0.jpg").to_i
|
20
|
+
assert_equal 4254104021, parse_id("4254104021_4a69ed0cc0_b.jpg").to_i
|
21
|
+
assert_equal 4254104021, parse_id("4254104021_4a69ed0cc0_b").to_i
|
22
|
+
assert_equal 4254104021, parse_id("4254104021_4a69ed0cc0").to_i
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
data/test/photos_test.rb
CHANGED
@@ -8,62 +8,40 @@ class PhotosTest < MiniTest::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_photo
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<description>hello!</description>
|
16
|
-
<visibility ispublic="1" isfriend="0" isfamily="0" />
|
17
|
-
<dates posted="1100897479" taken="2004-11-19 12:51:19" takengranularity="0" lastupdate="1093022469" />
|
18
|
-
<permissions permcomment="3" permaddmeta="2" />
|
19
|
-
<editability cancomment="1" canaddmeta="1" />
|
20
|
-
<comments>1</comments>
|
21
|
-
<notes>
|
22
|
-
<note id="313" author="12037949754@N01" authorname="Bees" x="10" y="10" w="50" h="50">foo</note>
|
23
|
-
</notes>
|
24
|
-
<tags>
|
25
|
-
<tag id="1234" author="12037949754@N01" raw="woo yay">wooyay</tag>
|
26
|
-
<tag id="1235" author="12037949754@N01" raw="hoopla">hoopla</tag>
|
27
|
-
</tags>
|
28
|
-
<urls>
|
29
|
-
<url type="photopage">http://www.flickr.com/photos/bees/2733/</url>
|
30
|
-
</urls>
|
31
|
-
</photo>
|
32
|
-
EOS
|
11
|
+
# @flickr.photos.getInfo :photo_id => '1848466274'
|
12
|
+
data = "{\"id\":\"1848466274\", \"secret\":\"cec90f64ba\", \"server\":\"2402\", \"farm\":3, \"dateuploaded\":\"1194128038\", \"isfavorite\":0, \"license\":\"0\", \"safety_level\":\"0\", \"rotation\":0, \"originalsecret\":\"b76775879a\", \"originalformat\":\"jpg\", \"owner\":{\"nsid\":\"12656878@N06\", \"username\":\"Henry Maddocks\", \"realname\":\"Henry Maddocks\", \"location\":\"Wellington, New Zealand\", \"iconserver\":\"1011\", \"iconfarm\":2}, \"title\":{\"_content\":\"IMG_5631_2_3\"}, \"description\":{\"_content\":\"\"}, \"visibility\":{\"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, \"dates\":{\"posted\":\"1194128038\", \"taken\":\"2007-11-03 16:40:18\", \"takengranularity\":\"0\", \"lastupdate\":\"1213597658\"}, \"views\":\"135\", \"editability\":{\"cancomment\":0, \"canaddmeta\":0}, \"publiceditability\":{\"cancomment\":1, \"canaddmeta\":0}, \"usage\":{\"candownload\":1, \"canblog\":0, \"canprint\":0, \"canshare\":1}, \"comments\":{\"_content\":\"3\"}, \"notes\":{\"note\":[]}, \"tags\":{\"tag\":[{\"id\":\"12611556-1848466274-56210\", \"author\":\"12656878@N06\", \"raw\":\"hdr\", \"_content\":\"hdr\", \"machine_tag\":0}, {\"id\":\"12611556-1848466274-14457506\", \"author\":\"12656878@N06\", \"raw\":\"ourspacenz\", \"_content\":\"ourspacenz\", \"machine_tag\":0}, {\"id\":\"12611556-1848466274-84127\", \"author\":\"12656878@N06\", \"raw\":\"wanganui\", \"_content\":\"wanganui\", \"machine_tag\":0}]}, \"location\":{\"latitude\":-39.937053, \"longitude\":175.060958, \"accuracy\":\"12\", \"context\":\"0\", \"neighbourhood\":{\"_content\":\"Durie Hill\", \"place_id\":\"foJpCUJTWryLnUq.Cw\", \"woeid\":\"28643814\"}, \"locality\":{\"_content\":\"Wanganui\", \"place_id\":\"Vf_Kh5tTUb.xbRMu\", \"woeid\":\"2351278\"}, \"county\":{\"_content\":\"Wanganui District\", \"place_id\":\"SVoeVI9UV7JmcyEsqw\", \"woeid\":\"55875908\"}, \"region\":{\"_content\":\"Manawatu Wanganui\", \"place_id\":\"Tg1YbTpQV7ojP9xVsw\", \"woeid\":\"15021764\"}, \"country\":{\"_content\":\"New Zealand\", \"place_id\":\"X_2zAGVTUb5..jhXDw\", \"woeid\":\"23424916\"}, \"place_id\":\"foJpCUJTWryLnUq.Cw\", \"woeid\":\"28643814\"}, \"geoperms\":{\"ispublic\":1, \"iscontact\":0, \"isfriend\":0, \"isfamily\":0}, \"urls\":{\"url\":[{\"type\":\"photopage\", \"_content\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/1848466274\\/\"}]}, \"media\":\"photo\"}"
|
13
|
+
|
14
|
+
photo = Flickr::Photo.new JSON.parse(data)
|
33
15
|
|
34
|
-
|
35
|
-
|
16
|
+
assert_equal '1848466274', photo.id
|
17
|
+
assert_equal 'IMG_5631_2_3', photo.title
|
18
|
+
assert_equal ["hdr", "ourspacenz", "wanganui"], photo.tags
|
19
|
+
assert_equal '12656878@N06', photo.owner.id
|
20
|
+
assert_equal 'Henry Maddocks', photo.owner.username
|
36
21
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_photo_short
|
25
|
+
data = {"id"=>"6043998263", "owner"=>"12656878@N06", "secret"=>"4993702a27", "server"=>"6073", "farm"=>7, "title"=>"Netball", "ispublic"=>1, "isfriend"=>0, "isfamily"=>0}
|
26
|
+
|
27
|
+
photo = Flickr::Photo.new data
|
28
|
+
|
29
|
+
assert_equal '6043998263', photo.id
|
30
|
+
assert_equal 'Netball', photo.title
|
31
|
+
assert_equal '12656878@N06', photo.owner
|
44
32
|
end
|
45
33
|
|
46
34
|
def test_many_photos
|
47
|
-
|
48
|
-
<?xml version="1.0" encoding="utf-8" ?> \
|
49
|
-
<rsp stat="ok"> \
|
50
|
-
<photos page="1" pages="1" perpage="100" total="4"> \
|
51
|
-
<photo id="1848466274" owner="12656878@N06" secret="cec90f64ba" server="2402" farm="3" title="IMG_5631_2_3" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194217745" /> \
|
52
|
-
<photo id="1847626991" owner="12656878@N06" secret="a4d0774b17" server="2022" farm="3" title="IMG_5574_5_6" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194128771" /> \
|
53
|
-
<photo id="1847633163" owner="12656878@N06" secret="5089075c7a" server="2008" farm="3" title="IMG_5598_599_600" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194128720" /> \
|
54
|
-
<photo id="1848469604" owner="12656878@N06" secret="e0f8cfeab2" server="2140" farm="3" title="IMG_5646_7_8" ispublic="1" isfriend="0" isfamily="0" ownername="henry.maddocks" dateadded="1194128674" /> \
|
55
|
-
</photos> \
|
56
|
-
</rsp>
|
57
|
-
EOS
|
35
|
+
# @flickr.people.getPublicPhotos :user_id => '12656878@N06'
|
36
|
+
data = "jsonFlickrApi({\"photos\":{\"page\":1, \"pages\":19, \"perpage\":100, \"total\":\"1803\", \"photo\":[{\"id\":\"6043998263\", \"owner\":\"12656878@N06\", \"secret\":\"4993702a27\", \"server\":\"6073\", \"farm\":7, \"title\":\"Netball\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6039881555\", \"owner\":\"12656878@N06\", \"secret\":\"e110689e6f\", \"server\":\"6147\", \"farm\":7, \"title\":\"P1110831\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6039881007\", \"owner\":\"12656878@N06\", \"secret\":\"01b9f6a815\", \"server\":\"6186\", \"farm\":7, \"title\":\"P1110833\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6039880561\", \"owner\":\"12656878@N06\", \"secret\":\"d0f1109f97\", \"server\":\"6131\", \"farm\":7, \"title\":\"P1110834\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6039879949\", \"owner\":\"12656878@N06\", \"secret\":\"5daed14d3d\", \"server\":\"6139\", \"farm\":7, \"title\":\"P1110835\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6039879049\", \"owner\":\"12656878@N06\", \"secret\":\"6ba2edb2e8\", \"server\":\"6088\", \"farm\":7, \"title\":\"P1110837\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6039877809\", \"owner\":\"12656878@N06\", \"secret\":\"16fa13551d\", \"server\":\"6182\", \"farm\":7, \"title\":\"P1110865\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6040426266\", \"owner\":\"12656878@N06\", \"secret\":\"db65675df8\", \"server\":\"6135\", \"farm\":7, \"title\":\"P1110858\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6011194820\", \"owner\":\"12656878@N06\", \"secret\":\"963673407e\", \"server\":\"6002\", \"farm\":7, \"title\":\"Hoody\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"6010633399\", \"owner\":\"12656878@N06\", \"secret\":\"8b79f23416\", \"server\":\"6003\", \"farm\":7, \"title\":\"Grey Power\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5924542676\", \"owner\":\"12656878@N06\", \"secret\":\"19bf326b09\", \"server\":\"6131\", \"farm\":7, \"title\":\"P1110557\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5715732170\", \"owner\":\"12656878@N06\", \"secret\":\"b1d11711d2\", \"server\":\"3473\", \"farm\":4, \"title\":\"P1110528\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5706047089\", \"owner\":\"12656878@N06\", \"secret\":\"1b5fc62710\", \"server\":\"2621\", \"farm\":3, \"title\":\"New Boots\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5671138246\", \"owner\":\"12656878@N06\", \"secret\":\"4cfdc3d629\", \"server\":\"5187\", \"farm\":6, \"title\":\"P1110321\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5652562601\", \"owner\":\"12656878@N06\", \"secret\":\"5820efe190\", \"server\":\"5150\", \"farm\":6, \"title\":\"P1110310\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5652558997\", \"owner\":\"12656878@N06\", \"secret\":\"4dd0215b54\", \"server\":\"5261\", \"farm\":6, \"title\":\"P1110308\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5615402001\", \"owner\":\"12656878@N06\", \"secret\":\"333a784df4\", \"server\":\"5309\", \"farm\":6, \"title\":\"P1110192\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612296653\", \"owner\":\"12656878@N06\", \"secret\":\"588e280cb1\", \"server\":\"5230\", \"farm\":6, \"title\":\"P1110157\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612856042\", \"owner\":\"12656878@N06\", \"secret\":\"e122fe78e1\", \"server\":\"5307\", \"farm\":6, \"title\":\"Thomas\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612275491\", \"owner\":\"12656878@N06\", \"secret\":\"ee908bcd2a\", \"server\":\"5185\", \"farm\":6, \"title\":\"Samuel\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612251775\", \"owner\":\"12656878@N06\", \"secret\":\"5fda4a0652\", \"server\":\"5146\", \"farm\":6, \"title\":\"Naomi & Alysssa\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612227731\", \"owner\":\"12656878@N06\", \"secret\":\"e3c0d7375f\", \"server\":\"5022\", \"farm\":6, \"title\":\"P1110111\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612227493\", \"owner\":\"12656878@N06\", \"secret\":\"83369deea3\", \"server\":\"5110\", \"farm\":6, \"title\":\"P1110219\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612807156\", \"owner\":\"12656878@N06\", \"secret\":\"d3f00a66cb\", \"server\":\"5270\", \"farm\":6, \"title\":\"P1110217\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612806882\", \"owner\":\"12656878@N06\", \"secret\":\"4a9d11cc54\", \"server\":\"5061\", \"farm\":6, \"title\":\"P1110214\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612226625\", \"owner\":\"12656878@N06\", \"secret\":\"196a8ae4d6\", \"server\":\"5185\", \"farm\":6, \"title\":\"P1110212\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612806162\", \"owner\":\"12656878@N06\", \"secret\":\"ef69193ab6\", \"server\":\"5223\", \"farm\":6, \"title\":\"P1110211\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612805826\", \"owner\":\"12656878@N06\", \"secret\":\"b9a031cd60\", \"server\":\"5268\", \"farm\":6, \"title\":\"P1110197\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612805380\", \"owner\":\"12656878@N06\", \"secret\":\"4df3a1a6a4\", \"server\":\"5307\", \"farm\":6, \"title\":\"P1110194\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612225257\", \"owner\":\"12656878@N06\", \"secret\":\"7b68e25a42\", \"server\":\"5145\", \"farm\":6, \"title\":\"P1110181\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612224919\", \"owner\":\"12656878@N06\", \"secret\":\"f1f8d6ee53\", \"server\":\"5310\", \"farm\":6, \"title\":\"P1110165\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612224487\", \"owner\":\"12656878@N06\", \"secret\":\"0995df2f09\", \"server\":\"5301\", \"farm\":6, \"title\":\"P1110169\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612224067\", \"owner\":\"12656878@N06\", \"secret\":\"86e1f5688f\", \"server\":\"5026\", \"farm\":6, \"title\":\"P1110168\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612223727\", \"owner\":\"12656878@N06\", \"secret\":\"a6b55b1eea\", \"server\":\"5067\", \"farm\":6, \"title\":\"P1110163\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612803132\", \"owner\":\"12656878@N06\", \"secret\":\"5febbf8f15\", \"server\":\"5145\", \"farm\":6, \"title\":\"P1110159\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5612223049\", \"owner\":\"12656878@N06\", \"secret\":\"4229a24640\", \"server\":\"5222\", \"farm\":6, \"title\":\"P1110099\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5605836628\", \"owner\":\"12656878@N06\", \"secret\":\"d39e63248b\", \"server\":\"5266\", \"farm\":6, \"title\":\"P1110136\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5604373475\", \"owner\":\"12656878@N06\", \"secret\":\"de42e2789a\", \"server\":\"4108\", \"farm\":5, \"title\":\"P1110153\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5587056928\", \"owner\":\"12656878@N06\", \"secret\":\"3f4ccf452d\", \"server\":\"5094\", \"farm\":6, \"title\":\"Hollywood\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5565812680\", \"owner\":\"12656878@N06\", \"secret\":\"b395edd006\", \"server\":\"5056\", \"farm\":6, \"title\":\"P1110044\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5565443808\", \"owner\":\"12656878@N06\", \"secret\":\"67e0fcc4e8\", \"server\":\"5267\", \"farm\":6, \"title\":\"Junk Mail\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5557083066\", \"owner\":\"12656878@N06\", \"secret\":\"50985eee5d\", \"server\":\"5229\", \"farm\":6, \"title\":\"Pinhole\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5549156415\", \"owner\":\"12656878@N06\", \"secret\":\"22907da003\", \"server\":\"5023\", \"farm\":6, \"title\":\"P1100938\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5519213816\", \"owner\":\"12656878@N06\", \"secret\":\"731fcdd3bd\", \"server\":\"5258\", \"farm\":6, \"title\":\"Furniture Shopping\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5516089666\", \"owner\":\"12656878@N06\", \"secret\":\"aed4c193c6\", \"server\":\"5256\", \"farm\":6, \"title\":\"Furniture Shopping\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5513491035\", \"owner\":\"12656878@N06\", \"secret\":\"3331e3278c\", \"server\":\"5259\", \"farm\":6, \"title\":\"Furniture Shopping\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5507277399\", \"owner\":\"12656878@N06\", \"secret\":\"720805359a\", \"server\":\"5213\", \"farm\":6, \"title\":\"Furniture Shopping\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5507106564\", \"owner\":\"12656878@N06\", \"secret\":\"4006b299a3\", \"server\":\"5217\", \"farm\":6, \"title\":\"Edna\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5489989991\", \"owner\":\"12656878@N06\", \"secret\":\"ddb9a128f6\", \"server\":\"5180\", \"farm\":6, \"title\":\"IMG_4656\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5472869207\", \"owner\":\"12656878@N06\", \"secret\":\"3be36ddd5f\", \"server\":\"5060\", \"farm\":6, \"title\":\"15\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5472868849\", \"owner\":\"12656878@N06\", \"secret\":\"8a4787ae6c\", \"server\":\"5291\", \"farm\":6, \"title\":\"13\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5467913630\", \"owner\":\"12656878@N06\", \"secret\":\"b1e2a0591c\", \"server\":\"5215\", \"farm\":6, \"title\":\"IMG_4635\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5467913336\", \"owner\":\"12656878@N06\", \"secret\":\"1274239c37\", \"server\":\"5212\", \"farm\":6, \"title\":\"IMG_4634\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5467315601\", \"owner\":\"12656878@N06\", \"secret\":\"26855385fd\", \"server\":\"5053\", \"farm\":6, \"title\":\"IMG_4628\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5464362666\", \"owner\":\"12656878@N06\", \"secret\":\"120a37d770\", \"server\":\"5178\", \"farm\":6, \"title\":\"Fireball\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5435771886\", \"owner\":\"12656878@N06\", \"secret\":\"34af1c114f\", \"server\":\"5292\", \"farm\":6, \"title\":\"\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5435161697\", \"owner\":\"12656878@N06\", \"secret\":\"5a28b047ed\", \"server\":\"5012\", \"farm\":6, \"title\":\"\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5435770682\", \"owner\":\"12656878@N06\", \"secret\":\"532c97124c\", \"server\":\"5052\", \"farm\":6, \"title\":\"\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5435770212\", \"owner\":\"12656878@N06\", \"secret\":\"46e4df7149\", \"server\":\"5136\", \"farm\":6, \"title\":\"\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5435749152\", \"owner\":\"12656878@N06\", \"secret\":\"ab3a4dd32a\", \"server\":\"4118\", \"farm\":5, \"title\":\"Evening\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5433123146\", \"owner\":\"12656878@N06\", \"secret\":\"c64d68c2d3\", \"server\":\"4153\", \"farm\":5, \"title\":\"\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5368273911\", \"owner\":\"12656878@N06\", \"secret\":\"806f050f9f\", \"server\":\"5162\", \"farm\":6, \"title\":\"Clouds\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5331529833\", \"owner\":\"12656878@N06\", \"secret\":\"84a1403522\", \"server\":\"5203\", \"farm\":6, \"title\":\"P1090771\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5332141266\", \"owner\":\"12656878@N06\", \"secret\":\"1a3055141d\", \"server\":\"5083\", \"farm\":6, \"title\":\"P1090772\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5332140330\", \"owner\":\"12656878@N06\", \"secret\":\"637ee6ae2e\", \"server\":\"5043\", \"farm\":6, \"title\":\"P1090783\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5332139604\", \"owner\":\"12656878@N06\", \"secret\":\"353cbd0059\", \"server\":\"5161\", \"farm\":6, \"title\":\"P1090786\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5311462024\", \"owner\":\"12656878@N06\", \"secret\":\"9615d729c9\", \"server\":\"5008\", \"farm\":6, \"title\":\"P1090961\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5308595947\", \"owner\":\"12656878@N06\", \"secret\":\"53cb7f9242\", \"server\":\"5009\", \"farm\":6, \"title\":\"Edna\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5272369364\", \"owner\":\"12656878@N06\", \"secret\":\"6c9eacdaed\", \"server\":\"5162\", \"farm\":6, \"title\":\"IMG_4169\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5244899827\", \"owner\":\"12656878@N06\", \"secret\":\"71c85a850e\", \"server\":\"5084\", \"farm\":6, \"title\":\"Me\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5239935503\", \"owner\":\"12656878@N06\", \"secret\":\"12392c860e\", \"server\":\"5166\", \"farm\":6, \"title\":\"NZiDev\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5221832763\", \"owner\":\"12656878@N06\", \"secret\":\"1047d4f3c5\", \"server\":\"5283\", \"farm\":6, \"title\":\"Edna 9\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5216571403\", \"owner\":\"12656878@N06\", \"secret\":\"e5ee01a83a\", \"server\":\"4091\", \"farm\":5, \"title\":\"Edna 8\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5216570959\", \"owner\":\"12656878@N06\", \"secret\":\"3206446cbb\", \"server\":\"5245\", \"farm\":6, \"title\":\"Edna 7\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5207629170\", \"owner\":\"12656878@N06\", \"secret\":\"68f966d5f8\", \"server\":\"5088\", \"farm\":6, \"title\":\"P1090407\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5207591586\", \"owner\":\"12656878@N06\", \"secret\":\"e62ac1de2d\", \"server\":\"4127\", \"farm\":5, \"title\":\"P1090303\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5204977137\", \"owner\":\"12656878@N06\", \"secret\":\"889ed7f228\", \"server\":\"5204\", \"farm\":6, \"title\":\"P1090398\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5205567526\", \"owner\":\"12656878@N06\", \"secret\":\"6eece7166c\", \"server\":\"4152\", \"farm\":5, \"title\":\"P1090291\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5201063008\", \"owner\":\"12656878@N06\", \"secret\":\"63efcd9ff8\", \"server\":\"4129\", \"farm\":5, \"title\":\"P1090405\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5201062386\", \"owner\":\"12656878@N06\", \"secret\":\"162f3108c1\", \"server\":\"4124\", \"farm\":5, \"title\":\"P1090404\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5201061778\", \"owner\":\"12656878@N06\", \"secret\":\"abc3731401\", \"server\":\"4148\", \"farm\":5, \"title\":\"P1090403\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5199302083\", \"owner\":\"12656878@N06\", \"secret\":\"05bee86169\", \"server\":\"4154\", \"farm\":5, \"title\":\"Edna 6\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5189965911\", \"owner\":\"12656878@N06\", \"secret\":\"bb3a7ac056\", \"server\":\"4147\", \"farm\":5, \"title\":\"Edna 5\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5186899792\", \"owner\":\"12656878@N06\", \"secret\":\"dfeb083388\", \"server\":\"4107\", \"farm\":5, \"title\":\"Samuel 2\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5186756172\", \"owner\":\"12656878@N06\", \"secret\":\"4f233d3c81\", \"server\":\"1010\", \"farm\":2, \"title\":\"Edna 4\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5167493645\", \"owner\":\"12656878@N06\", \"secret\":\"ab4622fa61\", \"server\":\"4089\", \"farm\":5, \"title\":\"Edna 3\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5164708197\", \"owner\":\"12656878@N06\", \"secret\":\"d6b2c9b53e\", \"server\":\"4036\", \"farm\":5, \"title\":\"Alan\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5155821845\", \"owner\":\"12656878@N06\", \"secret\":\"05cd9aae48\", \"server\":\"1063\", \"farm\":2, \"title\":\"Edna 2\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5148249418\", \"owner\":\"12656878@N06\", \"secret\":\"9eee72437c\", \"server\":\"4059\", \"farm\":5, \"title\":\"P1090165\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5147645767\", \"owner\":\"12656878@N06\", \"secret\":\"0632521150\", \"server\":\"1188\", \"farm\":2, \"title\":\"P1090193\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5144169185\", \"owner\":\"12656878@N06\", \"secret\":\"b958c697a1\", \"server\":\"1400\", \"farm\":2, \"title\":\"Yospyn\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5143234755\", \"owner\":\"12656878@N06\", \"secret\":\"f1991c215d\", \"server\":\"1105\", \"farm\":2, \"title\":\"Thomas\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5135312942\", \"owner\":\"12656878@N06\", \"secret\":\"c8a9efc15b\", \"server\":\"4036\", \"farm\":5, \"title\":\"P1090113\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5133416233\", \"owner\":\"12656878@N06\", \"secret\":\"071de8b6f4\", \"server\":\"4006\", \"farm\":5, \"title\":\"P1090124\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5133414919\", \"owner\":\"12656878@N06\", \"secret\":\"45c88688a0\", \"server\":\"1206\", \"farm\":2, \"title\":\"P1090122\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5134013190\", \"owner\":\"12656878@N06\", \"secret\":\"1a772371ae\", \"server\":\"1425\", \"farm\":2, \"title\":\"P1090121\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5133412383\", \"owner\":\"12656878@N06\", \"secret\":\"54c1d1e306\", \"server\":\"4041\", \"farm\":5, \"title\":\"P1090083\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5134010446\", \"owner\":\"12656878@N06\", \"secret\":\"16cb9ef220\", \"server\":\"4005\", \"farm\":5, \"title\":\"P1090093\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5133409681\", \"owner\":\"12656878@N06\", \"secret\":\"045d29c331\", \"server\":\"1224\", \"farm\":2, \"title\":\"P1090090\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, {\"id\":\"5133408627\", \"owner\":\"12656878@N06\", \"secret\":\"8becca39a7\", \"server\":\"1198\", \"farm\":2, \"title\":\"P1090129\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0}]}, \"stat\":\"ok\"})"
|
58
37
|
|
59
38
|
flickr = Flickr::FlickrClient.new
|
60
|
-
|
61
|
-
photos, pages, total = flickr.build_response xml
|
39
|
+
photos, pages, total = flickr.build_response data
|
62
40
|
|
63
|
-
assert_equal
|
64
|
-
assert_equal
|
65
|
-
assert_equal
|
66
|
-
assert_equal "
|
41
|
+
assert_equal 100, photos.length
|
42
|
+
assert_equal 19, pages
|
43
|
+
assert_equal 1803, total
|
44
|
+
assert_equal "P1110833", photos[2].title
|
67
45
|
end
|
68
46
|
|
69
47
|
def test_get_info
|
@@ -98,8 +76,16 @@ EOS
|
|
98
76
|
assert sizes.thumbnail
|
99
77
|
assert sizes.small
|
100
78
|
assert sizes.medium
|
101
|
-
assert sizes.
|
79
|
+
assert sizes.medium_640
|
102
80
|
assert sizes.original
|
81
|
+
|
82
|
+
assert_raises NoMethodError do
|
83
|
+
sizes.not_a_size
|
84
|
+
end
|
103
85
|
end
|
104
86
|
|
105
|
-
|
87
|
+
def test_missing_size_method
|
88
|
+
skip "Return nil for a missing size"
|
89
|
+
assert false
|
90
|
+
end
|
91
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -19,33 +19,33 @@ FakeHTTPResponse = Struct.new(:code, :body)
|
|
19
19
|
class MiniTest::Unit::TestCase
|
20
20
|
def flickr_commands
|
21
21
|
{
|
22
|
-
:bad_api_key => ["/services/rest/?method=flickr.photos.getInfo&api_key=bad_key&photo_id=1848466274"],
|
23
|
-
:bad_args => ["/services/rest/?method=flickr.people.getInfo&api_key=9d96d3ae6145f12660896ae23b33f949&xxxx=12656878%40N06"],
|
22
|
+
:bad_api_key => ["/services/rest/?method=flickr.photos.getInfo&api_key=bad_key&photo_id=1848466274&format=json"],
|
23
|
+
:bad_args => ["/services/rest/?method=flickr.people.getInfo&api_key=9d96d3ae6145f12660896ae23b33f949&xxxx=12656878%40N06&format=json"],
|
24
24
|
|
25
|
-
:photos_get_info => ["/services/rest/?method=flickr.photos.getInfo&api_key=9d96d3ae6145f12660896ae23b33f949&photo_id=1848466274"],
|
26
|
-
:photos_get_sizes => ["/services/rest/?method=flickr.photos.getSizes&api_key=9d96d3ae6145f12660896ae23b33f949&photo_id=1848466274"],
|
25
|
+
:photos_get_info => ["/services/rest/?method=flickr.photos.getInfo&api_key=9d96d3ae6145f12660896ae23b33f949&photo_id=1848466274&format=json"],
|
26
|
+
:photos_get_sizes => ["/services/rest/?method=flickr.photos.getSizes&api_key=9d96d3ae6145f12660896ae23b33f949&photo_id=1848466274&format=json"],
|
27
27
|
|
28
|
-
:people_get_info => ["/services/rest/?method=flickr.people.getInfo&api_key=9d96d3ae6145f12660896ae23b33f949&user_id=12656878%40N06"],
|
29
|
-
:people_get_info_not_found => ["/services/rest/?method=flickr.people.getInfo&api_key=9d96d3ae6145f12660896ae23b33f949&user_id=xxxx"],
|
30
|
-
:people_by_user_name => ["/services/rest/?method=flickr.people.findByUsername&api_key=9d96d3ae6145f12660896ae23b33f949&username=Henry+Maddocks"],
|
28
|
+
:people_get_info => ["/services/rest/?method=flickr.people.getInfo&api_key=9d96d3ae6145f12660896ae23b33f949&user_id=12656878%40N06&format=json"],
|
29
|
+
:people_get_info_not_found => ["/services/rest/?method=flickr.people.getInfo&api_key=9d96d3ae6145f12660896ae23b33f949&user_id=xxxx&format=json"],
|
30
|
+
:people_by_user_name => ["/services/rest/?method=flickr.people.findByUsername&api_key=9d96d3ae6145f12660896ae23b33f949&username=Henry+Maddocks&format=json"],
|
31
31
|
|
32
|
-
:groups_pools_get_photos => ["/services/rest/?method=flickr.groups.pools.getPhotos&api_key=9d96d3ae6145f12660896ae23b33f949&user_id=12656878%40N06&group_id=99404851%40N00"]
|
32
|
+
:groups_pools_get_photos => ["/services/rest/?method=flickr.groups.pools.getPhotos&api_key=9d96d3ae6145f12660896ae23b33f949&user_id=12656878%40N06&group_id=99404851%40N00&format=json"]
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
36
36
|
def flickr_responses
|
37
37
|
{
|
38
|
-
:bad_api_key => FakeHTTPResponse.new(200, "
|
39
|
-
:bad_args => FakeHTTPResponse.new(200, "
|
38
|
+
:bad_api_key => FakeHTTPResponse.new(200, "jsonFlickrApi({\"stat\":\"fail\", \"code\":100, \"message\":\"Invalid API Key (Key has invalid format)\"})"),
|
39
|
+
:bad_args => FakeHTTPResponse.new(200, "jsonFlickrApi({\"stat\":\"fail\", \"code\":1, \"message\":\"User not found\"})"),
|
40
40
|
|
41
|
-
:photos_get_info => FakeHTTPResponse.new(200, "
|
42
|
-
:photos_get_sizes => FakeHTTPResponse.new(200, "
|
41
|
+
:photos_get_info => FakeHTTPResponse.new(200, "jsonFlickrApi({\"photo\":{\"id\":\"1848466274\", \"secret\":\"cec90f64ba\", \"server\":\"2402\", \"farm\":3, \"dateuploaded\":\"1194128038\", \"isfavorite\":0, \"license\":\"0\", \"safety_level\":\"0\", \"rotation\":0, \"originalsecret\":\"b76775879a\", \"originalformat\":\"jpg\", \"owner\":{\"nsid\":\"12656878@N06\", \"username\":\"Henry Maddocks\", \"realname\":\"Henry Maddocks\", \"location\":\"Wellington, New Zealand\", \"iconserver\":\"1011\", \"iconfarm\":2}, \"title\":{\"_content\":\"IMG_5631_2_3\"}, \"description\":{\"_content\":\"\"}, \"visibility\":{\"ispublic\":1, \"isfriend\":0, \"isfamily\":0}, \"dates\":{\"posted\":\"1194128038\", \"taken\":\"2007-11-03 16:40:18\", \"takengranularity\":\"0\", \"lastupdate\":\"1213597658\"}, \"views\":\"135\", \"editability\":{\"cancomment\":0, \"canaddmeta\":0}, \"publiceditability\":{\"cancomment\":1, \"canaddmeta\":0}, \"usage\":{\"candownload\":1, \"canblog\":0, \"canprint\":0, \"canshare\":1}, \"comments\":{\"_content\":\"3\"}, \"notes\":{\"note\":[]}, \"tags\":{\"tag\":[{\"id\":\"12611556-1848466274-56210\", \"author\":\"12656878@N06\", \"raw\":\"hdr\", \"_content\":\"hdr\", \"machine_tag\":0}, {\"id\":\"12611556-1848466274-14457506\", \"author\":\"12656878@N06\", \"raw\":\"ourspacenz\", \"_content\":\"ourspacenz\", \"machine_tag\":0}, {\"id\":\"12611556-1848466274-84127\", \"author\":\"12656878@N06\", \"raw\":\"wanganui\", \"_content\":\"wanganui\", \"machine_tag\":0}]}, \"location\":{\"latitude\":-39.937053, \"longitude\":175.060958, \"accuracy\":\"12\", \"context\":\"0\", \"neighbourhood\":{\"_content\":\"Durie Hill\", \"place_id\":\"foJpCUJTWryLnUq.Cw\", \"woeid\":\"28643814\"}, \"locality\":{\"_content\":\"Wanganui\", \"place_id\":\"Vf_Kh5tTUb.xbRMu\", \"woeid\":\"2351278\"}, \"county\":{\"_content\":\"Wanganui District\", \"place_id\":\"SVoeVI9UV7JmcyEsqw\", \"woeid\":\"55875908\"}, \"region\":{\"_content\":\"Manawatu Wanganui\", \"place_id\":\"Tg1YbTpQV7ojP9xVsw\", \"woeid\":\"15021764\"}, \"country\":{\"_content\":\"New Zealand\", \"place_id\":\"X_2zAGVTUb5..jhXDw\", \"woeid\":\"23424916\"}, \"place_id\":\"foJpCUJTWryLnUq.Cw\", \"woeid\":\"28643814\"}, \"geoperms\":{\"ispublic\":1, \"iscontact\":0, \"isfriend\":0, \"isfamily\":0}, \"urls\":{\"url\":[{\"type\":\"photopage\", \"_content\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/1848466274\\/\"}]}, \"media\":\"photo\"}, \"stat\":\"ok\"})"),
|
42
|
+
:photos_get_sizes => FakeHTTPResponse.new(200, "jsonFlickrApi({\"sizes\":{\"canblog\":0, \"canprint\":0, \"candownload\":1, \"size\":[{\"label\":\"Square\", \"width\":75, \"height\":75, \"source\":\"http:\\/\\/farm3.static.flickr.com\\/2402\\/1848466274_cec90f64ba_s.jpg\", \"url\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/1848466274\\/sizes\\/sq\\/\", \"media\":\"photo\"}, {\"label\":\"Thumbnail\", \"width\":\"100\", \"height\":\"75\", \"source\":\"http:\\/\\/farm3.static.flickr.com\\/2402\\/1848466274_cec90f64ba_t.jpg\", \"url\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/1848466274\\/sizes\\/t\\/\", \"media\":\"photo\"}, {\"label\":\"Small\", \"width\":\"240\", \"height\":\"180\", \"source\":\"http:\\/\\/farm3.static.flickr.com\\/2402\\/1848466274_cec90f64ba_m.jpg\", \"url\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/1848466274\\/sizes\\/s\\/\", \"media\":\"photo\"}, {\"label\":\"Medium\", \"width\":\"500\", \"height\":\"375\", \"source\":\"http:\\/\\/farm3.static.flickr.com\\/2402\\/1848466274_cec90f64ba.jpg\", \"url\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/1848466274\\/sizes\\/m\\/\", \"media\":\"photo\"}, {\"label\":\"Medium 640\", \"width\":\"640\", \"height\":480, \"source\":\"http:\\/\\/farm3.static.flickr.com\\/2402\\/1848466274_cec90f64ba_z.jpg?zz=1\", \"url\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/1848466274\\/sizes\\/z\\/\", \"media\":\"photo\"}, {\"label\":\"Original\", \"width\":\"1280\", \"height\":\"960\", \"source\":\"http:\\/\\/farm3.static.flickr.com\\/2402\\/1848466274_b76775879a_o.jpg\", \"url\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/1848466274\\/sizes\\/o\\/\", \"media\":\"photo\"}]}, \"stat\":\"ok\"})"),
|
43
43
|
|
44
|
-
:people_get_info => FakeHTTPResponse.new(200, "
|
45
|
-
:people_get_info_not_found => FakeHTTPResponse.new(200, "
|
46
|
-
:people_by_user_name => FakeHTTPResponse.new(200, "
|
44
|
+
:people_get_info => FakeHTTPResponse.new(200, "jsonFlickrApi({\"person\":{\"id\":\"12656878@N06\", \"nsid\":\"12656878@N06\", \"ispro\":1, \"iconserver\":\"1011\", \"iconfarm\":2, \"path_alias\":\"acute-distress\", \"username\":{\"_content\":\"Henry Maddocks\"}, \"realname\":{\"_content\":\"Henry Maddocks\"}, \"location\":{\"_content\":\"Wellington, New Zealand\"}, \"photosurl\":{\"_content\":\"http:\\/\\/www.flickr.com\\/photos\\/acute-distress\\/\"}, \"profileurl\":{\"_content\":\"http:\\/\\/www.flickr.com\\/people\\/acute-distress\\/\"}, \"mobileurl\":{\"_content\":\"http:\\/\\/m.flickr.com\\/photostream.gne?id=12611556\"}, \"photos\":{\"firstdatetaken\":{\"_content\":\"1970-01-01 15:08:34\"}, \"firstdate\":{\"_content\":\"1188878270\"}, \"count\":{\"_content\":1803}}}, \"stat\":\"ok\"})"),
|
45
|
+
:people_get_info_not_found => FakeHTTPResponse.new(200, "jsonFlickrApi({\"stat\":\"fail\", \"code\":1, \"message\":\"User not found\"})"),
|
46
|
+
:people_by_user_name => FakeHTTPResponse.new(200, "jsonFlickrApi({\"user\":{\"id\":\"12656878@N06\", \"nsid\":\"12656878@N06\", \"username\":{\"_content\":\"Henry Maddocks\"}}, \"stat\":\"ok\"})"),
|
47
47
|
|
48
|
-
:groups_pools_get_photos => FakeHTTPResponse.new(200, "
|
48
|
+
:groups_pools_get_photos => FakeHTTPResponse.new(200, "jsonFlickrApi({\"photos\":{\"page\":1, \"pages\":1, \"perpage\":100, \"total\":\"15\", \"photo\":[{\"id\":\"1848463798\", \"owner\":\"12656878@N06\", \"secret\":\"d9fcbdedb5\", \"server\":\"2103\", \"farm\":3, \"title\":\"IMG_5628_29_30\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1250311066\"}, {\"id\":\"1847616297\", \"owner\":\"12656878@N06\", \"secret\":\"71461d1f9a\", \"server\":\"2042\", \"farm\":3, \"title\":\"IMG_5547_8_9\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1250311040\"}, {\"id\":\"1847623411\", \"owner\":\"12656878@N06\", \"secret\":\"13dc200ffe\", \"server\":\"2007\", \"farm\":3, \"title\":\"IMG_5571_2_3\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1250311001\"}, {\"id\":\"2359596024\", \"owner\":\"12656878@N06\", \"secret\":\"2d8fde31d1\", \"server\":\"2267\", \"farm\":3, \"title\":\"Criss Cross Castle\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1206397646\"}, {\"id\":\"2356865849\", \"owner\":\"12656878@N06\", \"secret\":\"69697c85d3\", \"server\":\"3282\", \"farm\":4, \"title\":\"Alexander Library\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1206353910\"}, {\"id\":\"2150832683\", \"owner\":\"12656878@N06\", \"secret\":\"e97dfa334f\", \"server\":\"2122\", \"farm\":3, \"title\":\"IMG_0716_7_8\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095628\"}, {\"id\":\"2151623192\", \"owner\":\"12656878@N06\", \"secret\":\"81b8bdcc39\", \"server\":\"2099\", \"farm\":3, \"title\":\"IMG_0695_6_7\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095610\"}, {\"id\":\"2150834129\", \"owner\":\"12656878@N06\", \"secret\":\"19fb55ffdd\", \"server\":\"2156\", \"farm\":3, \"title\":\"IMG_0643_4_5\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095592\"}, {\"id\":\"2150812929\", \"owner\":\"12656878@N06\", \"secret\":\"f87fe0ba85\", \"server\":\"2252\", \"farm\":3, \"title\":\"IMG_0506_7_8\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095509\"}, {\"id\":\"2150812919\", \"owner\":\"12656878@N06\", \"secret\":\"ae39c7e214\", \"server\":\"2099\", \"farm\":3, \"title\":\"IMG_0494_5_6\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095483\"}, {\"id\":\"2150812917\", \"owner\":\"12656878@N06\", \"secret\":\"ca858d0646\", \"server\":\"2019\", \"farm\":3, \"title\":\"IMG_0491_2_3\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1199095461\"}, {\"id\":\"1848466274\", \"owner\":\"12656878@N06\", \"secret\":\"cec90f64ba\", \"server\":\"2402\", \"farm\":3, \"title\":\"IMG_5631_2_3\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1194217745\"}, {\"id\":\"1847626991\", \"owner\":\"12656878@N06\", \"secret\":\"a4d0774b17\", \"server\":\"2022\", \"farm\":3, \"title\":\"IMG_5574_5_6\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1194128771\"}, {\"id\":\"1847633163\", \"owner\":\"12656878@N06\", \"secret\":\"5089075c7a\", \"server\":\"2008\", \"farm\":3, \"title\":\"IMG_5598_599_600\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1194128720\"}, {\"id\":\"1848469604\", \"owner\":\"12656878@N06\", \"secret\":\"e0f8cfeab2\", \"server\":\"2140\", \"farm\":3, \"title\":\"IMG_5646_7_8\", \"ispublic\":1, \"isfriend\":0, \"isfamily\":0, \"ownername\":\"Henry Maddocks\", \"dateadded\":\"1194128674\"}]}, \"stat\":\"ok\"})")
|
49
49
|
}
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickrrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '2.0'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-22 00:00:00.000000000 +12:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
description: A simple interface to the Flickr public API.
|