public
Description: An update of Scott Raymond's insanely easy flickr library
Clone URL: git://github.com/ctagg/flickr.git
Chris Taggart (author)
Mon May 12 12:17:30 -0700 2008
commit  96b232ab9c361d4b6bd626b321c800276e1fb4bf
tree    6d2e004e0a131f4b06856cb6d530d49be57d4f15
parent  6c78cf871d5e329b7f5ac1453b656591dbced06e
flickr / index.html
100644 130 lines (116 sloc) 5.29 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!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>