flickr.rb 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Changelog.txt +7 -2
- data/Gemfile +4 -0
- data/Gemfile.lock +24 -0
- data/LICENSE +16 -17
- data/Manifest.txt +2 -2
- data/README.txt +3 -1
- data/Rakefile +3 -24
- data/flickr.gemspec +22 -17
- data/lib/flickr.rb +104 -104
- data/rdoc/Flickr.html +1003 -0
- data/rdoc/Flickr/Config.html +267 -0
- data/rdoc/Flickr/Group.html +343 -0
- data/rdoc/Flickr/Photo.html +1396 -0
- data/rdoc/Flickr/PhotoCollection.html +229 -0
- data/rdoc/Flickr/Photoset.html +359 -0
- data/rdoc/Flickr/User.html +745 -0
- data/rdoc/README_txt.html +199 -0
- data/rdoc/created.rid +3 -1
- data/rdoc/fonts.css +167 -0
- data/rdoc/fonts/Lato-Light.ttf +0 -0
- data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
- data/rdoc/fonts/Lato-Regular.ttf +0 -0
- data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
- data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/rdoc/images/add.png +0 -0
- data/rdoc/images/arrow_up.png +0 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/delete.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_blue.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/transparent.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +101 -21
- data/rdoc/js/darkfish.js +140 -0
- data/rdoc/js/jquery.js +18 -0
- data/rdoc/js/navigation.js +142 -0
- data/rdoc/js/search.js +109 -0
- data/rdoc/js/search_index.js +1 -0
- data/rdoc/js/searcher.js +228 -0
- data/rdoc/rdoc.css +580 -0
- data/rdoc/table_of_contents.html +473 -0
- data/test/flickr_test.rb +229 -227
- metadata +132 -68
- data/rdoc/classes/Flickr.html +0 -807
- data/rdoc/classes/Flickr/Config.html +0 -240
- data/rdoc/classes/Flickr/Group.html +0 -251
- data/rdoc/classes/Flickr/Photo.html +0 -1101
- data/rdoc/classes/Flickr/PhotoCollection.html +0 -194
- data/rdoc/classes/Flickr/Photoset.html +0 -266
- data/rdoc/classes/Flickr/User.html +0 -738
- data/rdoc/files/README_txt.html +0 -209
- data/rdoc/files/lib/flickr_rb.html +0 -162
- data/rdoc/fr_class_index.html +0 -33
- data/rdoc/fr_file_index.html +0 -28
- data/rdoc/fr_method_index.html +0 -112
- data/rdoc/rdoc-style.css +0 -208
data/rdoc/Flickr.html
ADDED
@@ -0,0 +1,1003 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Flickr - Flickr</title>
|
8
|
+
|
9
|
+
<link href="./fonts.css" rel="stylesheet">
|
10
|
+
<link href="./rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "./";
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script src="./js/jquery.js"></script>
|
17
|
+
<script src="./js/navigation.js"></script>
|
18
|
+
<script src="./js/search_index.js"></script>
|
19
|
+
<script src="./js/search.js"></script>
|
20
|
+
<script src="./js/searcher.js"></script>
|
21
|
+
<script src="./js/darkfish.js"></script>
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
<div id="parent-class-section" class="nav-section">
|
61
|
+
<h3>Parent</h3>
|
62
|
+
|
63
|
+
|
64
|
+
<p class="link">Object
|
65
|
+
|
66
|
+
</div>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
|
76
|
+
<li ><a href="#method-c-new">::new</a>
|
77
|
+
|
78
|
+
<li ><a href="#method-i-find_by_url">#find_by_url</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-get_token_from">#get_token_from</a>
|
81
|
+
|
82
|
+
<li ><a href="#method-i-groups">#groups</a>
|
83
|
+
|
84
|
+
<li ><a href="#method-i-http_get">#http_get</a>
|
85
|
+
|
86
|
+
<li ><a href="#method-i-licenses">#licenses</a>
|
87
|
+
|
88
|
+
<li ><a href="#method-i-login_url">#login_url</a>
|
89
|
+
|
90
|
+
<li ><a href="#method-i-method_missing">#method_missing</a>
|
91
|
+
|
92
|
+
<li ><a href="#method-i-photos">#photos</a>
|
93
|
+
|
94
|
+
<li ><a href="#method-i-photos_request">#photos_request</a>
|
95
|
+
|
96
|
+
<li ><a href="#method-i-photos_search">#photos_search</a>
|
97
|
+
|
98
|
+
<li ><a href="#method-i-photoset">#photoset</a>
|
99
|
+
|
100
|
+
<li ><a href="#method-i-recent">#recent</a>
|
101
|
+
|
102
|
+
<li ><a href="#method-i-related_tags">#related_tags</a>
|
103
|
+
|
104
|
+
<li ><a href="#method-i-request">#request</a>
|
105
|
+
|
106
|
+
<li ><a href="#method-i-request_url">#request_url</a>
|
107
|
+
|
108
|
+
<li ><a href="#method-i-search">#search</a>
|
109
|
+
|
110
|
+
<li ><a href="#method-i-set_up_configuration">#set_up_configuration</a>
|
111
|
+
|
112
|
+
<li ><a href="#method-i-signature_from">#signature_from</a>
|
113
|
+
|
114
|
+
<li ><a href="#method-i-tag">#tag</a>
|
115
|
+
|
116
|
+
<li ><a href="#method-i-users">#users</a>
|
117
|
+
|
118
|
+
</ul>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</nav>
|
123
|
+
|
124
|
+
<main role="main" aria-labelledby="class-Flickr">
|
125
|
+
<h1 id="class-Flickr" class="class">
|
126
|
+
class Flickr
|
127
|
+
</h1>
|
128
|
+
|
129
|
+
<section class="description">
|
130
|
+
|
131
|
+
<p><a href="Flickr.html">Flickr</a> client class. Requires an API key</p>
|
132
|
+
|
133
|
+
</section>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<section class="constants-list">
|
145
|
+
<header>
|
146
|
+
<h3>Constants</h3>
|
147
|
+
</header>
|
148
|
+
<dl>
|
149
|
+
|
150
|
+
<dt id="API_PATH">API_PATH
|
151
|
+
|
152
|
+
<dd>
|
153
|
+
|
154
|
+
|
155
|
+
<dt id="HOST_URL">HOST_URL
|
156
|
+
|
157
|
+
<dd>
|
158
|
+
|
159
|
+
|
160
|
+
<dt id="VALID_SIZES">VALID_SIZES
|
161
|
+
|
162
|
+
<dd><p><a href="Flickr.html">Flickr</a>, annoyingly, uses a number of
|
163
|
+
representations to specify the size of a photo, depending on the context.
|
164
|
+
It gives a label such a “Small” or “Medium” to a size of photo, when
|
165
|
+
returning all possible sizes. However, when generating the uri for the page
|
166
|
+
that features that size of photo, or the source url for the image itself it
|
167
|
+
uses a single letter. Bizarrely, these letters are different depending on
|
168
|
+
whether you want the <a href="Flickr.html">Flickr</a> page for the photo or
|
169
|
+
the source uri – e.g. a “Small” photo (240 pixels on its longest side) may
|
170
|
+
be viewed at “<a
|
171
|
+
href="http://www.flickr.com/photos/sco/2397458775/sizes/s">www.flickr.com/photos/sco/2397458775/sizes/s</a>/”
|
172
|
+
but its source is at “<img
|
173
|
+
src="http://farm4.static.flickr.com/3118/2397458775_2ec2ddc324_m.jpg" />”.
|
174
|
+
The <a href="Flickr.html#VALID_SIZES">VALID_SIZES</a> hash associates the
|
175
|
+
correct letter with a label</p>
|
176
|
+
|
177
|
+
|
178
|
+
</dl>
|
179
|
+
</section>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<section class="attribute-method-details" class="method-section">
|
184
|
+
<header>
|
185
|
+
<h3>Attributes</h3>
|
186
|
+
</header>
|
187
|
+
|
188
|
+
|
189
|
+
<div id="attribute-i-api_key" class="method-detail">
|
190
|
+
<div class="method-heading attribute-method-heading">
|
191
|
+
<span class="method-name">api_key</span><span
|
192
|
+
class="attribute-access-type">[R]</span>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div class="method-description">
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
<div id="attribute-i-auth_token" class="method-detail">
|
203
|
+
<div class="method-heading attribute-method-heading">
|
204
|
+
<span class="method-name">auth_token</span><span
|
205
|
+
class="attribute-access-type">[R]</span>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div class="method-description">
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
<div id="attribute-i-user" class="method-detail">
|
216
|
+
<div class="method-heading attribute-method-heading">
|
217
|
+
<span class="method-name">user</span><span
|
218
|
+
class="attribute-access-type">[RW]</span>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div class="method-description">
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
</div>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
</section>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
233
|
+
<header>
|
234
|
+
<h3>Public Class Methods</h3>
|
235
|
+
</header>
|
236
|
+
|
237
|
+
|
238
|
+
<div id="method-c-new" class="method-detail ">
|
239
|
+
|
240
|
+
<div class="method-heading">
|
241
|
+
<span class="method-name">new</span><span
|
242
|
+
class="method-args">(api_key_or_params={})</span>
|
243
|
+
|
244
|
+
<span class="method-click-advice">click to toggle source</span>
|
245
|
+
|
246
|
+
</div>
|
247
|
+
|
248
|
+
|
249
|
+
<div class="method-description">
|
250
|
+
|
251
|
+
<p>To use the <a href="Flickr.html">Flickr</a> API you need an api key (see <a
|
252
|
+
href="http://www.flickr.com/services/api/misc.api_keys.html">www.flickr.com/services/api/misc.api_keys.html</a>),
|
253
|
+
and the flickr client object shuld be initialized with this. You'll
|
254
|
+
also need a shared secret code if you want to use authentication (e.g. to
|
255
|
+
get a user's private photos) There are two ways to initialize the <a
|
256
|
+
href="Flickr.html">Flickr</a> client. The preferred way is with a hash of
|
257
|
+
params, e.g. 'api_key' => 'your_api_key',
|
258
|
+
'shared_secret' => 'shared_secret_code'. Other way is to
|
259
|
+
use in Rails an config file RAILS_ROOT/config/flickr.api.yml and there use
|
260
|
+
params as key/values even specified for every environment.</p>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<div class="method-source-code" id="new-source">
|
266
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 78</span>
|
267
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">api_key_or_params</span>={})
|
268
|
+
<span class="ruby-ivar">@host</span> = <span class="ruby-constant">HOST_URL</span>
|
269
|
+
<span class="ruby-ivar">@api</span> = <span class="ruby-constant">API_PATH</span>
|
270
|
+
<span class="ruby-identifier">api_key_or_params</span>={} <span class="ruby-keyword">if</span> <span class="ruby-identifier">api_key_or_params</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-comment"># fix for nil value as argument</span>
|
271
|
+
<span class="ruby-identifier">api_key_or_params</span> = {<span class="ruby-value">:api_key</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">api_key_or_params</span>} <span class="ruby-keyword">if</span> <span class="ruby-identifier">api_key_or_params</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
272
|
+
<span class="ruby-identifier">api_key_or_params</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">get</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">parsed?</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">api_key_or_params</span>.<span class="ruby-identifier">empty?</span>
|
273
|
+
<span class="ruby-identifier">set_up_configuration</span> <span class="ruby-identifier">api_key_or_params</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">api_key_or_params</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
274
|
+
<span class="ruby-keyword">end</span></pre>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
</div>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
</div>
|
283
|
+
|
284
|
+
|
285
|
+
</section>
|
286
|
+
|
287
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
288
|
+
<header>
|
289
|
+
<h3>Public Instance Methods</h3>
|
290
|
+
</header>
|
291
|
+
|
292
|
+
|
293
|
+
<div id="method-i-find_by_url" class="method-detail ">
|
294
|
+
|
295
|
+
<div class="method-heading">
|
296
|
+
<span class="method-name">find_by_url</span><span
|
297
|
+
class="method-args">(url)</span>
|
298
|
+
|
299
|
+
<span class="method-click-advice">click to toggle source</span>
|
300
|
+
|
301
|
+
</div>
|
302
|
+
|
303
|
+
|
304
|
+
<div class="method-description">
|
305
|
+
|
306
|
+
<p>Implements flickr.urls.lookupGroup and flickr.urls.lookupUser</p>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
<div class="method-source-code" id="find_by_url-source">
|
312
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 107</span>
|
313
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_by_url</span>(<span class="ruby-identifier">url</span>)
|
314
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">urls_lookupUser</span>(<span class="ruby-string">'url'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">url</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">urls_lookupGroup</span>(<span class="ruby-string">'url'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">url</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">nil</span>
|
315
|
+
(<span class="ruby-identifier">response</span>[<span class="ruby-string">'user'</span>]) <span class="ruby-operator">?</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>[<span class="ruby-string">'user'</span>][<span class="ruby-string">'id'</span>], <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-ivar">@api_key</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">Group</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>[<span class="ruby-string">'group'</span>][<span class="ruby-string">'id'</span>], <span class="ruby-ivar">@api_key</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">nil?</span>
|
316
|
+
<span class="ruby-keyword">end</span></pre>
|
317
|
+
</div>
|
318
|
+
|
319
|
+
</div>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
</div>
|
325
|
+
|
326
|
+
|
327
|
+
<div id="method-i-get_token_from" class="method-detail ">
|
328
|
+
|
329
|
+
<div class="method-heading">
|
330
|
+
<span class="method-name">get_token_from</span><span
|
331
|
+
class="method-args">(frob)</span>
|
332
|
+
|
333
|
+
<span class="method-click-advice">click to toggle source</span>
|
334
|
+
|
335
|
+
</div>
|
336
|
+
|
337
|
+
|
338
|
+
<div class="method-description">
|
339
|
+
|
340
|
+
<p>Gets authentication token given a <a href="Flickr.html">Flickr</a> frob,
|
341
|
+
which is returned when user allows access to their account for the
|
342
|
+
application with the <a href="Flickr.html#attribute-i-api_key">#api_key</a>
|
343
|
+
which made the request</p>
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
<div class="method-source-code" id="get_token_from-source">
|
349
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 96</span>
|
350
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_token_from</span>(<span class="ruby-identifier">frob</span>)
|
351
|
+
<span class="ruby-identifier">auth_response</span> = <span class="ruby-identifier">request</span>(<span class="ruby-string">"auth.getToken"</span>, <span class="ruby-value">:frob</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">frob</span>)[<span class="ruby-string">'auth'</span>]
|
352
|
+
<span class="ruby-ivar">@auth_token</span> = <span class="ruby-identifier">auth_response</span>[<span class="ruby-string">'token'</span>]
|
353
|
+
<span class="ruby-ivar">@user</span> = <span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>( <span class="ruby-string">'id'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">auth_response</span>[<span class="ruby-string">'user'</span>][<span class="ruby-string">'nsid'</span>],
|
354
|
+
<span class="ruby-string">'username'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">auth_response</span>[<span class="ruby-string">'user'</span>][<span class="ruby-string">'username'</span>],
|
355
|
+
<span class="ruby-string">'name'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">auth_response</span>[<span class="ruby-string">'user'</span>][<span class="ruby-string">'fullname'</span>],
|
356
|
+
<span class="ruby-string">'client'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">self</span>)
|
357
|
+
<span class="ruby-ivar">@auth_token</span>
|
358
|
+
<span class="ruby-keyword">end</span></pre>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
</div>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
</div>
|
367
|
+
|
368
|
+
|
369
|
+
<div id="method-i-groups" class="method-detail ">
|
370
|
+
|
371
|
+
<div class="method-heading">
|
372
|
+
<span class="method-name">groups</span><span
|
373
|
+
class="method-args">(group_name, options={})</span>
|
374
|
+
|
375
|
+
<span class="method-click-advice">click to toggle source</span>
|
376
|
+
|
377
|
+
</div>
|
378
|
+
|
379
|
+
|
380
|
+
<div class="method-description">
|
381
|
+
|
382
|
+
<p>Implements flickr.groups.search</p>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
<div class="method-source-code" id="groups-source">
|
388
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 140</span>
|
389
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">groups</span>(<span class="ruby-identifier">group_name</span>, <span class="ruby-identifier">options</span>={})
|
390
|
+
<span class="ruby-identifier">collection</span> = <span class="ruby-identifier">groups_search</span>({<span class="ruby-string">"text"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">group_name</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>))[<span class="ruby-string">'groups'</span>][<span class="ruby-string">'group'</span>]
|
391
|
+
<span class="ruby-identifier">collection</span> = [<span class="ruby-identifier">collection</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
392
|
+
|
393
|
+
<span class="ruby-identifier">collection</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-constant">Group</span>.<span class="ruby-identifier">new</span>( <span class="ruby-string">"id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">group</span>[<span class="ruby-string">'nsid'</span>],
|
394
|
+
<span class="ruby-string">"name"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">group</span>[<span class="ruby-string">'name'</span>],
|
395
|
+
<span class="ruby-string">"eighteenplus"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">group</span>[<span class="ruby-string">'eighteenplus'</span>],
|
396
|
+
<span class="ruby-string">"client"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">self</span>) }
|
397
|
+
<span class="ruby-keyword">end</span></pre>
|
398
|
+
</div>
|
399
|
+
|
400
|
+
</div>
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
</div>
|
406
|
+
|
407
|
+
|
408
|
+
<div id="method-i-http_get" class="method-detail ">
|
409
|
+
|
410
|
+
<div class="method-heading">
|
411
|
+
<span class="method-name">http_get</span><span
|
412
|
+
class="method-args">(url)</span>
|
413
|
+
|
414
|
+
<span class="method-click-advice">click to toggle source</span>
|
415
|
+
|
416
|
+
</div>
|
417
|
+
|
418
|
+
|
419
|
+
<div class="method-description">
|
420
|
+
|
421
|
+
<p>Does an HTTP GET on a given URL and returns the response body</p>
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
<div class="method-source-code" id="http_get-source">
|
427
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 178</span>
|
428
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">http_get</span>(<span class="ruby-identifier">url</span>)
|
429
|
+
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get_response</span>(<span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url</span>)).<span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_s</span>
|
430
|
+
<span class="ruby-keyword">end</span></pre>
|
431
|
+
</div>
|
432
|
+
|
433
|
+
</div>
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
</div>
|
439
|
+
|
440
|
+
|
441
|
+
<div id="method-i-licenses" class="method-detail ">
|
442
|
+
|
443
|
+
<div class="method-heading">
|
444
|
+
<span class="method-name">licenses</span><span
|
445
|
+
class="method-args">()</span>
|
446
|
+
|
447
|
+
<span class="method-click-advice">click to toggle source</span>
|
448
|
+
|
449
|
+
</div>
|
450
|
+
|
451
|
+
|
452
|
+
<div class="method-description">
|
453
|
+
|
454
|
+
<p>Implements flickr.photos.licenses.getInfo</p>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
<div class="method-source-code" id="licenses-source">
|
460
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 160</span>
|
461
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">licenses</span>
|
462
|
+
<span class="ruby-identifier">photos_licenses_getInfo</span>[<span class="ruby-string">'licenses'</span>][<span class="ruby-string">'license'</span>]
|
463
|
+
<span class="ruby-keyword">end</span></pre>
|
464
|
+
</div>
|
465
|
+
|
466
|
+
</div>
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
</div>
|
472
|
+
|
473
|
+
|
474
|
+
<div id="method-i-login_url" class="method-detail ">
|
475
|
+
|
476
|
+
<div class="method-heading">
|
477
|
+
<span class="method-name">login_url</span><span
|
478
|
+
class="method-args">(perms)</span>
|
479
|
+
|
480
|
+
<span class="method-click-advice">click to toggle source</span>
|
481
|
+
|
482
|
+
</div>
|
483
|
+
|
484
|
+
|
485
|
+
<div class="method-description">
|
486
|
+
|
487
|
+
<p>Returns url for user to login in to <a href="Flickr.html">Flickr</a> to
|
488
|
+
authenticate app for a user</p>
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
<div class="method-source-code" id="login_url-source">
|
494
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 165</span>
|
495
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">login_url</span>(<span class="ruby-identifier">perms</span>)
|
496
|
+
<span class="ruby-node">"http://flickr.com/services/auth/?api_key=#{@api_key}&perms=#{perms}&api_sig=#{signature_from('api_key'=>@api_key, 'perms' => perms)}"</span>
|
497
|
+
<span class="ruby-keyword">end</span></pre>
|
498
|
+
</div>
|
499
|
+
|
500
|
+
</div>
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
</div>
|
506
|
+
|
507
|
+
|
508
|
+
<div id="method-i-method_missing" class="method-detail ">
|
509
|
+
|
510
|
+
<div class="method-heading">
|
511
|
+
<span class="method-name">method_missing</span><span
|
512
|
+
class="method-args">(method_id, params={})</span>
|
513
|
+
|
514
|
+
<span class="method-click-advice">click to toggle source</span>
|
515
|
+
|
516
|
+
</div>
|
517
|
+
|
518
|
+
|
519
|
+
<div class="method-description">
|
520
|
+
|
521
|
+
<p>Implements everything else. Any method not defined explicitly will be
|
522
|
+
passed on to the <a href="Flickr.html">Flickr</a> API, and return an
|
523
|
+
XmlSimple document. For example, Flickr#test_echo is not defined, so it
|
524
|
+
will pass the call to the flickr.test.echo method.</p>
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
<div class="method-source-code" id="method_missing-source">
|
530
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 173</span>
|
531
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">method_id</span>, <span class="ruby-identifier">params</span>={})
|
532
|
+
<span class="ruby-identifier">request</span>(<span class="ruby-identifier">method_id</span>.<span class="ruby-identifier">id2name</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/_/</span>, <span class="ruby-string">'.'</span>), <span class="ruby-identifier">params</span>)
|
533
|
+
<span class="ruby-keyword">end</span></pre>
|
534
|
+
</div>
|
535
|
+
|
536
|
+
</div>
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
</div>
|
542
|
+
|
543
|
+
|
544
|
+
<div id="method-i-photos" class="method-detail ">
|
545
|
+
|
546
|
+
<div class="method-heading">
|
547
|
+
<span class="method-name">photos</span><span
|
548
|
+
class="method-args">(*criteria)</span>
|
549
|
+
|
550
|
+
<span class="method-click-advice">click to toggle source</span>
|
551
|
+
|
552
|
+
</div>
|
553
|
+
|
554
|
+
|
555
|
+
<div class="method-description">
|
556
|
+
|
557
|
+
<p>Implements flickr.photos.getRecent and flickr.photos.search</p>
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
<div class="method-source-code" id="photos-source">
|
563
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 113</span>
|
564
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">photos</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">criteria</span>)
|
565
|
+
<span class="ruby-keyword">not</span> <span class="ruby-identifier">criteria</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">photos_search</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">criteria</span>) <span class="ruby-keyword">or</span> <span class="ruby-identifier">recent</span>
|
566
|
+
<span class="ruby-keyword">end</span></pre>
|
567
|
+
</div>
|
568
|
+
|
569
|
+
</div>
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
</div>
|
575
|
+
|
576
|
+
|
577
|
+
<div id="method-i-photos_request" class="method-detail ">
|
578
|
+
|
579
|
+
<div class="method-heading">
|
580
|
+
<span class="method-name">photos_request</span><span
|
581
|
+
class="method-args">(method, params={}, list_node="photos")</span>
|
582
|
+
|
583
|
+
<span class="method-click-advice">click to toggle source</span>
|
584
|
+
|
585
|
+
</div>
|
586
|
+
|
587
|
+
|
588
|
+
<div class="method-description">
|
589
|
+
|
590
|
+
<p>acts like request but returns a <a
|
591
|
+
href="Flickr/PhotoCollection.html">PhotoCollection</a> (a list of <a
|
592
|
+
href="Flickr/Photo.html">Photo</a> objects)</p>
|
593
|
+
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
<div class="method-source-code" id="photos_request-source">
|
598
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 191</span>
|
599
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">photos_request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>={}, <span class="ruby-identifier">list_node</span>=<span class="ruby-string">"photos"</span>)
|
600
|
+
<span class="ruby-identifier">photos</span> = <span class="ruby-identifier">request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>)
|
601
|
+
<span class="ruby-constant">PhotoCollection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">photos</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-identifier">list_node</span>)
|
602
|
+
<span class="ruby-keyword">end</span></pre>
|
603
|
+
</div>
|
604
|
+
|
605
|
+
</div>
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
</div>
|
611
|
+
|
612
|
+
|
613
|
+
<div id="method-i-photos_search" class="method-detail ">
|
614
|
+
|
615
|
+
<div class="method-heading">
|
616
|
+
<span class="method-name">photos_search</span><span
|
617
|
+
class="method-args">(params={})</span>
|
618
|
+
|
619
|
+
<span class="method-click-advice">click to toggle source</span>
|
620
|
+
|
621
|
+
</div>
|
622
|
+
|
623
|
+
|
624
|
+
<div class="method-description">
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
<div class="method-source-code" id="photos_search-source">
|
632
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 123</span>
|
633
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">photos_search</span>(<span class="ruby-identifier">params</span>={})
|
634
|
+
<span class="ruby-identifier">photos_request</span>(<span class="ruby-string">'photos.search'</span>, <span class="ruby-identifier">params</span>)
|
635
|
+
<span class="ruby-keyword">end</span></pre>
|
636
|
+
</div>
|
637
|
+
|
638
|
+
</div>
|
639
|
+
|
640
|
+
|
641
|
+
<div class="aliases">
|
642
|
+
Also aliased as: <a href="Flickr.html#method-i-search">search</a>
|
643
|
+
</div>
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
</div>
|
648
|
+
|
649
|
+
|
650
|
+
<div id="method-i-photoset" class="method-detail ">
|
651
|
+
|
652
|
+
<div class="method-heading">
|
653
|
+
<span class="method-name">photoset</span><span
|
654
|
+
class="method-args">(photoset_id)</span>
|
655
|
+
|
656
|
+
<span class="method-click-advice">click to toggle source</span>
|
657
|
+
|
658
|
+
</div>
|
659
|
+
|
660
|
+
|
661
|
+
<div class="method-description">
|
662
|
+
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
|
668
|
+
<div class="method-source-code" id="photoset-source">
|
669
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 150</span>
|
670
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">photoset</span>(<span class="ruby-identifier">photoset_id</span>)
|
671
|
+
<span class="ruby-constant">Photoset</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">photoset_id</span>, <span class="ruby-ivar">@api_key</span>)
|
672
|
+
<span class="ruby-keyword">end</span></pre>
|
673
|
+
</div>
|
674
|
+
|
675
|
+
</div>
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
</div>
|
681
|
+
|
682
|
+
|
683
|
+
<div id="method-i-recent" class="method-detail ">
|
684
|
+
|
685
|
+
<div class="method-heading">
|
686
|
+
<span class="method-name">recent</span><span
|
687
|
+
class="method-args">()</span>
|
688
|
+
|
689
|
+
<span class="method-click-advice">click to toggle source</span>
|
690
|
+
|
691
|
+
</div>
|
692
|
+
|
693
|
+
|
694
|
+
<div class="method-description">
|
695
|
+
|
696
|
+
<p>flickr.photos.getRecent 100 newest photos from everyone</p>
|
697
|
+
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
<div class="method-source-code" id="recent-source">
|
702
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 119</span>
|
703
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">recent</span>
|
704
|
+
<span class="ruby-identifier">photos_request</span>(<span class="ruby-string">'photos.getRecent'</span>)
|
705
|
+
<span class="ruby-keyword">end</span></pre>
|
706
|
+
</div>
|
707
|
+
|
708
|
+
</div>
|
709
|
+
|
710
|
+
|
711
|
+
|
712
|
+
|
713
|
+
</div>
|
714
|
+
|
715
|
+
|
716
|
+
<div id="method-i-related_tags" class="method-detail ">
|
717
|
+
|
718
|
+
<div class="method-heading">
|
719
|
+
<span class="method-name">related_tags</span><span
|
720
|
+
class="method-args">(tag)</span>
|
721
|
+
|
722
|
+
<span class="method-click-advice">click to toggle source</span>
|
723
|
+
|
724
|
+
</div>
|
725
|
+
|
726
|
+
|
727
|
+
<div class="method-description">
|
728
|
+
|
729
|
+
<p>Implements flickr.tags.getRelated</p>
|
730
|
+
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
<div class="method-source-code" id="related_tags-source">
|
735
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 155</span>
|
736
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">related_tags</span>(<span class="ruby-identifier">tag</span>)
|
737
|
+
<span class="ruby-identifier">tags_getRelated</span>(<span class="ruby-string">'tag'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">tag</span>)[<span class="ruby-string">'tags'</span>][<span class="ruby-string">'tag'</span>]
|
738
|
+
<span class="ruby-keyword">end</span></pre>
|
739
|
+
</div>
|
740
|
+
|
741
|
+
</div>
|
742
|
+
|
743
|
+
|
744
|
+
|
745
|
+
|
746
|
+
</div>
|
747
|
+
|
748
|
+
|
749
|
+
<div id="method-i-request" class="method-detail ">
|
750
|
+
|
751
|
+
<div class="method-heading">
|
752
|
+
<span class="method-name">request</span><span
|
753
|
+
class="method-args">(method, params={})</span>
|
754
|
+
|
755
|
+
<span class="method-click-advice">click to toggle source</span>
|
756
|
+
|
757
|
+
</div>
|
758
|
+
|
759
|
+
|
760
|
+
<div class="method-description">
|
761
|
+
|
762
|
+
<p>Takes a <a href="Flickr.html">Flickr</a> API method name and set of
|
763
|
+
parameters; returns an XmlSimple object with the response</p>
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
|
768
|
+
<div class="method-source-code" id="request-source">
|
769
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 183</span>
|
770
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>={})
|
771
|
+
<span class="ruby-identifier">url</span> = <span class="ruby-identifier">request_url</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>)
|
772
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-constant">XmlSimple</span>.<span class="ruby-identifier">xml_in</span>(<span class="ruby-identifier">http_get</span>(<span class="ruby-identifier">url</span>), { <span class="ruby-string">'ForceArray'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">false</span> })
|
773
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">response</span>[<span class="ruby-string">'err'</span>][<span class="ruby-string">'msg'</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>[<span class="ruby-string">'stat'</span>] <span class="ruby-operator">!=</span> <span class="ruby-string">'ok'</span>
|
774
|
+
<span class="ruby-identifier">response</span>
|
775
|
+
<span class="ruby-keyword">end</span></pre>
|
776
|
+
</div>
|
777
|
+
|
778
|
+
</div>
|
779
|
+
|
780
|
+
|
781
|
+
|
782
|
+
|
783
|
+
</div>
|
784
|
+
|
785
|
+
|
786
|
+
<div id="method-i-request_url" class="method-detail ">
|
787
|
+
|
788
|
+
<div class="method-heading">
|
789
|
+
<span class="method-name">request_url</span><span
|
790
|
+
class="method-args">(method, params={})</span>
|
791
|
+
|
792
|
+
<span class="method-click-advice">click to toggle source</span>
|
793
|
+
|
794
|
+
</div>
|
795
|
+
|
796
|
+
|
797
|
+
<div class="method-description">
|
798
|
+
|
799
|
+
<p>Builds url for <a href="Flickr.html">Flickr</a> API REST request from given
|
800
|
+
the flickr method name (exclusing the 'flickr.' that begins each
|
801
|
+
method call) and params (where applicable) which should be supplied as a
|
802
|
+
Hash (e.g 'user_id' => “foo123”)</p>
|
803
|
+
|
804
|
+
|
805
|
+
|
806
|
+
|
807
|
+
<div class="method-source-code" id="request_url-source">
|
808
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 199</span>
|
809
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">request_url</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>={})
|
810
|
+
<span class="ruby-identifier">method</span> = <span class="ruby-string">'flickr.'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">method</span>
|
811
|
+
<span class="ruby-identifier">url</span> = <span class="ruby-node">"#{@host}#{@api}/?api_key=#{@api_key}&method=#{method}"</span>
|
812
|
+
<span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-string">'api_key'</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@api_key</span>, <span class="ruby-string">'method'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">method</span>, <span class="ruby-string">'auth_token'</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@auth_token</span>)
|
813
|
+
<span class="ruby-identifier">signature</span> = <span class="ruby-identifier">signature_from</span>(<span class="ruby-identifier">params</span>)
|
814
|
+
|
815
|
+
<span class="ruby-identifier">url</span> = <span class="ruby-node">"#{@host}#{@api}/?"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-string">'api_sig'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">signature</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{k}="</span> <span class="ruby-operator">+</span> <span class="ruby-constant">CGI</span><span class="ruby-operator">::</span><span class="ruby-identifier">escape</span>(<span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span> }.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">"&"</span>)
|
816
|
+
<span class="ruby-keyword">end</span></pre>
|
817
|
+
</div>
|
818
|
+
|
819
|
+
</div>
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
</div>
|
825
|
+
|
826
|
+
|
827
|
+
<div id="method-i-search" class="method-detail method-alias">
|
828
|
+
|
829
|
+
<div class="method-heading">
|
830
|
+
<span class="method-name">search</span><span
|
831
|
+
class="method-args">(params={})</span>
|
832
|
+
|
833
|
+
</div>
|
834
|
+
|
835
|
+
|
836
|
+
<div class="method-description">
|
837
|
+
|
838
|
+
|
839
|
+
|
840
|
+
|
841
|
+
|
842
|
+
|
843
|
+
</div>
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
|
848
|
+
<div class="aliases">
|
849
|
+
Alias for: <a href="Flickr.html#method-i-photos_search">photos_search</a>
|
850
|
+
</div>
|
851
|
+
|
852
|
+
</div>
|
853
|
+
|
854
|
+
|
855
|
+
<div id="method-i-set_up_configuration" class="method-detail ">
|
856
|
+
|
857
|
+
<div class="method-heading">
|
858
|
+
<span class="method-name">set_up_configuration</span><span
|
859
|
+
class="method-args">(api_key_or_params = {})</span>
|
860
|
+
|
861
|
+
<span class="method-click-advice">click to toggle source</span>
|
862
|
+
|
863
|
+
</div>
|
864
|
+
|
865
|
+
|
866
|
+
<div class="method-description">
|
867
|
+
|
868
|
+
|
869
|
+
|
870
|
+
|
871
|
+
|
872
|
+
|
873
|
+
<div class="method-source-code" id="set_up_configuration-source">
|
874
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 87</span>
|
875
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">set_up_configuration</span> <span class="ruby-identifier">api_key_or_params</span> = {}
|
876
|
+
<span class="ruby-ivar">@api_key</span> = <span class="ruby-identifier">api_key_or_params</span>[<span class="ruby-value">:api_key</span>]
|
877
|
+
<span class="ruby-ivar">@shared_secret</span> = <span class="ruby-identifier">api_key_or_params</span>[<span class="ruby-value">:shared_secret</span>]
|
878
|
+
<span class="ruby-ivar">@auth_token</span> = <span class="ruby-identifier">api_key_or_params</span>[<span class="ruby-value">:auth_token</span>]
|
879
|
+
<span class="ruby-keyword">end</span></pre>
|
880
|
+
</div>
|
881
|
+
|
882
|
+
</div>
|
883
|
+
|
884
|
+
|
885
|
+
|
886
|
+
|
887
|
+
</div>
|
888
|
+
|
889
|
+
|
890
|
+
<div id="method-i-signature_from" class="method-detail ">
|
891
|
+
|
892
|
+
<div class="method-heading">
|
893
|
+
<span class="method-name">signature_from</span><span
|
894
|
+
class="method-args">(params={})</span>
|
895
|
+
|
896
|
+
<span class="method-click-advice">click to toggle source</span>
|
897
|
+
|
898
|
+
</div>
|
899
|
+
|
900
|
+
|
901
|
+
<div class="method-description">
|
902
|
+
|
903
|
+
|
904
|
+
|
905
|
+
|
906
|
+
|
907
|
+
|
908
|
+
<div class="method-source-code" id="signature_from-source">
|
909
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 208</span>
|
910
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">signature_from</span>(<span class="ruby-identifier">params</span>={})
|
911
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@shared_secret</span> <span class="ruby-comment"># don't both getting signature if no shared_secret</span>
|
912
|
+
<span class="ruby-identifier">request_str</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span>}.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{p[0].to_s}#{p[1]}"</span>}.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">join</span> <span class="ruby-comment"># build key value pairs, sort in alpha order then join them, ignoring those with nil value</span>
|
913
|
+
<span class="ruby-keyword">return</span> <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-node">"#{@shared_secret}#{request_str}"</span>)
|
914
|
+
<span class="ruby-keyword">end</span></pre>
|
915
|
+
</div>
|
916
|
+
|
917
|
+
</div>
|
918
|
+
|
919
|
+
|
920
|
+
|
921
|
+
|
922
|
+
</div>
|
923
|
+
|
924
|
+
|
925
|
+
<div id="method-i-tag" class="method-detail ">
|
926
|
+
|
927
|
+
<div class="method-heading">
|
928
|
+
<span class="method-name">tag</span><span
|
929
|
+
class="method-args">(tag)</span>
|
930
|
+
|
931
|
+
<span class="method-click-advice">click to toggle source</span>
|
932
|
+
|
933
|
+
</div>
|
934
|
+
|
935
|
+
|
936
|
+
<div class="method-description">
|
937
|
+
|
938
|
+
<p>Gets public photos with a given tag</p>
|
939
|
+
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
<div class="method-source-code" id="tag-source">
|
944
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 129</span>
|
945
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">tag</span>(<span class="ruby-identifier">tag</span>)
|
946
|
+
<span class="ruby-identifier">photos</span>(<span class="ruby-string">'tags'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">tag</span>)
|
947
|
+
<span class="ruby-keyword">end</span></pre>
|
948
|
+
</div>
|
949
|
+
|
950
|
+
</div>
|
951
|
+
|
952
|
+
|
953
|
+
|
954
|
+
|
955
|
+
</div>
|
956
|
+
|
957
|
+
|
958
|
+
<div id="method-i-users" class="method-detail ">
|
959
|
+
|
960
|
+
<div class="method-heading">
|
961
|
+
<span class="method-name">users</span><span
|
962
|
+
class="method-args">(lookup=nil)</span>
|
963
|
+
|
964
|
+
<span class="method-click-advice">click to toggle source</span>
|
965
|
+
|
966
|
+
</div>
|
967
|
+
|
968
|
+
|
969
|
+
<div class="method-description">
|
970
|
+
|
971
|
+
<p>Implements flickr.people.findByEmail and flickr.people.findByUsername.</p>
|
972
|
+
|
973
|
+
|
974
|
+
|
975
|
+
|
976
|
+
<div class="method-source-code" id="users-source">
|
977
|
+
<pre><span class="ruby-comment"># File lib/flickr.rb, line 134</span>
|
978
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">users</span>(<span class="ruby-identifier">lookup</span>=<span class="ruby-keyword">nil</span>)
|
979
|
+
<span class="ruby-identifier">user</span> = <span class="ruby-identifier">people_findByEmail</span>(<span class="ruby-string">'find_email'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">lookup</span>)[<span class="ruby-string">'user'</span>] <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">people_findByUsername</span>(<span class="ruby-string">'username'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">lookup</span>)[<span class="ruby-string">'user'</span>]
|
980
|
+
<span class="ruby-keyword">return</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">user</span>[<span class="ruby-string">"nsid"</span>], <span class="ruby-string">"username"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">user</span>[<span class="ruby-string">"username"</span>], <span class="ruby-string">"client"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">self</span>)
|
981
|
+
<span class="ruby-keyword">end</span></pre>
|
982
|
+
</div>
|
983
|
+
|
984
|
+
</div>
|
985
|
+
|
986
|
+
|
987
|
+
|
988
|
+
|
989
|
+
</div>
|
990
|
+
|
991
|
+
|
992
|
+
</section>
|
993
|
+
|
994
|
+
</section>
|
995
|
+
</main>
|
996
|
+
|
997
|
+
|
998
|
+
<footer id="validator-badges" role="contentinfo">
|
999
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
1000
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
1001
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1002
|
+
</footer>
|
1003
|
+
|