feedjira 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/lib/feedjira/feed_entry_utilities.rb +2 -2
- data/lib/feedjira/version.rb +1 -1
- data/spec/feedjira/feed_spec.rb +10 -0
- data/spec/sample_feeds.rb +2 -1
- data/spec/sample_feeds/InvalidDateFormat.xml +20 -0
- metadata +5 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 573606467835d2066d0548ce3c3ddaf52cb2d9ed873e37f5b87f689cd3bbed20
|
4
|
+
data.tar.gz: ab95795c457c2d82636a7b92a16352b6cd97a2cae20658ac9c6d15b138e7225d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51fd592d656f870880f60fa610f19e041d74dd839e3b4096dbfbf164c4a2bf9a25d89fbb5d714cdaa8a1379683ddab438d6a8b9fc4b8ca464f1369075aa78342
|
7
|
+
data.tar.gz: c528819390fc917d18ff8eae6c126064e1097b3ddbc27b7e1f6357854e57fb3ecdc558c002700137096fc471975f8e99ec1b717cc5725955439d60f31123035f
|
data/CHANGELOG.md
CHANGED
@@ -28,14 +28,14 @@ module Feedjira
|
|
28
28
|
# Writer for published. By default, we keep the "oldest" publish time found.
|
29
29
|
def published=(val)
|
30
30
|
parsed = parse_datetime(val)
|
31
|
-
@published = parsed if !@published || parsed < @published
|
31
|
+
@published = parsed if parsed && (!@published || parsed < @published)
|
32
32
|
end
|
33
33
|
|
34
34
|
##
|
35
35
|
# Writer for updated. By default, we keep the most recent update time found.
|
36
36
|
def updated=(val)
|
37
37
|
parsed = parse_datetime(val)
|
38
|
-
@updated = parsed if !@updated || parsed > @updated
|
38
|
+
@updated = parsed if parsed && (!@updated || parsed > @updated)
|
39
39
|
end
|
40
40
|
|
41
41
|
def sanitize!
|
data/lib/feedjira/version.rb
CHANGED
data/spec/feedjira/feed_spec.rb
CHANGED
@@ -144,6 +144,16 @@ describe Feedjira::Feed do
|
|
144
144
|
expect(feed.entries.first.published).to eq published
|
145
145
|
expect(feed.entries.size).to eq 3
|
146
146
|
end
|
147
|
+
|
148
|
+
it 'does not fail if multiple published dates exist and some are unparseable' do
|
149
|
+
expect(Feedjira.logger).to receive(:warn).once
|
150
|
+
|
151
|
+
feed = Feedjira::Feed.parse(sample_invalid_date_format_feed)
|
152
|
+
expect(feed.title).to eq 'Invalid date format feed'
|
153
|
+
published = Time.parse_safely 'Mon, 16 Oct 2017 15:10:00 GMT'
|
154
|
+
expect(feed.entries.first.published).to eq published
|
155
|
+
expect(feed.entries.size).to eq 2
|
156
|
+
end
|
147
157
|
end
|
148
158
|
|
149
159
|
context "when there's no available parser" do
|
data/spec/sample_feeds.rb
CHANGED
@@ -26,7 +26,8 @@ module SampleFeeds
|
|
26
26
|
sample_feed_burner_atom_xhtml_feed: 'FeedBurnerXHTML.xml',
|
27
27
|
sample_duplicate_content_atom_feed: 'DuplicateContentAtomFeed.xml',
|
28
28
|
sample_youtube_atom_feed: 'youtube_atom.xml',
|
29
|
-
sample_atom_xhtml_with_escpaed_html_in_pre_tag_feed: 'AtomEscapedHTMLInPreTag.xml'
|
29
|
+
sample_atom_xhtml_with_escpaed_html_in_pre_tag_feed: 'AtomEscapedHTMLInPreTag.xml',
|
30
|
+
sample_invalid_date_format_feed: 'InvalidDateFormat.xml'
|
30
31
|
}.freeze
|
31
32
|
|
32
33
|
FEEDS.each do |method, filename|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
|
2
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
3
|
+
|
4
|
+
<channel>
|
5
|
+
<title>Invalid date format feed</title>
|
6
|
+
<link>http://example.com/feed</link>
|
7
|
+
<language>en-US</language>
|
8
|
+
<item>
|
9
|
+
<title>Item 0 with an invalid date</title>
|
10
|
+
<link>http://example.com/item0</link>
|
11
|
+
<pubDate>Mon, 16 Oct 2017 15:10:00 +0000</pubDate>
|
12
|
+
<dc:date>1518478934</dc:date>
|
13
|
+
</item>
|
14
|
+
<item>
|
15
|
+
<title>Item 1 with all valid dates</title>
|
16
|
+
<link>http://example.com/item1</link>
|
17
|
+
<pubDate>Tue, 17 Oct 2017 12:17:00 +0000</pubDate>
|
18
|
+
<dc:date>Tue, 17 Oct 2017 22:17:00 +0000</dc:date>
|
19
|
+
</item>
|
20
|
+
</channel>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedjira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Dix
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -245,6 +245,7 @@ files:
|
|
245
245
|
- spec/sample_feeds/HREFConsideredHarmfulFirstEntry.xml
|
246
246
|
- spec/sample_feeds/ITunesWithSingleQuotedAttributes.xml
|
247
247
|
- spec/sample_feeds/ITunesWithSpacesInAttributes.xml
|
248
|
+
- spec/sample_feeds/InvalidDateFormat.xml
|
248
249
|
- spec/sample_feeds/PaulDixExplainsNothing.xml
|
249
250
|
- spec/sample_feeds/PaulDixExplainsNothingAlternate.xml
|
250
251
|
- spec/sample_feeds/PaulDixExplainsNothingFirstEntryContent.xml
|
@@ -282,63 +283,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
283
|
version: '0'
|
283
284
|
requirements: []
|
284
285
|
rubyforge_project:
|
285
|
-
rubygems_version: 2.
|
286
|
+
rubygems_version: 2.7.3
|
286
287
|
signing_key:
|
287
288
|
specification_version: 4
|
288
289
|
summary: A feed fetching and parsing library
|
289
|
-
test_files:
|
290
|
-
- spec/feedjira/configuration_spec.rb
|
291
|
-
- spec/feedjira/date_time_utilities_spec.rb
|
292
|
-
- spec/feedjira/feed_entry_utilities_spec.rb
|
293
|
-
- spec/feedjira/feed_spec.rb
|
294
|
-
- spec/feedjira/feed_utilities_spec.rb
|
295
|
-
- spec/feedjira/parser/atom_entry_spec.rb
|
296
|
-
- spec/feedjira/parser/atom_feed_burner_entry_spec.rb
|
297
|
-
- spec/feedjira/parser/atom_feed_burner_spec.rb
|
298
|
-
- spec/feedjira/parser/atom_spec.rb
|
299
|
-
- spec/feedjira/parser/atom_youtube_entry_spec.rb
|
300
|
-
- spec/feedjira/parser/atom_youtube_spec.rb
|
301
|
-
- spec/feedjira/parser/google_docs_atom_entry_spec.rb
|
302
|
-
- spec/feedjira/parser/google_docs_atom_spec.rb
|
303
|
-
- spec/feedjira/parser/itunes_rss_item_spec.rb
|
304
|
-
- spec/feedjira/parser/itunes_rss_owner_spec.rb
|
305
|
-
- spec/feedjira/parser/itunes_rss_spec.rb
|
306
|
-
- spec/feedjira/parser/podlove_chapter_spec.rb
|
307
|
-
- spec/feedjira/parser/rss_entry_spec.rb
|
308
|
-
- spec/feedjira/parser/rss_feed_burner_entry_spec.rb
|
309
|
-
- spec/feedjira/parser/rss_feed_burner_spec.rb
|
310
|
-
- spec/feedjira/parser/rss_spec.rb
|
311
|
-
- spec/feedjira/preprocessor_spec.rb
|
312
|
-
- spec/sample_feeds.rb
|
313
|
-
- spec/sample_feeds/AmazonWebServicesBlog.xml
|
314
|
-
- spec/sample_feeds/AmazonWebServicesBlogFirstEntryContent.xml
|
315
|
-
- spec/sample_feeds/AtomEscapedHTMLInPreTag.xml
|
316
|
-
- spec/sample_feeds/AtomFeedWithSpacesAroundEquals.xml
|
317
|
-
- spec/sample_feeds/CRE.xml
|
318
|
-
- spec/sample_feeds/DuplicateContentAtomFeed.xml
|
319
|
-
- spec/sample_feeds/FeedBurnerUrlNoAlternate.xml
|
320
|
-
- spec/sample_feeds/FeedBurnerXHTML.xml
|
321
|
-
- spec/sample_feeds/FeedjiraBlog.xml
|
322
|
-
- spec/sample_feeds/GiantRobotsSmashingIntoOtherGiantRobots.xml
|
323
|
-
- spec/sample_feeds/GoogleDocsList.xml
|
324
|
-
- spec/sample_feeds/HREFConsideredHarmful.xml
|
325
|
-
- spec/sample_feeds/HREFConsideredHarmfulFirstEntry.xml
|
326
|
-
- spec/sample_feeds/ITunesWithSingleQuotedAttributes.xml
|
327
|
-
- spec/sample_feeds/ITunesWithSpacesInAttributes.xml
|
328
|
-
- spec/sample_feeds/PaulDixExplainsNothing.xml
|
329
|
-
- spec/sample_feeds/PaulDixExplainsNothingAlternate.xml
|
330
|
-
- spec/sample_feeds/PaulDixExplainsNothingFirstEntryContent.xml
|
331
|
-
- spec/sample_feeds/PaulDixExplainsNothingWFW.xml
|
332
|
-
- spec/sample_feeds/SamRuby.xml
|
333
|
-
- spec/sample_feeds/TechCrunch.xml
|
334
|
-
- spec/sample_feeds/TechCrunchFirstEntry.xml
|
335
|
-
- spec/sample_feeds/TechCrunchFirstEntryDescription.xml
|
336
|
-
- spec/sample_feeds/TenderLovemaking.xml
|
337
|
-
- spec/sample_feeds/TenderLovemakingFirstEntry.xml
|
338
|
-
- spec/sample_feeds/TrotterCashionHome.xml
|
339
|
-
- spec/sample_feeds/TypePadNews.xml
|
340
|
-
- spec/sample_feeds/atom_with_link_tag_for_url_unmarked.xml
|
341
|
-
- spec/sample_feeds/itunes.xml
|
342
|
-
- spec/sample_feeds/pet_atom.xml
|
343
|
-
- spec/sample_feeds/youtube_atom.xml
|
344
|
-
- spec/spec_helper.rb
|
290
|
+
test_files: []
|