pavlov_rss 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pavlov_rss/reader.rb +8 -1
- data/lib/pavlov_rss/version.rb +1 -1
- data/spec/fixtures/atom.xml +8 -0
- data/spec/lib/pavlov_rss/reader_spec.rb +9 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 124cdf8d9daf80cd1469a706a6c3c910070b3e7b
|
4
|
+
data.tar.gz: 5e73a02d74061640507c3157eedce1e09067e14d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41318068f97592b7e7ca3a82912c8aee572ae211c77c1be46bd1147dcfc4f00cec03189bd0e3b89b01bb94c6a0bb2280e1ca34218b1f89d8b659915368c57587
|
7
|
+
data.tar.gz: d2dd2b40e53d911cb9d9887922272545a9e8978cc68c73c56524f5c5d50fb8a9202a71a673e7132d6a806e968f20728581630290707e5ab44913ea4313c875a9
|
data/Gemfile.lock
CHANGED
data/lib/pavlov_rss/reader.rb
CHANGED
@@ -26,7 +26,14 @@ module PavlovRss
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def item_to_json rss
|
29
|
-
|
29
|
+
value = Hash.from_xml(rss.to_xml)
|
30
|
+
result = case
|
31
|
+
when value.has_key?('rss')
|
32
|
+
value['rss']['channel']['item']
|
33
|
+
when value.has_key?('feed')
|
34
|
+
value['feed']['entry']
|
35
|
+
end
|
36
|
+
result ||= []
|
30
37
|
return result if result.is_a? Array
|
31
38
|
return [result]
|
32
39
|
end
|
data/lib/pavlov_rss/version.rb
CHANGED
@@ -121,6 +121,15 @@ describe PavlovRss::Reader do
|
|
121
121
|
result = @reader.item_to_json rss
|
122
122
|
result.should == []
|
123
123
|
end
|
124
|
+
it "works on atom" do
|
125
|
+
atom = Nokogiri.XML(feed('atom.xml'))
|
126
|
+
result = @reader.item_to_json atom
|
127
|
+
result.should == [{
|
128
|
+
"title"=>"title",
|
129
|
+
"id"=>"tag_string",
|
130
|
+
"content"=>"content"
|
131
|
+
}]
|
132
|
+
end
|
124
133
|
end
|
125
134
|
end
|
126
135
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pavlov_rss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minwoo Lee
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/pavlov_rss/reader.rb
|
186
186
|
- lib/pavlov_rss/version.rb
|
187
187
|
- pavlov_rss.gemspec
|
188
|
+
- spec/fixtures/atom.xml
|
188
189
|
- spec/fixtures/rss0.xml
|
189
190
|
- spec/fixtures/rss1.xml
|
190
191
|
- spec/fixtures/rss2.xml
|
@@ -218,6 +219,7 @@ signing_key:
|
|
218
219
|
specification_version: 4
|
219
220
|
summary: Pavlov's RSS
|
220
221
|
test_files:
|
222
|
+
- spec/fixtures/atom.xml
|
221
223
|
- spec/fixtures/rss0.xml
|
222
224
|
- spec/fixtures/rss1.xml
|
223
225
|
- spec/fixtures/rss2.xml
|