module AutoFlick
Constants
- VERSION
Public Class Methods
config(config)
click to toggle source
# File lib/auto_flick.rb, line 6 def self.config(config) FlickRaw.api_key = config[:api_key] FlickRaw.shared_secret = config[:shared_secret] @username = config[:username] @password = config[:password] authenticate end
upload(path)
click to toggle source
# File lib/auto_flick.rb, line 15 def self.upload(path) id = flickr.upload_photo path, :title => "Title", :description => "This is the description", :is_public => true info = flickr.photos.getInfo(:photo_id => id) FlickRaw.url_o(info) end
Private Class Methods
authenticate()
click to toggle source
# File lib/auto_flick.rb, line 23 def self.authenticate token = flickr.get_request_token auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'write') verify = Api.get_key(auth_url, @username, @password) begin flickr.get_access_token(token['oauth_token'], token['oauth_token_secret'], verify) login = flickr.test.login rescue FlickRaw::FailedResponse => e puts "Authentication failed : #{e.msg}" end end