flickraw 0.5.1 → 0.6

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.
File without changes
@@ -2,13 +2,13 @@
2
2
 
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
- It also try to present the data returned in a simple and intuitive way.
5
+ It also tries to present the data returned in a simple and intuitive way.
6
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.
7
7
 
8
- You can read the class documentation here : FlickRaw.
9
-
10
8
  The rubyforge project : http://rubyforge.org/projects/flickraw
11
9
 
10
+ The github repository: http://github.com/hanklords/flickraw/tree/master
11
+
12
12
  = Installation
13
13
  Type this in a console (you might need to be superuser)
14
14
  gem install flickraw
data/flickraw_rdoc.rb CHANGED
@@ -1,13 +1,12 @@
1
- require "rdoc/parsers/parserfactory"
2
- require "rdoc/parsers/parse_rb"
1
+ require "rdoc/parser/ruby"
2
+ require "cgi"
3
3
 
4
4
  FLICKR_API_URL='http://www.flickr.com/services/api'
5
5
 
6
6
  FakedToken = Struct.new :text
7
7
 
8
8
  module RDoc
9
- class FlickrawParser < RubyParser
10
- extend ParserFactory
9
+ class FlickrawParser < Parser::Ruby
11
10
  parse_files_matching(/flickraw\.rb$/)
12
11
 
13
12
  def scan
@@ -16,7 +15,7 @@ module RDoc
16
15
  fr = @top_level.find_module_named 'FlickRaw'
17
16
  k = fr.add_class NormalClass, 'Flickr', 'FlickRaw::Request'
18
17
  k.record_location @top_level
19
- @stats.num_classes += 1
18
+ @stats.add_class 'Flickr'
20
19
 
21
20
  add_flickr_methods(FlickRaw::Flickr, k)
22
21
  @top_level
@@ -30,16 +29,14 @@ module RDoc
30
29
  name = const.name.sub(/.*::/, '')
31
30
  k = doc.add_class NormalClass, name, 'FlickRaw::Request'
32
31
  k.record_location @top_level
33
- @stats.num_classes += 1
32
+ @stats.add_class name
34
33
 
35
34
  m = AnyMethod.new nil, name.downcase
36
35
  m.comment = "Returns a #{name} object."
37
36
  m.params = ''
38
37
  m.singleton = false
39
38
  doc.add_method m
40
-
41
- progress("c")
42
- @stats.num_methods += 1
39
+ @stats.add_method m
43
40
 
44
41
  add_flickr_methods(const, k)
45
42
  end
@@ -62,13 +59,12 @@ module RDoc
62
59
  end
63
60
  } )
64
61
  doc.add_method m
65
- progress(".")
66
- @stats.num_methods += 1
62
+ @stats.add_method m
67
63
  }
68
64
  end
69
65
 
70
66
  def flickr_method_comment(info)
71
- description = unescapeHTML(info.method.description.to_s)
67
+ description = CGI.unescapeHTML(info.method.description.to_s)
72
68
  # description.gsub!( /<\/?(\w+)>/ ) {|b|
73
69
  # return b if ['em', 'b', 'tt'].include? $1
74
70
  # return ''
@@ -83,7 +79,7 @@ module RDoc
83
79
  arguments << "[#{arg.name} "
84
80
  arguments << "<em>(required)</em> " if arg.optional == '0'
85
81
  arguments << "] "
86
- arguments << "#{unescapeHTML(arg.to_s)}\n"
82
+ arguments << "#{CGI.unescapeHTML(arg.to_s)}\n"
87
83
  }
88
84
  end
89
85
  end
@@ -92,14 +88,14 @@ module RDoc
92
88
  errors = "<b>Error codes</b>\n"
93
89
  info.errors.each {|e|
94
90
  errors << "* #{e.code}: <em>#{e.message}</em>\n\n"
95
- errors << " #{unescapeHTML e.to_s}\n"
91
+ errors << " #{CGI.unescapeHTML e.to_s}\n"
96
92
  }
97
93
  end
98
94
 
99
95
  if info.method.respond_to? :response
100
96
  response = "<b>Returns</b>\n"
101
- raw = unescapeHTML(info.method.response.to_s)
102
- response << raw.collect { |line| line.insert(0, ' ') }.join
97
+ raw = CGI.unescapeHTML(info.method.response.to_s)
98
+ response << raw.lines.collect { |line| line.insert(0, ' ') }.join
103
99
  else
104
100
  response = ''
105
101
  end
@@ -129,19 +125,5 @@ module RDoc
129
125
  str
130
126
  end
131
127
 
132
- def unescapeHTML(string)
133
- string.gsub!('\/', '/')
134
- string.gsub(/&(.*?);/n) do
135
- match = $1.dup
136
- case match
137
- when /\Aamp\z/ni then '&'
138
- when /\Aquot\z/ni then '"'
139
- when /\Agt\z/ni then '>'
140
- when /\Alt\z/ni then '<'
141
- when /\Anbsp\z/ni then ' '
142
- else "&#{match};"
143
- end
144
- end
145
- end
146
128
  end
147
129
  end
data/lib/flickraw.rb CHANGED
@@ -21,12 +21,12 @@
21
21
 
22
22
 
23
23
  require 'net/http'
24
- require 'md5'
24
+ require 'digest/md5'
25
25
  require 'json'
26
26
  require 'cgi'
27
27
 
28
28
  module FlickRaw
29
- VERSION='0.5.1'
29
+ VERSION='0.6'
30
30
 
31
31
  FLICKR_HOST='api.flickr.com'.freeze
32
32
 
@@ -103,8 +103,8 @@ module FlickRaw
103
103
  if method_nesting.size > 1
104
104
  name = method_nesting.first
105
105
  class_name = name.capitalize
106
- if const_defined? class_name
107
- klass = const_get( class_name)
106
+ if const_defined?(class_name, false)
107
+ klass = const_get(class_name)
108
108
  else
109
109
  klass = Class.new Request
110
110
  const_set(class_name, klass)
data/rakefile CHANGED
@@ -6,23 +6,24 @@ require 'rake/testtask'
6
6
  require 'lib/flickraw'
7
7
  require 'flickraw_rdoc'
8
8
 
9
- PKG_FILES = FileList["lib/flickraw.rb", "flickraw_rdoc.rb", "copying.txt", "README", "rakefile", "examples/*.rb", "test/*.rb"].to_a
9
+ PKG_FILES = FileList["lib/flickraw.rb", "flickraw_rdoc.rb", "LICENSE", "README.rdoc", "rakefile", "examples/*.rb", "test/*.rb"].to_a
10
10
 
11
11
  spec = Gem::Specification.new do |s|
12
12
  s.summary = "Flickr library with a syntax close to the syntax described on http://www.flickr.com/services/api"
13
13
  s.name = "flickraw"
14
14
  s.author = "Mael Clerambault"
15
15
  s.email = "maelclerambault@yahoo.fr"
16
- s.homepage = "http://flickraw.rubyforge.org"
16
+ s.homepage = "http://hanklords.github.com/flickraw/"
17
17
  s.rubyforge_project = "flickraw"
18
18
  s.version = FlickRaw::VERSION
19
19
  s.files = PKG_FILES
20
20
  s.test_files = FileList["test/*.rb"].to_a
21
21
  s.add_dependency 'json'
22
+ s.required_ruby_version = '>= 1.9'
22
23
  end
23
24
 
24
25
  Rake::RDocTask.new do |rd|
25
- rd.rdoc_files.include "README", "lib/flickraw.rb"
26
+ rd.rdoc_files.include "README.rdoc", "lib/flickraw.rb"
26
27
  rd.options << "--inline-source"
27
28
  end
28
29
 
@@ -31,3 +32,9 @@ Rake::GemPackageTask.new spec do |p|
31
32
  end
32
33
 
33
34
  Rake::TestTask.new
35
+
36
+ task :spec do
37
+ spec_clone = spec.clone
38
+ spec_clone.test_files = nil
39
+ open("flickraw.gemspec", "w") {|g| g.puts spec_clone.to_ruby }
40
+ end
data/test/test.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # -*- coding: utf-8 -*-
2
+
1
3
  require 'test/unit'
2
4
  require 'lib/flickraw'
3
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickraw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: "0.6"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mael Clerambault
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-23 00:00:00 +01:00
12
+ date: 2009-06-08 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -33,8 +33,8 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - lib/flickraw.rb
35
35
  - flickraw_rdoc.rb
36
- - copying.txt
37
- - README
36
+ - LICENSE
37
+ - README.rdoc
38
38
  - rakefile
39
39
  - examples/flickr_KDE.rb
40
40
  - examples/upload.rb
@@ -42,7 +42,7 @@ files:
42
42
  - examples/interestingness.rb
43
43
  - test/test.rb
44
44
  has_rdoc: false
45
- homepage: http://flickraw.rubyforge.org
45
+ homepage: http://hanklords.github.com/flickraw/
46
46
  post_install_message:
47
47
  rdoc_options: []
48
48
 
@@ -52,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: "0"
55
+ version: "1.9"
56
56
  version:
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  requirements:
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  requirements: []
64
64
 
65
65
  rubyforge_project: flickraw
66
- rubygems_version: 1.2.0
66
+ rubygems_version: 1.3.1
67
67
  signing_key:
68
68
  specification_version: 2
69
69
  summary: Flickr library with a syntax close to the syntax described on http://www.flickr.com/services/api