Skip to content

gretch/flickr_fu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= ruby-flickr

== Getting Started

You need to first get an API key as detailed here:

http://www.flickr.com/services/api/misc.api_keys.html

== Documentation

RDoc Documentation can be found here:

http://www.commonthread.com/projects/ruby-flickr/rdoc/

== Authorization Example

  require 'ruby_flickr'
  
  flickr = Flickr.new('YOUR_API_KEY', 'YOUR_API_SECRET', 'CACHE_FILENAME')
  
  puts "visit the following url, then click <enter> once you have authorized:"

  # request write permissions
  puts flickr.auth.url(:write)
  
  gets
  
  flickr.auth.cache_token

== Search Example

  require 'ruby_flickr'

  flickr = Flickr.new('YOUR_API_KEY')

  photos = flickr.photos.search(:tags => 'ruby-flickr')

  puts "found #{photos.size} photo(s)"

  photos.each do |photo|
    puts photo.title
    puts photo.description unless [nil, ''].include?(photo.description)
    [:square, :thumbnail, :small, :medium, :large, :original].each do |size|
      puts "#{size}: #{photo.url(size)}"
    end
    puts "comments: #{photo.comments.size}"
    photo.comments.each do |comment|
      intro = "#{comment.author_name} says - "
      puts "#{intro}\"#{comment.comment.gsub("\n", "\n"+(" "*intro.length))}\""
    end
    puts "notes: #{photo.notes.size}"
    photo.notes.each do |note|
      puts "[#{note.x},#{note.y} ~ #{note.width}x#{note.height}] - \"#{note.note}\""
    end
    puts
    puts
  end

About

flickr-fu is a ruby interface around the flickr REST api

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%