Skip to content

Commit

Permalink
Lock dependency on activesupport to 2.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
reagent committed Sep 25, 2010
1 parent ee6f7e9 commit 99633b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -17,7 +17,7 @@ spec = Gem::Specification.new do |s|
s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,test}/**/*")

s.add_dependency('hpricot', '>= 0.6.164')
s.add_dependency('activesupport', '>= 2.0')
s.add_dependency('activesupport', '~> 2.3.0')
s.add_dependency('loggable', '>= 0.2.0')
end

Expand Down
30 changes: 16 additions & 14 deletions lib/fleakr.rb
@@ -1,5 +1,7 @@
$:.unshift(File.dirname(__FILE__))

gem 'activesupport', '~> 2.3.0'

require 'uri'
require 'cgi'
require 'net/http'
Expand Down Expand Up @@ -36,7 +38,7 @@
# == Quick Start
#
# Getting started is easy, just make sure you have a valid API key from Flickr and you can
# then start making any non-authenticated request to pull back data for yours and others'
# then start making any non-authenticated request to pull back data for yours and others'
# photostreams, sets, contacts, groups, etc...
#
# For now, all activity originates from a single user which you can find by username or
Expand All @@ -57,10 +59,10 @@
# user.groups
#
# To see what other associations and attributes are available, see the Fleakr::Objects::User class
#
#
# == Authentication
#
# If you want to do something more than just retrieve public photos (like upload your own),
# If you want to do something more than just retrieve public photos (like upload your own),
# you'll need to generate an authentication token to use across requests and sessions.
#
# Assuming you've already applied for a key, go back and make sure you have the right settings
Expand All @@ -71,7 +73,7 @@
# 1. The value for 'Mobile Permissions' is set to either 'write' or 'delete'
#
# Once this is set, you'll see your Authentication URL on the key details page (it will look
# something like http://www.flickr.com/auth-534525246245). Paste this URL into your browser and
# something like http://www.flickr.com/auth-534525246245). Paste this URL into your browser and
# confirm access to get your mini-token. Now you're ready to make authenticated requests:
#
# require 'rubygems'
Expand All @@ -83,7 +85,7 @@
#
# Fleakr.upload('/path/to/my/photo.jpg')
# Fleakr.token.value # => "34132412341235-12341234ef34"
#
#
# Once you use the mini-token once, it is no longer available. To use the generated auth_token
# for future requests, just set Fleakr.auth_token to the generated value.
#
Expand All @@ -103,7 +105,7 @@ class ApiError < StandardError; end
# Fleakr.user('user@host.com')
# Fleakr.user('http://www.flickr.com/photos/the_decapitator/')
#

# TODO: Use User.find_by_identifier for some of this
def self.user(user_data, options = {})
user = nil
Expand All @@ -114,7 +116,7 @@ def self.user(user_data, options = {})
end
user
end

# Search all photos on the Flickr site. By default, this searches based on text, but you can pass
# different search parameters (passed as hash keys):
#
Expand All @@ -129,21 +131,21 @@ def self.search(params)
params = {:text => params} unless params.is_a?(Hash)
Objects::Search.new(params).results
end

# Upload one or more files to your Flickr account (requires authentication). Simply provide
# a filename or a pattern to upload one or more files:
#
# Fleakr.upload('/path/to/my/mug.jpg')
# Fleakr.upload('/User/Pictures/Party/*.jpg')
#
# Additionally, options can be supplied as part of the upload that will apply to all files
# that are matched by the pattern passed to <tt>glob</tt>. For a full list, see
# that are matched by the pattern passed to <tt>glob</tt>. For a full list, see
# Fleakr::Objects::Photo.
#
def self.upload(glob, options = {})
Dir[glob].map {|file| Fleakr::Objects::Photo.upload(file, options) }
end

# Get all contacts for the currently authenticated user. The provided contact type can be
# one of the following:
#
Expand All @@ -161,11 +163,11 @@ def self.contacts(contact_type = nil, additional_options = {})
options = {}
options.merge!(:filter => contact_type) unless contact_type.nil?
options.merge!(additional_options)

Fleakr::Objects::Contact.find_all(options)
end

# Generate an authorization URL to redirect users to. This defaults to
# Generate an authorization URL to redirect users to. This defaults to
# 'read' permission, but others are available when passed to this method:
#
# * :read - permission to read private information (default)
Expand All @@ -183,7 +185,7 @@ def self.authorization_url(permissions = :read)
def self.token_from_frob(frob)
Fleakr::Objects::AuthenticationToken.from_frob(frob)
end

# Exchange a mini token for an authentication token.
#
def self.token_from_mini_token(mini_token)
Expand All @@ -197,7 +199,7 @@ def self.user_for_token(auth_token)
token = Fleakr::Objects::AuthenticationToken.from_auth_token(auth_token)
token.user
end

def self.resource_from_url(url)
Fleakr::Objects::Url.new(url).resource
end
Expand Down

0 comments on commit 99633b9

Please sign in to comment.