feed-abstract 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/feed-abstract.gemspec +4 -3
- data/lib/feed-abstract.rb +1 -1
- data/lib/feed-abstract/feed.rb +3 -2
- data/lib/feed-abstract/version.rb +1 -1
- data/spec/feed_abstract_channel_spec.rb +1 -1
- data/spec/feed_abstract_spec.rb +9 -1
- metadata +60 -14
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@ FeedAbstract creates a common object graph for RSS, Atom, and RDF feeds using th
|
|
8
8
|
|
9
9
|
== Usage
|
10
10
|
|
11
|
-
See FeedAbstract::Feed for basic examples. Also see the FeedAbstract::Channel and FeedAbstract::Item namespaces.
|
11
|
+
See FeedAbstract::Feed for basic examples. Also see the FeedAbstract::Channel and FeedAbstract::Item namespaces. See also the rdoc at http://rubydoc.info/gems/feed-abstract/0.0.12/frames
|
12
12
|
|
13
13
|
== Author
|
14
14
|
|
data/Rakefile
CHANGED
data/feed-abstract.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "feed-abstract"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.13"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Collis-Puro"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-08-17"
|
13
13
|
s.description = "This library creates a common object graph for the RSS/Atom/RDF parsing classes in the ruby standard library. This allows you parse different feed formats and get back the same (or at least a very similar) set of results - item authors are accessible under an \"author(s)\" attribute, categories/tags/subjects are accessible under \"category(ies)\" attributes, etc. We do our best to make sure the data makes sense, too - RSS items lack an \"updated\" attribute, so we use \"pubDate\" to populate it. "
|
14
14
|
s.email = ["djcp@cyber.law.harvard.edu"]
|
15
15
|
s.extra_rdoc_files = [
|
@@ -57,8 +57,9 @@ Gem::Specification.new do |s|
|
|
57
57
|
s.homepage = "https://github.com/berkmancenter/feed-abstract"
|
58
58
|
s.rdoc_options = ["--charset=UTF-8"]
|
59
59
|
s.require_paths = ["lib"]
|
60
|
-
s.rubygems_version = "1.8.
|
60
|
+
s.rubygems_version = "1.8.24"
|
61
61
|
s.summary = "Abstracts RSS/Atom/RDF stdlib parsing into a common object graph."
|
62
|
+
s.test_files = ["spec/feed_abstract_channel_spec.rb", "spec/feed_abstract_item_spec.rb", "spec/feed_abstract_spec.rb", "spec/spec_helper.rb", "spec/test_data/LawLibrarianBlog.atom", "spec/test_data/chillingeffects.xml", "spec/test_data/djcp.rss", "spec/test_data/djcp.rss92", "spec/test_data/djcp_code.rss", "spec/test_data/djcp_delicious.rss", "spec/test_data/djcp_twitter.rss", "spec/test_data/doc.atom", "spec/test_data/feedburner.rss", "spec/test_data/katanapg.atom", "spec/test_data/oa.africa.rss", "spec/test_data/pyblosxom.atom", "spec/test_data/twitter_hashtag.atom", "spec/test_data/zotero.rss"]
|
62
63
|
|
63
64
|
if s.respond_to? :specification_version then
|
64
65
|
s.specification_version = 3
|
data/lib/feed-abstract.rb
CHANGED
data/lib/feed-abstract/feed.rb
CHANGED
@@ -70,16 +70,17 @@ module FeedAbstract
|
|
70
70
|
input = (xml.respond_to?(:read)) ? xml.read : xml
|
71
71
|
|
72
72
|
if options[:force_encoding]
|
73
|
-
ic = Iconv.new(options[:output_encoding].upcase + ((options[:transliterate_characters]) ? '//TRANSLIT' : '') + '//IGNORE',options[:input_encoding].upcase)
|
74
73
|
if input.respond_to?(:encoding)
|
75
74
|
# ruby 1.9
|
76
75
|
# Only transcode if the encoding isn't valid.
|
77
76
|
# See: http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/ for why we're appending the extra space.
|
78
77
|
unless (input.encoding.to_s.upcase == options[:output_encoding].upcase && input.valid_encoding?)
|
79
|
-
input
|
78
|
+
input.encode!(options[:output_encoding], options[:input_encoding])
|
80
79
|
end
|
81
80
|
else
|
82
81
|
# ruby 1.8
|
82
|
+
require 'iconv'
|
83
|
+
ic = Iconv.new(options[:output_encoding].upcase + ((options[:transliterate_characters]) ? '//TRANSLIT' : '') + '//IGNORE',options[:input_encoding].upcase)
|
83
84
|
input = ic.iconv(input << ' ')[0..-2]
|
84
85
|
end
|
85
86
|
end
|
@@ -244,7 +244,7 @@ module FeedAbstract
|
|
244
244
|
@oa.channel.rights.should == 'Connotea 2011'
|
245
245
|
@delicious.channel.rights.should == ''
|
246
246
|
@zotero.channel.rights.should == ''
|
247
|
-
@feedburner.channel.rights.should == ' 2011 Cable News Network LP, LLLP.'
|
247
|
+
@feedburner.channel.rights.should == '© 2011 Cable News Network LP, LLLP.'
|
248
248
|
@pyblosxom.channel.rights.should == 'Creative Commons Attribution-ShareAlike'
|
249
249
|
@chill.channel.rights.should == ''
|
250
250
|
@twitter.channel.rights.should == ''
|
data/spec/feed_abstract_spec.rb
CHANGED
@@ -9,7 +9,7 @@ module FeedAbstract
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should be able to instantiate" do
|
12
|
-
Feed.respond_to?(:new).should == true
|
12
|
+
FeedAbstract::Feed.respond_to?(:new).should == true
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should recognize atom feeds properly" do
|
@@ -36,6 +36,14 @@ module FeedAbstract
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
it "should throw a parser error on a bad feed" do
|
40
|
+
begin
|
41
|
+
f = FeedAbstract::Feed.new('asdfasdf')
|
42
|
+
rescue Exception => e
|
43
|
+
e.class.should == FeedAbstract::ParserError
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
39
47
|
end
|
40
48
|
|
41
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feed-abstract
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rdoc
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: bundler
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: jeweler
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: simplecov
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,7 +85,12 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
description: ! 'This library creates a common object graph for the RSS/Atom/RDF parsing
|
70
95
|
classes in the ruby standard library. This allows you parse different feed formats
|
71
96
|
and get back the same (or at least a very similar) set of results - item authors
|
@@ -130,6 +155,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
155
|
- - ! '>='
|
131
156
|
- !ruby/object:Gem::Version
|
132
157
|
version: '0'
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
hash: 4541523730071053773
|
133
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
162
|
none: false
|
135
163
|
requirements:
|
@@ -138,8 +166,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
166
|
version: '0'
|
139
167
|
requirements: []
|
140
168
|
rubyforge_project:
|
141
|
-
rubygems_version: 1.8.
|
169
|
+
rubygems_version: 1.8.24
|
142
170
|
signing_key:
|
143
171
|
specification_version: 3
|
144
172
|
summary: Abstracts RSS/Atom/RDF stdlib parsing into a common object graph.
|
145
|
-
test_files:
|
173
|
+
test_files:
|
174
|
+
- spec/feed_abstract_channel_spec.rb
|
175
|
+
- spec/feed_abstract_item_spec.rb
|
176
|
+
- spec/feed_abstract_spec.rb
|
177
|
+
- spec/spec_helper.rb
|
178
|
+
- spec/test_data/LawLibrarianBlog.atom
|
179
|
+
- spec/test_data/chillingeffects.xml
|
180
|
+
- spec/test_data/djcp.rss
|
181
|
+
- spec/test_data/djcp.rss92
|
182
|
+
- spec/test_data/djcp_code.rss
|
183
|
+
- spec/test_data/djcp_delicious.rss
|
184
|
+
- spec/test_data/djcp_twitter.rss
|
185
|
+
- spec/test_data/doc.atom
|
186
|
+
- spec/test_data/feedburner.rss
|
187
|
+
- spec/test_data/katanapg.atom
|
188
|
+
- spec/test_data/oa.africa.rss
|
189
|
+
- spec/test_data/pyblosxom.atom
|
190
|
+
- spec/test_data/twitter_hashtag.atom
|
191
|
+
- spec/test_data/zotero.rss
|