flickraw 0.4 → 0.4.1
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/README +1 -0
- data/lib/flickraw.rb +13 -12
- data/rakefile +1 -4
- metadata +7 -7
data/README
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
Flickraw is a library to access flickr[http://flickr.com] api in a simple way.
|
4
4
|
It maps exactly the methods described in {the official api documentation}[http://www.flickr.com/services/api].
|
5
5
|
It also try to present the data returned in a simple and intuitive way.
|
6
|
+
The methods are fetched from flickr when loading the library by using introspection capabilities. So it is always up-to-date with regards to new methods added by flickr.
|
6
7
|
|
7
8
|
You can read the class documentation here : FlickRaw.
|
8
9
|
|
data/lib/flickraw.rb
CHANGED
@@ -25,7 +25,7 @@ require 'md5'
|
|
25
25
|
require 'yaml'
|
26
26
|
|
27
27
|
module FlickRaw
|
28
|
-
VERSION='0.4'
|
28
|
+
VERSION='0.4.1'
|
29
29
|
|
30
30
|
FLICKR_HOST='api.flickr.com'.freeze
|
31
31
|
|
@@ -50,7 +50,10 @@ module FlickRaw
|
|
50
50
|
|
51
51
|
class Response # :nodoc:
|
52
52
|
include SimpleOStruct
|
53
|
-
def initialize(h)
|
53
|
+
def initialize(h)
|
54
|
+
h.each {|k, v| __attr_define k, Response.structify(v, k) }
|
55
|
+
end
|
56
|
+
|
54
57
|
def self.structify(obj, name = '')
|
55
58
|
if obj.is_a? Hash
|
56
59
|
if name =~ /s$/ and obj[$`].is_a? Array
|
@@ -63,7 +66,7 @@ module FlickRaw
|
|
63
66
|
content.instance_eval { obj.each {|kv, vv| __attr_define kv, vv } }
|
64
67
|
content
|
65
68
|
else
|
66
|
-
|
69
|
+
Response.new obj
|
67
70
|
end
|
68
71
|
elsif obj.is_a? Array
|
69
72
|
obj.collect {|e| structify e}
|
@@ -151,7 +154,7 @@ module FlickRaw
|
|
151
154
|
#
|
152
155
|
# See http://www.flickr.com/services/api/upload.api.html for more information on the arguments.
|
153
156
|
def upload_photo(file, args={})
|
154
|
-
photo = File.read
|
157
|
+
photo = File.open(file, 'rb') { |f| f.read }
|
155
158
|
boundary = MD5.md5(photo).to_s
|
156
159
|
|
157
160
|
header = {'Content-type' => "multipart/form-data, boundary=#{boundary} ", 'User-Agent' => "Flickraw/#{VERSION}"}
|
@@ -233,11 +236,9 @@ module FlickRaw
|
|
233
236
|
methods.each { |method| Flickr.build_request method }
|
234
237
|
end
|
235
238
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
def flickr; @flickr ||= FlickRaw::Flickr.new end
|
243
|
-
end
|
239
|
+
# Use this to access the flickr API easily. You can type directly the flickr requests as they are described on the flickr website.
|
240
|
+
# require 'flickraw'
|
241
|
+
#
|
242
|
+
# recent_photos = flickr.photos.getRecent
|
243
|
+
# puts recent_photos[0].title
|
244
|
+
def flickr; @flickr ||= FlickRaw::Flickr.new end
|
data/rakefile
CHANGED
@@ -14,11 +14,8 @@ spec = Gem::Specification.new do |s|
|
|
14
14
|
s.author = "Hank Lords"
|
15
15
|
s.email = "hanklords@gmail.com"
|
16
16
|
s.version = FlickRaw::VERSION
|
17
|
-
s.has_rdoc = true
|
18
|
-
s.require_path = 'lib'
|
19
|
-
s.autorequire = 'rake'
|
20
17
|
s.files = PKG_FILES
|
21
|
-
s.
|
18
|
+
s.test_files = FileList["test/*.rb"].to_a
|
22
19
|
end
|
23
20
|
|
24
21
|
Rake::RDocTask.new do |rd|
|
metadata
CHANGED
@@ -3,19 +3,19 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: flickraw
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date: 2007-
|
6
|
+
version: 0.4.1
|
7
|
+
date: 2007-02-02 00:00:00 +01:00
|
8
8
|
summary: Flickr library with a syntax close to the syntax described on http://www.flickr.com/services/api
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: hanklords@gmail.com
|
12
12
|
homepage:
|
13
13
|
rubyforge_project:
|
14
|
-
description:
|
15
|
-
autorequire:
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
18
|
-
has_rdoc:
|
18
|
+
has_rdoc: false
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">"
|
@@ -40,8 +40,8 @@ files:
|
|
40
40
|
- examples/interestingness.rb
|
41
41
|
- examples/upload.rb
|
42
42
|
- test/test.rb
|
43
|
-
test_files:
|
44
|
-
|
43
|
+
test_files:
|
44
|
+
- test/test.rb
|
45
45
|
rdoc_options: []
|
46
46
|
|
47
47
|
extra_rdoc_files: []
|