Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

130 lines (116 sloc) 5.29 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Flickr.rb</title>
<style>
body {
font-family: arial;
color: #222;
margin: 0;
padding: 1.5em;
font-size: 0.9em;
}
h1 {
margin: 0;
}
h1+p {
margin-top: 0;
}
div {
border-top: 1px solid #ccc;
}
h2 {
float: left;
text-transform: uppercase;
font-size: .8em;
color: #555;
margin-top: .8em;
}
div p {
margin-top: .8em;
margin-left: 9em;
}
div pre {
margin-left: 11em;
}
code {
background-color: #ddd;
padding: 0em;
}
code span {
color: #707;
}
</style>
</head>
<body>
<h1>Flickr.rb</h1>
<p><em>An insanely easy Ruby interface to the <a href="http://flickr.com/services/api/">Flickr</a> photo-sharing service. By Scott Raymond &lt;<a href="mailto:sco@scottraymond.net">sco@redgreenblu.com</a>&gt;</em></p>
<div>
<h2>Get it</h2>
<p>via RubyGems: <code>gem install flickr</code><br/>
...or download the gem: <a href="pkg/flickr-1.0.0.gem">flickr-1.0.0.gem</a><br/>
...or just get the source by itself: <a href="flickr.rb">flickr.rb</a></p>
<p>You'll also need a <a href="http://www.flickr.com/services/api/misc.api_keys.html">Flickr API key</a>.</p>
</div>
<div>
<h2>Example</h2>
<p><pre><code>require 'flickr'
<span># basics</span>
flickr = Flickr.new <span># create a flickr client</span>
flickr.login(email, password) <span># log in for actions that require it</span>
flickr.users <span># get all users currently online</span>
flickr.photos <span># get the 100 most recent public photos</span>
flickr.tag('red') <span># search for photos tagged with 'red'</span>
flickr.groups('Sun') <span># Search for groups containing 'Sun'</span>
<span># working with users</span>
user = flickr.users('sco') <span># lookup a user by username</span>
user = flickr.users('sco@scottraymond.net') <span># or email</span>
user.name <span># get the user's real name</span>
user.location <span># and location</span>
user.photos <span># grab their collection of Photo objects...</span>
user.tag('red') <span># search their photos for the tag 'red'</span>
user.groups <span># ...the groups they're in...</span>
user.contacts <span># ...their contacts...</span>
user.favorites <span># ...favorite photos...</span>
user.photosets <span># ...their photo sets...</span>
user.tags <span># ...and their tags</span>
<span># working with photos</span>
photo = flickr.photos.first <span># get the most recent public photo</span>
photo.url <span># see the URL for the photo's page...</span>
photo.url('Original') <span># as well as for its various sizes</span>
photo.source <span># see the URL for the JPEG itself...</span>
photo.source('Small') <span># as well as for its various sizes</span>
photo.title <span># get its title,</span>
photo.description <span># description,</span>
photo.owner <span># owner,</span>
photo.owner.name <span># and its owner's name, etc.</span>
<span># downloading files</span>
File.open(photo.filename, 'w') do |file|
file.puts photo.file <span># save the photo to a local file</span>
end
flickr.photos.each do |photo| <span># get the last 100 public photos...</span>
File.open(photo.filename, 'w') do |file|
file.puts photo.file('Square') <span># ...and save a local copy of their square thumbnail</span>
end
end
<span># ...and so much more. see the docs for full details.</span>
</code></pre></p>
</div>
<div>
<h2>Documentation</h2>
<p><a href="doc/">Rdoc Documentation</a><br/><small>Also see: <a href="http://www.flickr.com/services/api/">Original Flickr API reference</a></small></p>
</div>
<div>
<h2>License</h2>
<p><a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>. Attribution and contribution encouraged.</p>
</div>
<div>
<h2>Thanks</h2>
<p>
<strong>Maik Schmidt</strong> for <a href="http://www.maik-schmidt.de/xml-simple.html">XmlSimple</a>,
<strong>Ludicorp</strong> for <a href="http://www.flickr.com/">Flickr</a>,
and <strong>Premshee Pillai</strong> for <a href="http://premshree.seacrow.com/code/ruby/flickr-ruby">Flickr-ruby</a>.
</p>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.