Ruby on Rails
rflickr

This little tutorial explains how to start using the rflickr gem, refer to the links at the bottom of the page for more in depth guides.

1) Install the gem:

gem install rflickr

2) In case you have other flickr gems installed:

gem uninstall flickr

3) Get your Flickr API key:

http://www.flickr.com/services/api/keys/

4) Load irb:

% irb
irb(main):001:0> require ‘flickr’
irb(main):002:0> API_KEY = “your-api-key-goes-here”
irb(main):003:0> SHARED_SECRET = “your-shared-secret-goes-here”
irb(main):004:0> flickr = Flickr.new(”/tmp/flickr.cache”, API_KEY,
SHARED_SECRET)
irb(main):005:0> flickr.auth.token
=> nil

5) Get frob:

irb(main)> flickr.auth.getFrob

i) It should return a value, save it.

irb(main):006:0> flickr.auth.login_link
=> “http://blahblahblah”

ii) You would click on the ‘blahblahblah’ link to authorize the API
usage.

6) Get token:

irb(main) > flickr.auth.getToken(“your frob”)

7) Save token to temp directory:

irb(main) > flickr.auth.cache_token

8) Now you should be able to use it.

More links;

Mailing list entry:
http://lists.rubyonrails.org/pipermail/rails/2006-May/042399.html
Explanation & authentication:
http://www.maxdunn.com/RoR+and+Flickr
Getting photos on your site:
http://digitalpardoe.co.uk/blog/show/87