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
metadata
CHANGED
@@ -1,99 +1,163 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickr.rb
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 1
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 1.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Scott Raymond, Patrick Plattes, Rafal Piekarski
|
13
|
-
autorequire:
|
8
|
+
autorequire: flickr.rb
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2010-05-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: xml-simple
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 0
|
30
|
-
- 7
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
31
19
|
version: 1.0.7
|
32
20
|
type: :runtime
|
33
|
-
|
34
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mocha
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Gem for using Flickr API in Ruby - https://www.flickr.com/services/api/
|
35
70
|
email: ravbaker@gmail.com
|
36
71
|
executables: []
|
37
|
-
|
38
72
|
extensions: []
|
39
|
-
|
40
73
|
extra_rdoc_files: []
|
41
|
-
|
42
|
-
files:
|
74
|
+
files:
|
43
75
|
- Changelog.txt
|
44
76
|
- flickr.gemspec
|
77
|
+
- Gemfile
|
78
|
+
- Gemfile.lock
|
45
79
|
- init.rb
|
46
80
|
- lib/flickr.rb
|
47
81
|
- LICENSE
|
48
82
|
- Manifest.txt
|
49
83
|
- Rakefile
|
50
|
-
- rdoc/classes/Flickr/Config.html
|
51
|
-
- rdoc/classes/Flickr/Group.html
|
52
|
-
- rdoc/classes/Flickr/Photo.html
|
53
|
-
- rdoc/classes/Flickr/PhotoCollection.html
|
54
|
-
- rdoc/classes/Flickr/Photoset.html
|
55
|
-
- rdoc/classes/Flickr/User.html
|
56
|
-
- rdoc/classes/Flickr.html
|
57
84
|
- rdoc/created.rid
|
58
|
-
- rdoc/
|
59
|
-
- rdoc/
|
60
|
-
- rdoc/
|
61
|
-
- rdoc/
|
62
|
-
- rdoc/
|
85
|
+
- rdoc/Flickr/Config.html
|
86
|
+
- rdoc/Flickr/Group.html
|
87
|
+
- rdoc/Flickr/Photo.html
|
88
|
+
- rdoc/Flickr/PhotoCollection.html
|
89
|
+
- rdoc/Flickr/Photoset.html
|
90
|
+
- rdoc/Flickr/User.html
|
91
|
+
- rdoc/Flickr.html
|
92
|
+
- rdoc/fonts/Lato-Light.ttf
|
93
|
+
- rdoc/fonts/Lato-LightItalic.ttf
|
94
|
+
- rdoc/fonts/Lato-Regular.ttf
|
95
|
+
- rdoc/fonts/Lato-RegularItalic.ttf
|
96
|
+
- rdoc/fonts/SourceCodePro-Bold.ttf
|
97
|
+
- rdoc/fonts/SourceCodePro-Regular.ttf
|
98
|
+
- rdoc/fonts.css
|
99
|
+
- rdoc/images/add.png
|
100
|
+
- rdoc/images/arrow_up.png
|
101
|
+
- rdoc/images/brick.png
|
102
|
+
- rdoc/images/brick_link.png
|
103
|
+
- rdoc/images/bug.png
|
104
|
+
- rdoc/images/bullet_black.png
|
105
|
+
- rdoc/images/bullet_toggle_minus.png
|
106
|
+
- rdoc/images/bullet_toggle_plus.png
|
107
|
+
- rdoc/images/date.png
|
108
|
+
- rdoc/images/delete.png
|
109
|
+
- rdoc/images/find.png
|
110
|
+
- rdoc/images/loadingAnimation.gif
|
111
|
+
- rdoc/images/macFFBgHack.png
|
112
|
+
- rdoc/images/package.png
|
113
|
+
- rdoc/images/page_green.png
|
114
|
+
- rdoc/images/page_white_text.png
|
115
|
+
- rdoc/images/page_white_width.png
|
116
|
+
- rdoc/images/plugin.png
|
117
|
+
- rdoc/images/ruby.png
|
118
|
+
- rdoc/images/tag_blue.png
|
119
|
+
- rdoc/images/tag_green.png
|
120
|
+
- rdoc/images/transparent.png
|
121
|
+
- rdoc/images/wrench.png
|
122
|
+
- rdoc/images/wrench_orange.png
|
123
|
+
- rdoc/images/zoom.png
|
63
124
|
- rdoc/index.html
|
64
|
-
- rdoc/
|
125
|
+
- rdoc/js/darkfish.js
|
126
|
+
- rdoc/js/jquery.js
|
127
|
+
- rdoc/js/navigation.js
|
128
|
+
- rdoc/js/search.js
|
129
|
+
- rdoc/js/search_index.js
|
130
|
+
- rdoc/js/searcher.js
|
131
|
+
- rdoc/rdoc.css
|
132
|
+
- rdoc/README_txt.html
|
133
|
+
- rdoc/table_of_contents.html
|
65
134
|
- README.txt
|
66
135
|
- test/flickr_test.rb
|
67
136
|
- TODO
|
68
|
-
has_rdoc: true
|
69
137
|
homepage: http://github.com/RaVbaker/flickr/
|
70
|
-
licenses:
|
71
|
-
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
metadata: {}
|
72
141
|
post_install_message:
|
73
142
|
rdoc_options: []
|
74
|
-
|
75
|
-
require_paths:
|
143
|
+
require_paths:
|
76
144
|
- lib
|
77
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
91
|
-
requirements:
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
requirements:
|
92
156
|
- Flickr developers API key
|
93
|
-
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.1.11
|
95
159
|
signing_key:
|
96
|
-
specification_version:
|
97
|
-
summary:
|
160
|
+
specification_version: 2
|
161
|
+
summary: 'An insanely easy interface to the Flickr photo-sharing service. Also available
|
162
|
+
as a Rails plugin! By Scott Raymond. Maintainer: Rafal Piekarski'
|
98
163
|
test_files: []
|
99
|
-
|
data/rdoc/classes/Flickr.html
DELETED
@@ -1,807 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Flickr</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Flickr</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/flickr_rb.html">
|
59
|
-
lib/flickr.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<p>
|
83
|
-
<a href="Flickr.html">Flickr</a> client class. Requires an API key
|
84
|
-
</p>
|
85
|
-
|
86
|
-
</div>
|
87
|
-
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
<div id="method-list">
|
92
|
-
<h3 class="section-bar">Methods</h3>
|
93
|
-
|
94
|
-
<div class="name-list">
|
95
|
-
<a href="#M000004">find_by_url</a>
|
96
|
-
<a href="#M000003">get_token_from</a>
|
97
|
-
<a href="#M000011">groups</a>
|
98
|
-
<a href="#M000017">http_get</a>
|
99
|
-
<a href="#M000014">licenses</a>
|
100
|
-
<a href="#M000015">login_url</a>
|
101
|
-
<a href="#M000016">method_missing</a>
|
102
|
-
<a href="#M000001">new</a>
|
103
|
-
<a href="#M000005">photos</a>
|
104
|
-
<a href="#M000019">photos_request</a>
|
105
|
-
<a href="#M000007">photos_search</a>
|
106
|
-
<a href="#M000012">photoset</a>
|
107
|
-
<a href="#M000006">recent</a>
|
108
|
-
<a href="#M000013">related_tags</a>
|
109
|
-
<a href="#M000018">request</a>
|
110
|
-
<a href="#M000020">request_url</a>
|
111
|
-
<a href="#M000008">search</a>
|
112
|
-
<a href="#M000002">set_up_configuration</a>
|
113
|
-
<a href="#M000021">signature_from</a>
|
114
|
-
<a href="#M000009">tag</a>
|
115
|
-
<a href="#M000010">users</a>
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
|
119
|
-
</div>
|
120
|
-
|
121
|
-
|
122
|
-
<!-- if includes -->
|
123
|
-
|
124
|
-
<div id="section">
|
125
|
-
|
126
|
-
<div id="class-list">
|
127
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
128
|
-
|
129
|
-
Class <a href="Flickr/Config.html" class="link">Flickr::Config</a><br />
|
130
|
-
Class <a href="Flickr/Group.html" class="link">Flickr::Group</a><br />
|
131
|
-
Class <a href="Flickr/Photo.html" class="link">Flickr::Photo</a><br />
|
132
|
-
Class <a href="Flickr/PhotoCollection.html" class="link">Flickr::PhotoCollection</a><br />
|
133
|
-
Class <a href="Flickr/Photoset.html" class="link">Flickr::Photoset</a><br />
|
134
|
-
Class <a href="Flickr/User.html" class="link">Flickr::User</a><br />
|
135
|
-
|
136
|
-
</div>
|
137
|
-
|
138
|
-
<div id="constants-list">
|
139
|
-
<h3 class="section-bar">Constants</h3>
|
140
|
-
|
141
|
-
<div class="name-list">
|
142
|
-
<table summary="Constants">
|
143
|
-
<tr class="top-aligned-row context-row">
|
144
|
-
<td class="context-item-name">HOST_URL</td>
|
145
|
-
<td>=</td>
|
146
|
-
<td class="context-item-value">'http://api.flickr.com'</td>
|
147
|
-
</tr>
|
148
|
-
<tr class="top-aligned-row context-row">
|
149
|
-
<td class="context-item-name">API_PATH</td>
|
150
|
-
<td>=</td>
|
151
|
-
<td class="context-item-value">'/services/rest'</td>
|
152
|
-
</tr>
|
153
|
-
<tr class="top-aligned-row context-row">
|
154
|
-
<td class="context-item-name">VALID_SIZES</td>
|
155
|
-
<td>=</td>
|
156
|
-
<td class="context-item-value">{ "Square" => ["s", "sq"], "Thumbnail" => ["t", "t"], "Small" => ["m", "s"], "Medium" => [nil, "m"], "Large" => ["b", "l"]</td>
|
157
|
-
<td width="3em"> </td>
|
158
|
-
<td class="context-item-desc">
|
159
|
-
<a href="Flickr.html">Flickr</a>, annoyingly, uses a number of
|
160
|
-
representations to specify the size of a photo, depending on the context.
|
161
|
-
It gives a label such a "Small" or "Medium" to a size
|
162
|
-
of photo, when returning all possible sizes. However, when generating the
|
163
|
-
uri for the page that features that size of photo, or the source url for
|
164
|
-
the image itself it uses a single letter. Bizarrely, these letters are
|
165
|
-
different depending on whether you want the <a
|
166
|
-
href="Flickr.html">Flickr</a> page for the photo or the source uri —
|
167
|
-
e.g. a "Small" photo (240 pixels on its longest side) may be
|
168
|
-
viewed at "<a
|
169
|
-
href="http://www.flickr.com/photos/sco/2397458775/sizes/s">www.flickr.com/photos/sco/2397458775/sizes/s</a>/"
|
170
|
-
but its source is at "<img
|
171
|
-
src="http://farm4.static.flickr.com/3118/2397458775_2ec2ddc324_m.jpg"
|
172
|
-
/>". The VALID_SIZES hash associates the correct letter with a label
|
173
|
-
|
174
|
-
</td>
|
175
|
-
</tr>
|
176
|
-
</table>
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
<div id="attribute-list">
|
183
|
-
<h3 class="section-bar">Attributes</h3>
|
184
|
-
|
185
|
-
<div class="name-list">
|
186
|
-
<table>
|
187
|
-
<tr class="top-aligned-row context-row">
|
188
|
-
<td class="context-item-name">api_key</td>
|
189
|
-
<td class="context-item-value"> [R] </td>
|
190
|
-
<td class="context-item-desc"></td>
|
191
|
-
</tr>
|
192
|
-
<tr class="top-aligned-row context-row">
|
193
|
-
<td class="context-item-name">auth_token</td>
|
194
|
-
<td class="context-item-value"> [R] </td>
|
195
|
-
<td class="context-item-desc"></td>
|
196
|
-
</tr>
|
197
|
-
<tr class="top-aligned-row context-row">
|
198
|
-
<td class="context-item-name">user</td>
|
199
|
-
<td class="context-item-value"> [RW] </td>
|
200
|
-
<td class="context-item-desc"></td>
|
201
|
-
</tr>
|
202
|
-
</table>
|
203
|
-
</div>
|
204
|
-
</div>
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
<!-- if method_list -->
|
209
|
-
<div id="methods">
|
210
|
-
<h3 class="section-bar">Public Class methods</h3>
|
211
|
-
|
212
|
-
<div id="method-M000001" class="method-detail">
|
213
|
-
<a name="M000001"></a>
|
214
|
-
|
215
|
-
<div class="method-heading">
|
216
|
-
<a href="#M000001" class="method-signature">
|
217
|
-
<span class="method-name">new</span><span class="method-args">(api_key_or_params={})</span>
|
218
|
-
</a>
|
219
|
-
</div>
|
220
|
-
|
221
|
-
<div class="method-description">
|
222
|
-
<p>
|
223
|
-
To use the <a href="Flickr.html">Flickr</a> API you need an api key (see <a
|
224
|
-
href="http://www.flickr.com/services/api/misc.api_keys.html">www.flickr.com/services/api/misc.api_keys.html</a>),
|
225
|
-
and the flickr client object shuld be initialized with this. You‘ll
|
226
|
-
also need a shared secret code if you want to use authentication (e.g. to
|
227
|
-
get a user‘s private <a href="Flickr.html#M000005">photos</a>) There
|
228
|
-
are two ways to initialize the <a href="Flickr.html">Flickr</a> client. The
|
229
|
-
preferred way is with a hash of params, e.g. ‘api_key’ =>
|
230
|
-
‘your_api_key’, ‘shared_secret’ =>
|
231
|
-
‘shared_secret_code’. Other way is to use in Rails an config
|
232
|
-
file RAILS_ROOT/config/flickr.api.yml and there use params as key/values
|
233
|
-
even specified for every environment.
|
234
|
-
</p>
|
235
|
-
<p><a class="source-toggle" href="#"
|
236
|
-
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
237
|
-
<div class="method-source-code" id="M000001-source">
|
238
|
-
<pre>
|
239
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 78</span>
|
240
|
-
78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">api_key_or_params</span>={})
|
241
|
-
79: <span class="ruby-ivar">@host</span> = <span class="ruby-constant">HOST_URL</span>
|
242
|
-
80: <span class="ruby-ivar">@api</span> = <span class="ruby-constant">API_PATH</span>
|
243
|
-
81: <span class="ruby-identifier">api_key_or_params</span>={} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">api_key_or_params</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-comment cmt"># fix for nil value as argument</span>
|
244
|
-
82: <span class="ruby-identifier">api_key_or_params</span> = {<span class="ruby-identifier">:api_key</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">api_key_or_params</span>} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">api_key_or_params</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
245
|
-
83: <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 kw">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">parsed?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">api_key_or_params</span>.<span class="ruby-identifier">empty?</span>
|
246
|
-
84: <span class="ruby-identifier">set_up_configuration</span> <span class="ruby-identifier">api_key_or_params</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">api_key_or_params</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
247
|
-
85: <span class="ruby-keyword kw">end</span>
|
248
|
-
</pre>
|
249
|
-
</div>
|
250
|
-
</div>
|
251
|
-
</div>
|
252
|
-
|
253
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
254
|
-
|
255
|
-
<div id="method-M000004" class="method-detail">
|
256
|
-
<a name="M000004"></a>
|
257
|
-
|
258
|
-
<div class="method-heading">
|
259
|
-
<a href="#M000004" class="method-signature">
|
260
|
-
<span class="method-name">find_by_url</span><span class="method-args">(url)</span>
|
261
|
-
</a>
|
262
|
-
</div>
|
263
|
-
|
264
|
-
<div class="method-description">
|
265
|
-
<p>
|
266
|
-
Implements flickr.urls.lookupGroup and flickr.urls.lookupUser
|
267
|
-
</p>
|
268
|
-
<p><a class="source-toggle" href="#"
|
269
|
-
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
270
|
-
<div class="method-source-code" id="M000004-source">
|
271
|
-
<pre>
|
272
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 107</span>
|
273
|
-
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_by_url</span>(<span class="ruby-identifier">url</span>)
|
274
|
-
108: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">urls_lookupUser</span>(<span class="ruby-value str">'url'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">url</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-identifier">urls_lookupGroup</span>(<span class="ruby-value str">'url'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">url</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
275
|
-
109: (<span class="ruby-identifier">response</span>[<span class="ruby-value str">'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-value str">'user'</span>][<span class="ruby-value str">'id'</span>], <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">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-value str">'group'</span>][<span class="ruby-value str">'id'</span>], <span class="ruby-ivar">@api_key</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">nil?</span>
|
276
|
-
110: <span class="ruby-keyword kw">end</span>
|
277
|
-
</pre>
|
278
|
-
</div>
|
279
|
-
</div>
|
280
|
-
</div>
|
281
|
-
|
282
|
-
<div id="method-M000003" class="method-detail">
|
283
|
-
<a name="M000003"></a>
|
284
|
-
|
285
|
-
<div class="method-heading">
|
286
|
-
<a href="#M000003" class="method-signature">
|
287
|
-
<span class="method-name">get_token_from</span><span class="method-args">(frob)</span>
|
288
|
-
</a>
|
289
|
-
</div>
|
290
|
-
|
291
|
-
<div class="method-description">
|
292
|
-
<p>
|
293
|
-
Gets authentication token given a <a href="Flickr.html">Flickr</a> frob,
|
294
|
-
which is returned when user allows access to their account for the
|
295
|
-
application with the api_key which made the <a
|
296
|
-
href="Flickr.html#M000018">request</a>
|
297
|
-
</p>
|
298
|
-
<p><a class="source-toggle" href="#"
|
299
|
-
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
300
|
-
<div class="method-source-code" id="M000003-source">
|
301
|
-
<pre>
|
302
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 96</span>
|
303
|
-
96: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_token_from</span>(<span class="ruby-identifier">frob</span>)
|
304
|
-
97: <span class="ruby-identifier">auth_response</span> = <span class="ruby-identifier">request</span>(<span class="ruby-value str">"auth.getToken"</span>, <span class="ruby-identifier">:frob</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">frob</span>)[<span class="ruby-value str">'auth'</span>]
|
305
|
-
98: <span class="ruby-ivar">@auth_token</span> = <span class="ruby-identifier">auth_response</span>[<span class="ruby-value str">'token'</span>]
|
306
|
-
99: <span class="ruby-ivar">@user</span> = <span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>( <span class="ruby-value str">'id'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">auth_response</span>[<span class="ruby-value str">'user'</span>][<span class="ruby-value str">'nsid'</span>],
|
307
|
-
100: <span class="ruby-value str">'username'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">auth_response</span>[<span class="ruby-value str">'user'</span>][<span class="ruby-value str">'username'</span>],
|
308
|
-
101: <span class="ruby-value str">'name'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">auth_response</span>[<span class="ruby-value str">'user'</span>][<span class="ruby-value str">'fullname'</span>],
|
309
|
-
102: <span class="ruby-value str">'client'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>)
|
310
|
-
103: <span class="ruby-ivar">@auth_token</span>
|
311
|
-
104: <span class="ruby-keyword kw">end</span>
|
312
|
-
</pre>
|
313
|
-
</div>
|
314
|
-
</div>
|
315
|
-
</div>
|
316
|
-
|
317
|
-
<div id="method-M000011" class="method-detail">
|
318
|
-
<a name="M000011"></a>
|
319
|
-
|
320
|
-
<div class="method-heading">
|
321
|
-
<a href="#M000011" class="method-signature">
|
322
|
-
<span class="method-name">groups</span><span class="method-args">(group_name, options={})</span>
|
323
|
-
</a>
|
324
|
-
</div>
|
325
|
-
|
326
|
-
<div class="method-description">
|
327
|
-
<p>
|
328
|
-
Implements flickr.groups.<a href="Flickr.html#M000008">search</a>
|
329
|
-
</p>
|
330
|
-
<p><a class="source-toggle" href="#"
|
331
|
-
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
332
|
-
<div class="method-source-code" id="M000011-source">
|
333
|
-
<pre>
|
334
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 140</span>
|
335
|
-
140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">groups</span>(<span class="ruby-identifier">group_name</span>, <span class="ruby-identifier">options</span>={})
|
336
|
-
141: <span class="ruby-identifier">collection</span> = <span class="ruby-identifier">groups_search</span>({<span class="ruby-value str">"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-value str">'groups'</span>][<span class="ruby-value str">'group'</span>]
|
337
|
-
142: <span class="ruby-identifier">collection</span> = [<span class="ruby-identifier">collection</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
338
|
-
143:
|
339
|
-
144: <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-value str">"id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">group</span>[<span class="ruby-value str">'nsid'</span>],
|
340
|
-
145: <span class="ruby-value str">"name"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">group</span>[<span class="ruby-value str">'name'</span>],
|
341
|
-
146: <span class="ruby-value str">"eighteenplus"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">group</span>[<span class="ruby-value str">'eighteenplus'</span>],
|
342
|
-
147: <span class="ruby-value str">"client"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>) }
|
343
|
-
148: <span class="ruby-keyword kw">end</span>
|
344
|
-
</pre>
|
345
|
-
</div>
|
346
|
-
</div>
|
347
|
-
</div>
|
348
|
-
|
349
|
-
<div id="method-M000017" class="method-detail">
|
350
|
-
<a name="M000017"></a>
|
351
|
-
|
352
|
-
<div class="method-heading">
|
353
|
-
<a href="#M000017" class="method-signature">
|
354
|
-
<span class="method-name">http_get</span><span class="method-args">(url)</span>
|
355
|
-
</a>
|
356
|
-
</div>
|
357
|
-
|
358
|
-
<div class="method-description">
|
359
|
-
<p>
|
360
|
-
Does an HTTP GET on a given URL and returns the response body
|
361
|
-
</p>
|
362
|
-
<p><a class="source-toggle" href="#"
|
363
|
-
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
364
|
-
<div class="method-source-code" id="M000017-source">
|
365
|
-
<pre>
|
366
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 178</span>
|
367
|
-
178: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_get</span>(<span class="ruby-identifier">url</span>)
|
368
|
-
179: <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>
|
369
|
-
180: <span class="ruby-keyword kw">end</span>
|
370
|
-
</pre>
|
371
|
-
</div>
|
372
|
-
</div>
|
373
|
-
</div>
|
374
|
-
|
375
|
-
<div id="method-M000014" class="method-detail">
|
376
|
-
<a name="M000014"></a>
|
377
|
-
|
378
|
-
<div class="method-heading">
|
379
|
-
<a href="#M000014" class="method-signature">
|
380
|
-
<span class="method-name">licenses</span><span class="method-args">()</span>
|
381
|
-
</a>
|
382
|
-
</div>
|
383
|
-
|
384
|
-
<div class="method-description">
|
385
|
-
<p>
|
386
|
-
Implements flickr.photos.licenses.getInfo
|
387
|
-
</p>
|
388
|
-
<p><a class="source-toggle" href="#"
|
389
|
-
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
390
|
-
<div class="method-source-code" id="M000014-source">
|
391
|
-
<pre>
|
392
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 160</span>
|
393
|
-
160: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">licenses</span>
|
394
|
-
161: <span class="ruby-identifier">photos_licenses_getInfo</span>[<span class="ruby-value str">'licenses'</span>][<span class="ruby-value str">'license'</span>]
|
395
|
-
162: <span class="ruby-keyword kw">end</span>
|
396
|
-
</pre>
|
397
|
-
</div>
|
398
|
-
</div>
|
399
|
-
</div>
|
400
|
-
|
401
|
-
<div id="method-M000015" class="method-detail">
|
402
|
-
<a name="M000015"></a>
|
403
|
-
|
404
|
-
<div class="method-heading">
|
405
|
-
<a href="#M000015" class="method-signature">
|
406
|
-
<span class="method-name">login_url</span><span class="method-args">(perms)</span>
|
407
|
-
</a>
|
408
|
-
</div>
|
409
|
-
|
410
|
-
<div class="method-description">
|
411
|
-
<p>
|
412
|
-
Returns url for user to login in to <a href="Flickr.html">Flickr</a> to
|
413
|
-
authenticate app for a user
|
414
|
-
</p>
|
415
|
-
<p><a class="source-toggle" href="#"
|
416
|
-
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
417
|
-
<div class="method-source-code" id="M000015-source">
|
418
|
-
<pre>
|
419
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 165</span>
|
420
|
-
165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">login_url</span>(<span class="ruby-identifier">perms</span>)
|
421
|
-
166: <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>
|
422
|
-
167: <span class="ruby-keyword kw">end</span>
|
423
|
-
</pre>
|
424
|
-
</div>
|
425
|
-
</div>
|
426
|
-
</div>
|
427
|
-
|
428
|
-
<div id="method-M000016" class="method-detail">
|
429
|
-
<a name="M000016"></a>
|
430
|
-
|
431
|
-
<div class="method-heading">
|
432
|
-
<a href="#M000016" class="method-signature">
|
433
|
-
<span class="method-name">method_missing</span><span class="method-args">(method_id, params={})</span>
|
434
|
-
</a>
|
435
|
-
</div>
|
436
|
-
|
437
|
-
<div class="method-description">
|
438
|
-
<p>
|
439
|
-
Implements everything else. Any method not defined explicitly will be
|
440
|
-
passed on to the <a href="Flickr.html">Flickr</a> API, and return an
|
441
|
-
XmlSimple document. For example, Flickr#test_echo is not defined, so it
|
442
|
-
will pass the call to the flickr.test.echo method.
|
443
|
-
</p>
|
444
|
-
<p><a class="source-toggle" href="#"
|
445
|
-
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
446
|
-
<div class="method-source-code" id="M000016-source">
|
447
|
-
<pre>
|
448
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 173</span>
|
449
|
-
173: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">method_id</span>, <span class="ruby-identifier">params</span>={})
|
450
|
-
174: <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 re">/_/</span>, <span class="ruby-value str">'.'</span>), <span class="ruby-identifier">params</span>)
|
451
|
-
175: <span class="ruby-keyword kw">end</span>
|
452
|
-
</pre>
|
453
|
-
</div>
|
454
|
-
</div>
|
455
|
-
</div>
|
456
|
-
|
457
|
-
<div id="method-M000005" class="method-detail">
|
458
|
-
<a name="M000005"></a>
|
459
|
-
|
460
|
-
<div class="method-heading">
|
461
|
-
<a href="#M000005" class="method-signature">
|
462
|
-
<span class="method-name">photos</span><span class="method-args">(*criteria)</span>
|
463
|
-
</a>
|
464
|
-
</div>
|
465
|
-
|
466
|
-
<div class="method-description">
|
467
|
-
<p>
|
468
|
-
Implements flickr.photos.getRecent and flickr.photos.<a
|
469
|
-
href="Flickr.html#M000008">search</a>
|
470
|
-
</p>
|
471
|
-
<p><a class="source-toggle" href="#"
|
472
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
473
|
-
<div class="method-source-code" id="M000005-source">
|
474
|
-
<pre>
|
475
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 113</span>
|
476
|
-
113: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">photos</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">criteria</span>)
|
477
|
-
114: <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">criteria</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">photos_search</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">criteria</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">recent</span>
|
478
|
-
115: <span class="ruby-keyword kw">end</span>
|
479
|
-
</pre>
|
480
|
-
</div>
|
481
|
-
</div>
|
482
|
-
</div>
|
483
|
-
|
484
|
-
<div id="method-M000019" class="method-detail">
|
485
|
-
<a name="M000019"></a>
|
486
|
-
|
487
|
-
<div class="method-heading">
|
488
|
-
<a href="#M000019" class="method-signature">
|
489
|
-
<span class="method-name">photos_request</span><span class="method-args">(method, params={})</span>
|
490
|
-
</a>
|
491
|
-
</div>
|
492
|
-
|
493
|
-
<div class="method-description">
|
494
|
-
<p>
|
495
|
-
acts like <a href="Flickr.html#M000018">request</a> but returns a <a
|
496
|
-
href="Flickr/PhotoCollection.html">PhotoCollection</a> (a list of <a
|
497
|
-
href="Flickr/Photo.html">Photo</a> objects)
|
498
|
-
</p>
|
499
|
-
<p><a class="source-toggle" href="#"
|
500
|
-
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
501
|
-
<div class="method-source-code" id="M000019-source">
|
502
|
-
<pre>
|
503
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 191</span>
|
504
|
-
191: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">photos_request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>={})
|
505
|
-
192: <span class="ruby-identifier">photos</span> = <span class="ruby-identifier">request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>)
|
506
|
-
193: <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>)
|
507
|
-
194: <span class="ruby-keyword kw">end</span>
|
508
|
-
</pre>
|
509
|
-
</div>
|
510
|
-
</div>
|
511
|
-
</div>
|
512
|
-
|
513
|
-
<div id="method-M000007" class="method-detail">
|
514
|
-
<a name="M000007"></a>
|
515
|
-
|
516
|
-
<div class="method-heading">
|
517
|
-
<a href="#M000007" class="method-signature">
|
518
|
-
<span class="method-name">photos_search</span><span class="method-args">(params={})</span>
|
519
|
-
</a>
|
520
|
-
</div>
|
521
|
-
|
522
|
-
<div class="method-description">
|
523
|
-
<p><a class="source-toggle" href="#"
|
524
|
-
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
525
|
-
<div class="method-source-code" id="M000007-source">
|
526
|
-
<pre>
|
527
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 123</span>
|
528
|
-
123: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">photos_search</span>(<span class="ruby-identifier">params</span>={})
|
529
|
-
124: <span class="ruby-identifier">photos_request</span>(<span class="ruby-value str">'photos.search'</span>, <span class="ruby-identifier">params</span>)
|
530
|
-
125: <span class="ruby-keyword kw">end</span>
|
531
|
-
</pre>
|
532
|
-
</div>
|
533
|
-
</div>
|
534
|
-
</div>
|
535
|
-
|
536
|
-
<div id="method-M000012" class="method-detail">
|
537
|
-
<a name="M000012"></a>
|
538
|
-
|
539
|
-
<div class="method-heading">
|
540
|
-
<a href="#M000012" class="method-signature">
|
541
|
-
<span class="method-name">photoset</span><span class="method-args">(photoset_id)</span>
|
542
|
-
</a>
|
543
|
-
</div>
|
544
|
-
|
545
|
-
<div class="method-description">
|
546
|
-
<p><a class="source-toggle" href="#"
|
547
|
-
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
548
|
-
<div class="method-source-code" id="M000012-source">
|
549
|
-
<pre>
|
550
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 150</span>
|
551
|
-
150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">photoset</span>(<span class="ruby-identifier">photoset_id</span>)
|
552
|
-
151: <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>)
|
553
|
-
152: <span class="ruby-keyword kw">end</span>
|
554
|
-
</pre>
|
555
|
-
</div>
|
556
|
-
</div>
|
557
|
-
</div>
|
558
|
-
|
559
|
-
<div id="method-M000006" class="method-detail">
|
560
|
-
<a name="M000006"></a>
|
561
|
-
|
562
|
-
<div class="method-heading">
|
563
|
-
<a href="#M000006" class="method-signature">
|
564
|
-
<span class="method-name">recent</span><span class="method-args">()</span>
|
565
|
-
</a>
|
566
|
-
</div>
|
567
|
-
|
568
|
-
<div class="method-description">
|
569
|
-
<p>
|
570
|
-
flickr.photos.getRecent 100 newest <a href="Flickr.html#M000005">photos</a>
|
571
|
-
from everyone
|
572
|
-
</p>
|
573
|
-
<p><a class="source-toggle" href="#"
|
574
|
-
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
575
|
-
<div class="method-source-code" id="M000006-source">
|
576
|
-
<pre>
|
577
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 119</span>
|
578
|
-
119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">recent</span>
|
579
|
-
120: <span class="ruby-identifier">photos_request</span>(<span class="ruby-value str">'photos.getRecent'</span>)
|
580
|
-
121: <span class="ruby-keyword kw">end</span>
|
581
|
-
</pre>
|
582
|
-
</div>
|
583
|
-
</div>
|
584
|
-
</div>
|
585
|
-
|
586
|
-
<div id="method-M000013" class="method-detail">
|
587
|
-
<a name="M000013"></a>
|
588
|
-
|
589
|
-
<div class="method-heading">
|
590
|
-
<a href="#M000013" class="method-signature">
|
591
|
-
<span class="method-name">related_tags</span><span class="method-args">(tag)</span>
|
592
|
-
</a>
|
593
|
-
</div>
|
594
|
-
|
595
|
-
<div class="method-description">
|
596
|
-
<p>
|
597
|
-
Implements flickr.tags.getRelated
|
598
|
-
</p>
|
599
|
-
<p><a class="source-toggle" href="#"
|
600
|
-
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
601
|
-
<div class="method-source-code" id="M000013-source">
|
602
|
-
<pre>
|
603
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 155</span>
|
604
|
-
155: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">related_tags</span>(<span class="ruby-identifier">tag</span>)
|
605
|
-
156: <span class="ruby-identifier">tags_getRelated</span>(<span class="ruby-value str">'tag'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">tag</span>)[<span class="ruby-value str">'tags'</span>][<span class="ruby-value str">'tag'</span>]
|
606
|
-
157: <span class="ruby-keyword kw">end</span>
|
607
|
-
</pre>
|
608
|
-
</div>
|
609
|
-
</div>
|
610
|
-
</div>
|
611
|
-
|
612
|
-
<div id="method-M000018" class="method-detail">
|
613
|
-
<a name="M000018"></a>
|
614
|
-
|
615
|
-
<div class="method-heading">
|
616
|
-
<a href="#M000018" class="method-signature">
|
617
|
-
<span class="method-name">request</span><span class="method-args">(method, params={})</span>
|
618
|
-
</a>
|
619
|
-
</div>
|
620
|
-
|
621
|
-
<div class="method-description">
|
622
|
-
<p>
|
623
|
-
Takes a <a href="Flickr.html">Flickr</a> API method name and set of
|
624
|
-
parameters; returns an XmlSimple object with the response
|
625
|
-
</p>
|
626
|
-
<p><a class="source-toggle" href="#"
|
627
|
-
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
628
|
-
<div class="method-source-code" id="M000018-source">
|
629
|
-
<pre>
|
630
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 183</span>
|
631
|
-
183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>={})
|
632
|
-
184: <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>)
|
633
|
-
185: <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-value str">'ForceArray'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span> })
|
634
|
-
186: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">response</span>[<span class="ruby-value str">'err'</span>][<span class="ruby-value str">'msg'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>[<span class="ruby-value str">'stat'</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'ok'</span>
|
635
|
-
187: <span class="ruby-identifier">response</span>
|
636
|
-
188: <span class="ruby-keyword kw">end</span>
|
637
|
-
</pre>
|
638
|
-
</div>
|
639
|
-
</div>
|
640
|
-
</div>
|
641
|
-
|
642
|
-
<div id="method-M000020" class="method-detail">
|
643
|
-
<a name="M000020"></a>
|
644
|
-
|
645
|
-
<div class="method-heading">
|
646
|
-
<a href="#M000020" class="method-signature">
|
647
|
-
<span class="method-name">request_url</span><span class="method-args">(method, params={})</span>
|
648
|
-
</a>
|
649
|
-
</div>
|
650
|
-
|
651
|
-
<div class="method-description">
|
652
|
-
<p>
|
653
|
-
Builds url for <a href="Flickr.html">Flickr</a> API REST <a
|
654
|
-
href="Flickr.html#M000018">request</a> from given the flickr method name
|
655
|
-
(exclusing the ‘flickr.’ that begins each method call) and
|
656
|
-
params (where applicable) which should be supplied as a Hash (e.g
|
657
|
-
‘user_id’ => "foo123")
|
658
|
-
</p>
|
659
|
-
<p><a class="source-toggle" href="#"
|
660
|
-
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
661
|
-
<div class="method-source-code" id="M000020-source">
|
662
|
-
<pre>
|
663
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 199</span>
|
664
|
-
199: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request_url</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">params</span>={})
|
665
|
-
200: <span class="ruby-identifier">method</span> = <span class="ruby-value str">'flickr.'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">method</span>
|
666
|
-
201: <span class="ruby-identifier">url</span> = <span class="ruby-node">"#{@host}#{@api}/?api_key=#{@api_key}&method=#{method}"</span>
|
667
|
-
202: <span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-value str">'api_key'</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@api_key</span>, <span class="ruby-value str">'method'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">method</span>, <span class="ruby-value str">'auth_token'</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@auth_token</span>)
|
668
|
-
203: <span class="ruby-identifier">signature</span> = <span class="ruby-identifier">signature_from</span>(<span class="ruby-identifier">params</span>)
|
669
|
-
204:
|
670
|
-
205: <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-value str">'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 kw">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-value str">"&"</span>)
|
671
|
-
206: <span class="ruby-keyword kw">end</span>
|
672
|
-
</pre>
|
673
|
-
</div>
|
674
|
-
</div>
|
675
|
-
</div>
|
676
|
-
|
677
|
-
<div id="method-M000008" class="method-detail">
|
678
|
-
<a name="M000008"></a>
|
679
|
-
|
680
|
-
<div class="method-heading">
|
681
|
-
<span class="method-name">search</span><span class="method-args">(params={})</span>
|
682
|
-
</div>
|
683
|
-
|
684
|
-
<div class="method-description">
|
685
|
-
<p>
|
686
|
-
Alias for <a href="Flickr.html#M000007">photos_search</a>
|
687
|
-
</p>
|
688
|
-
</div>
|
689
|
-
</div>
|
690
|
-
|
691
|
-
<div id="method-M000002" class="method-detail">
|
692
|
-
<a name="M000002"></a>
|
693
|
-
|
694
|
-
<div class="method-heading">
|
695
|
-
<a href="#M000002" class="method-signature">
|
696
|
-
<span class="method-name">set_up_configuration</span><span class="method-args">(api_key_or_params = {})</span>
|
697
|
-
</a>
|
698
|
-
</div>
|
699
|
-
|
700
|
-
<div class="method-description">
|
701
|
-
<p><a class="source-toggle" href="#"
|
702
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
703
|
-
<div class="method-source-code" id="M000002-source">
|
704
|
-
<pre>
|
705
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 87</span>
|
706
|
-
87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_up_configuration</span> <span class="ruby-identifier">api_key_or_params</span> = {}
|
707
|
-
88: <span class="ruby-ivar">@api_key</span> = <span class="ruby-identifier">api_key_or_params</span>[<span class="ruby-identifier">:api_key</span>]
|
708
|
-
89: <span class="ruby-ivar">@shared_secret</span> = <span class="ruby-identifier">api_key_or_params</span>[<span class="ruby-identifier">:shared_secret</span>]
|
709
|
-
90: <span class="ruby-ivar">@auth_token</span> = <span class="ruby-identifier">api_key_or_params</span>[<span class="ruby-identifier">:auth_token</span>]
|
710
|
-
91: <span class="ruby-keyword kw">end</span>
|
711
|
-
</pre>
|
712
|
-
</div>
|
713
|
-
</div>
|
714
|
-
</div>
|
715
|
-
|
716
|
-
<div id="method-M000021" class="method-detail">
|
717
|
-
<a name="M000021"></a>
|
718
|
-
|
719
|
-
<div class="method-heading">
|
720
|
-
<a href="#M000021" class="method-signature">
|
721
|
-
<span class="method-name">signature_from</span><span class="method-args">(params={})</span>
|
722
|
-
</a>
|
723
|
-
</div>
|
724
|
-
|
725
|
-
<div class="method-description">
|
726
|
-
<p><a class="source-toggle" href="#"
|
727
|
-
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
728
|
-
<div class="method-source-code" id="M000021-source">
|
729
|
-
<pre>
|
730
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 208</span>
|
731
|
-
208: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">signature_from</span>(<span class="ruby-identifier">params</span>={})
|
732
|
-
209: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@shared_secret</span> <span class="ruby-comment cmt"># don't both getting signature if no shared_secret</span>
|
733
|
-
210: <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 cmt"># build key value pairs, sort in alpha order then join them, ignoring those with nil value</span>
|
734
|
-
211: <span class="ruby-keyword kw">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>)
|
735
|
-
212: <span class="ruby-keyword kw">end</span>
|
736
|
-
</pre>
|
737
|
-
</div>
|
738
|
-
</div>
|
739
|
-
</div>
|
740
|
-
|
741
|
-
<div id="method-M000009" class="method-detail">
|
742
|
-
<a name="M000009"></a>
|
743
|
-
|
744
|
-
<div class="method-heading">
|
745
|
-
<a href="#M000009" class="method-signature">
|
746
|
-
<span class="method-name">tag</span><span class="method-args">(tag)</span>
|
747
|
-
</a>
|
748
|
-
</div>
|
749
|
-
|
750
|
-
<div class="method-description">
|
751
|
-
<p>
|
752
|
-
Gets public <a href="Flickr.html#M000005">photos</a> with a given <a
|
753
|
-
href="Flickr.html#M000009">tag</a>
|
754
|
-
</p>
|
755
|
-
<p><a class="source-toggle" href="#"
|
756
|
-
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
757
|
-
<div class="method-source-code" id="M000009-source">
|
758
|
-
<pre>
|
759
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 129</span>
|
760
|
-
129: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tag</span>(<span class="ruby-identifier">tag</span>)
|
761
|
-
130: <span class="ruby-identifier">photos</span>(<span class="ruby-value str">'tags'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">tag</span>)
|
762
|
-
131: <span class="ruby-keyword kw">end</span>
|
763
|
-
</pre>
|
764
|
-
</div>
|
765
|
-
</div>
|
766
|
-
</div>
|
767
|
-
|
768
|
-
<div id="method-M000010" class="method-detail">
|
769
|
-
<a name="M000010"></a>
|
770
|
-
|
771
|
-
<div class="method-heading">
|
772
|
-
<a href="#M000010" class="method-signature">
|
773
|
-
<span class="method-name">users</span><span class="method-args">(lookup=nil)</span>
|
774
|
-
</a>
|
775
|
-
</div>
|
776
|
-
|
777
|
-
<div class="method-description">
|
778
|
-
<p>
|
779
|
-
Implements flickr.people.findByEmail and flickr.people.findByUsername.
|
780
|
-
</p>
|
781
|
-
<p><a class="source-toggle" href="#"
|
782
|
-
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
783
|
-
<div class="method-source-code" id="M000010-source">
|
784
|
-
<pre>
|
785
|
-
<span class="ruby-comment cmt"># File lib/flickr.rb, line 134</span>
|
786
|
-
134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">users</span>(<span class="ruby-identifier">lookup</span>=<span class="ruby-keyword kw">nil</span>)
|
787
|
-
135: <span class="ruby-identifier">user</span> = <span class="ruby-identifier">people_findByEmail</span>(<span class="ruby-value str">'find_email'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">lookup</span>)[<span class="ruby-value str">'user'</span>] <span class="ruby-keyword kw">rescue</span> <span class="ruby-identifier">people_findByUsername</span>(<span class="ruby-value str">'username'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">lookup</span>)[<span class="ruby-value str">'user'</span>]
|
788
|
-
136: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">user</span>[<span class="ruby-value str">"nsid"</span>], <span class="ruby-value str">"username"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">user</span>[<span class="ruby-value str">"username"</span>], <span class="ruby-value str">"client"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>)
|
789
|
-
137: <span class="ruby-keyword kw">end</span>
|
790
|
-
</pre>
|
791
|
-
</div>
|
792
|
-
</div>
|
793
|
-
</div>
|
794
|
-
|
795
|
-
|
796
|
-
</div>
|
797
|
-
|
798
|
-
|
799
|
-
</div>
|
800
|
-
|
801
|
-
|
802
|
-
<div id="validator-badges">
|
803
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
804
|
-
</div>
|
805
|
-
|
806
|
-
</body>
|
807
|
-
</html>
|