Upflickr - v0.1.8

Upflickr is a Ruby Gem that makes it easier to upload images to Flickr using the Flickr API from within a ruby script or application. It is released under the MIT license.

Please send bug reports to bitsynthesis (at) gmail (dot) com


Installation

|| back to top ||

To install Upflickr:

  • sudo gem install upflickr

Requirements

|| back to top ||

The following attributes must be set for each new instance of Upflickr:

  • api_key
  • secret
  • token

Get an authentication token using the get_auth_url and get_token Upflickr methods. If you have previously authenticated, you may avoid re-authenticating by setting the token attribute of a new instance.

  • require 'rubygems'
  • require 'upflickr'
  • uf = Upflickr.new
  • uf.api_key = YOUR_API_KEY
  • uf.secret = YOUR_SECRET_VALUE
  • uf.token = YOUR_AUTHENTICATION_TOKEN


add_photo

Add an image to a set. To upload an image see the 'upload' method.

  • uf.add_photo(PHOTO_ID, SET_ID)

check_token

Check if the current authentication token is still valid.

  • puts "Still authenticated." if uf.check_token == true

create_set

Create a new photoset with the specified image as its main image (required).

  • title = 'My First Set'
  • description = 'This is my first set ever.'
  • new_set_id = uf.create_set(PHOTO_ID, title, description)

delete_photo

Delete an image.

  • uf.delete_photo(PHOTO_ID)

delete_set

Delete a photoset.

  • uf.delete_set(SET_ID)

get_auth_url

Gets the unique authentication URL for confirming read/write/delete access. You must load this URL in a web browser prior to attempting get_token.

  • require 'launchy'
  • url = uf.get_auth_url
  • Launchy.open(url)

get_token

Get an authentication token after visiting the authentication URL and clicking confirm. This token may be used with the above 'token' method to set the token in a new instance without re-authenticating.

  • token = uf.get_token

license_photo

Specify a license for a photo. License IDs can be found at \

  • uf.license_photo(PHOTO_ID, 1)

list_photos

Without argument, list all images not assigned to any set. With set_id argument, list all images in the specified set.

  • photos = Hash.new
  • photos = uf.list_photos(SET_ID)

list_sets

Get a hash of all the photoset ids and titles for the current user.

  • sets = Hash.new
  • sets = uf.list_sets

remove_photo

Remove an image from a set.

  • uf.remove_photo(PHOTO_ID)

upload

Upload a new image. Create a hash using any of the arguments from \ as keys. All arguments are optional except 'photo'. Therefore, the minimum required argument is: args{'photo' => "/path/to/image1.jpg"}

  • args = Hash.new
  • args['photo'] = '/path/to/image1.jpg'
  • args['title'] = 'My First Image'
  • args['description'] = 'This is the first image to be uploaded to flickr.'
  • uf.upload(args)