benschwarz-flickr-rest 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,23 @@
1
+ # Introduction
2
+
3
+ flickr-rest is a stab at removing all the stuff that you don't really
4
+ want to do. There are no specific photo methods, community. Nothing.
5
+
6
+ Simply use it to query the bits you want.
7
+ If you want a flickr api wrapper, use the flickr gem.
8
+
9
+ # Usage
10
+
11
+ require 'flickr-rest'
12
+
13
+ # My API key has been set as the default. Flickr probably won't like that.
14
+
15
+ Flickr::Query::API_KEY = 'your-api-key-here'
16
+ flickr = Flickr::Query.new 'your-user-id-here'
17
+
18
+ flickr.execute('flickr.test.echo')
19
+
20
+ => #<Hpricot::Doc{} *snip*
21
+
22
+ Then use simple Hpricot selectors to traverse through the tree.
23
+
data/flickr-rest.gemspec CHANGED
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "flickr-rest"
3
- s.version = "0.1.0"
4
- s.date = "2008-10-09"
3
+ s.version = "0.1.1"
4
+ s.date = "2008-11-17"
5
5
  s.summary = "A light interface to call flickr 'restful' api methods"
6
6
  s.email = "ben@germanforblack.com"
7
7
  s.homepage = "http://github.com/benschwarz/flickr-rest"
8
8
  s.description = "A light interface to call flickr 'restful' api methods"
9
9
  s.authors = ["Ben Schwarz"]
10
- s.files = ["README", "flickr-rest.gemspec", "lib/flickr-rest.rb"]
10
+ s.files = ["README.markdown", "flickr-rest.gemspec", "lib/flickr-rest.rb"]
11
11
  s.require_path = "lib"
12
12
 
13
13
  # Deps
data/lib/flickr-rest.rb CHANGED
@@ -9,20 +9,23 @@ require 'open-uri'
9
9
 
10
10
  module Flickr
11
11
  class Query
12
- VERSION = '0.1.0'
12
+ VERSION = '0.1.1'
13
13
  API_BASE = "http://api.flickr.com/services/rest/"
14
- API_KEY = "2b60171843b346aa104e3a38d0129e5e"
14
+
15
15
  class Failure < StandardError; end
16
+ class ApiKeyRequired < StandardError; end
16
17
 
17
18
  # @param user_id - Your flickr user id
18
19
  def initialize(user_id)
19
20
  @user_id = user_id
20
21
  end
21
22
 
22
- # @param api_method - flickr.test.echo
23
- # @param params={} - :photo_id => 2929112139
23
+ # @param api_method eg: flickr.test.echo
24
+ # @param params={} eg: :photo_id => 2929112139
24
25
  def execute(api_method, params={})
25
- dispatch(build_query(api_method, params))
26
+ raise ApiKeyRequired, "set your flickr API key using Flickr::Query.API_KEY = ''" if API_KEY.nil?
27
+
28
+ dispatch(build_query(api_method, params))
26
29
  end
27
30
 
28
31
  private
@@ -39,7 +42,7 @@ module Flickr
39
42
  :api_key => API_KEY,
40
43
  :user_id => @user_id
41
44
  }.merge(params).each do |key, value|
42
- url << "#{key}=#{value}"
45
+ url << "#{key}=#{value}" unless value.empty?
43
46
  end
44
47
 
45
48
  return API_BASE + "?" + url.join("&")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benschwarz-flickr-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Schwarz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-09 00:00:00 -07:00
12
+ date: 2008-11-17 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ extensions: []
30
30
  extra_rdoc_files: []
31
31
 
32
32
  files:
33
- - README
33
+ - README.markdown
34
34
  - flickr-rest.gemspec
35
35
  - lib/flickr-rest.rb
36
36
  has_rdoc: false