benschwarz-flickr-rest 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/flickr-rest.gemspec +2 -2
- data/lib/flickr-rest.rb +9 -5
- metadata +3 -3
- data/README +0 -21
data/flickr-rest.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "flickr-rest"
|
3
|
-
s.version = "0.0
|
4
|
-
s.date = "2008-
|
3
|
+
s.version = "0.1.0"
|
4
|
+
s.date = "2008-10-09"
|
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"
|
data/lib/flickr-rest.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'minigems'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
end
|
6
|
+
|
2
7
|
require 'hpricot'
|
3
8
|
require 'open-uri'
|
4
9
|
|
5
10
|
module Flickr
|
6
11
|
class Query
|
7
|
-
VERSION = '0.0
|
12
|
+
VERSION = '0.1.0'
|
8
13
|
API_BASE = "http://api.flickr.com/services/rest/"
|
9
14
|
API_KEY = "2b60171843b346aa104e3a38d0129e5e"
|
10
15
|
class Failure < StandardError; end
|
@@ -22,7 +27,6 @@ module Flickr
|
|
22
27
|
|
23
28
|
private
|
24
29
|
def dispatch(query)
|
25
|
-
puts query
|
26
30
|
response = Hpricot.XML(open(query).read)
|
27
31
|
raise Failure, response.at(:err)['msg'] unless response.search(:err).empty?
|
28
32
|
return response
|
@@ -30,10 +34,10 @@ module Flickr
|
|
30
34
|
|
31
35
|
def build_query(method, params={})
|
32
36
|
url = []
|
33
|
-
|
37
|
+
opts = {
|
34
38
|
:method => method,
|
35
39
|
:api_key => API_KEY,
|
36
|
-
:user_id => @user_id
|
40
|
+
:user_id => @user_id
|
37
41
|
}.merge(params).each do |key, value|
|
38
42
|
url << "#{key}=#{value}"
|
39
43
|
end
|
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.0
|
4
|
+
version: 0.1.0
|
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-
|
12
|
+
date: 2008-10-09 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
requirements: []
|
56
56
|
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 1.0
|
58
|
+
rubygems_version: 1.2.0
|
59
59
|
signing_key:
|
60
60
|
specification_version: 2
|
61
61
|
summary: A light interface to call flickr 'restful' api methods
|
data/README
DELETED
@@ -1,21 +0,0 @@
|
|
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') => #<Hpricot::Doc{} *snip*
|
19
|
-
|
20
|
-
Then use simple Hpricot selectors to traverse through the tree.
|
21
|
-
|