julien51-feedzirra 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,12 +5,7 @@ module Feedzirra
5
5
  end
6
6
 
7
7
  def parse_datetime(string)
8
- begin
9
- DateTime.parse(string).feed_utils_to_gm_time
10
- rescue
11
- puts "DATE CAN'T BE PARSED: #{string}"
12
- nil
13
- end
8
+ Time.parse(string)
14
9
  end
15
10
 
16
11
  ##
@@ -9,9 +9,9 @@ describe Feedzirra::FeedUtilities do
9
9
 
10
10
  describe "handling dates" do
11
11
  it "should parse an ISO 8601 formatted datetime into Time" do
12
- time = @klass.new.parse_datetime("2008-02-20T8:05:00-010:00")
12
+ time = @klass.new.parse_datetime("2008-02-20T8:05:00-10:00")
13
13
  time.class.should == Time
14
- time.to_s.should == "Wed Feb 20 18:05:00 UTC 2008"
14
+ time.utc.to_s.should == "Wed Feb 20 18:05:00 UTC 2008"
15
15
  end
16
16
  end
17
17
 
@@ -24,28 +24,28 @@ describe Feedzirra::Feed do
24
24
  it "should parse an rdf feed" do
25
25
  feed = Feedzirra::Feed.parse(sample_rdf_feed)
26
26
  feed.title.should == "HREF Considered Harmful"
27
- feed.entries.first.published.to_s.should == "Tue Sep 02 19:50:07 UTC 2008"
27
+ feed.entries.first.published.utc.to_s.should == "Tue Sep 02 19:50:07 UTC 2008"
28
28
  feed.entries.size.should == 10
29
29
  end
30
30
 
31
31
  it "should parse an rss feed" do
32
32
  feed = Feedzirra::Feed.parse(sample_rss_feed)
33
33
  feed.title.should == "Tender Lovemaking"
34
- feed.entries.first.published.to_s.should == "Thu Dec 04 17:17:49 UTC 2008"
34
+ feed.entries.first.published.utc.to_s.should == "Thu Dec 04 17:17:49 UTC 2008"
35
35
  feed.entries.size.should == 10
36
36
  end
37
37
 
38
38
  it "should parse an atom feed" do
39
39
  feed = Feedzirra::Feed.parse(sample_atom_feed)
40
40
  feed.title.should == "Amazon Web Services Blog"
41
- feed.entries.first.published.to_s.should == "Fri Jan 16 18:21:00 UTC 2009"
41
+ feed.entries.first.published.utc.to_s.should == "Fri Jan 16 18:21:00 UTC 2009"
42
42
  feed.entries.size.should == 10
43
43
  end
44
44
 
45
45
  it "should parse an feedburner atom feed" do
46
46
  feed = Feedzirra::Feed.parse(sample_feedburner_atom_feed)
47
47
  feed.title.should == "Paul Dix Explains Nothing"
48
- feed.entries.first.published.to_s.should == "Thu Jan 22 15:50:22 UTC 2009"
48
+ feed.entries.first.published.utc.to_s.should == "Thu Jan 22 15:50:22 UTC 2009"
49
49
  feed.entries.size.should == 5
50
50
  end
51
51
 
@@ -72,7 +72,7 @@ describe Feedzirra::Feed do
72
72
  it "should parse an feedburner rss feed" do
73
73
  feed = Feedzirra::Feed.parse(sample_rss_feed_burner_feed)
74
74
  feed.title.should == "Sam Harris: Author, Philosopher, Essayist, Atheist"
75
- feed.entries.first.published.to_s.should == "Tue Jan 13 17:20:28 UTC 2009"
75
+ feed.entries.first.published.utc.to_s.should == "Tue Jan 13 17:20:28 UTC 2009"
76
76
  feed.entries.size.should == 10
77
77
  end
78
78
  end
@@ -28,7 +28,7 @@ describe Feedzirra::Parser::AtomEntry do
28
28
  end
29
29
 
30
30
  it "should parse the published date" do
31
- @entry.published.to_s.should == "Fri Jan 16 18:21:00 UTC 2009"
31
+ @entry.published.utc.to_s.should == "Fri Jan 16 18:21:00 UTC 2009"
32
32
  end
33
33
 
34
34
  it "should parse the categories" do
@@ -33,7 +33,7 @@ describe Feedzirra::Parser::AtomFeedBurnerEntry do
33
33
  end
34
34
 
35
35
  it "should parse the published date" do
36
- @entry.published.to_s.should == "Thu Jan 22 15:50:22 UTC 2009"
36
+ @entry.published.utc.to_s.should == "Thu Jan 22 15:50:22 UTC 2009"
37
37
  end
38
38
 
39
39
  it "should parse the categories" do
@@ -28,7 +28,7 @@ describe Feedzirra::Parser::RSSEntry do
28
28
  end
29
29
 
30
30
  it "should parse the published date" do
31
- @entry.published.to_s.should == "Thu Dec 04 17:17:49 UTC 2008"
31
+ @entry.published.utc.to_s.should == "Thu Dec 04 17:17:49 UTC 2008"
32
32
  end
33
33
 
34
34
  it "should parse the categories" do
@@ -9,7 +9,7 @@ describe Feedzirra::PushParser do
9
9
  }
10
10
  feed = pp.finish
11
11
  feed.title.should == "Amazon Web Services Blog"
12
- feed.entries.first.published.to_s.should == "Fri Jan 16 18:21:00 UTC 2009"
12
+ feed.entries.first.published.utc.to_s.should == "Fri Jan 16 18:21:00 UTC 2009"
13
13
  feed.entries.size.should == 10
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: julien51-feedzirra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dix
@@ -81,7 +81,6 @@ extensions: []
81
81
  extra_rdoc_files: []
82
82
 
83
83
  files:
84
- - lib/core_ext/date.rb
85
84
  - lib/core_ext/string.rb
86
85
  - lib/feedzirra/feed.rb
87
86
  - lib/feedzirra/feed_entry_utilities.rb
data/lib/core_ext/date.rb DELETED
@@ -1,21 +0,0 @@
1
- # Date code pulled from:
2
- # Ruby Cookbook by Lucas Carlson and Leonard Richardson
3
- # Published by O'Reilly
4
- # ISBN: 0-596-52369-6
5
- class Date
6
- def feed_utils_to_gm_time
7
- feed_utils_to_time(new_offset, :gm)
8
- end
9
-
10
- def feed_utils_to_local_time
11
- feed_utils_to_time(new_offset(DateTime.now.offset-offset), :local)
12
- end
13
-
14
- private
15
- def feed_utils_to_time(dest, method)
16
- #Convert a fraction of a day to a number of microseconds
17
- usec = (dest.sec_fraction * 60 * 60 * 24 * (10**6)).to_i
18
- Time.send(method, dest.year, dest.month, dest.day, dest.hour, dest.min,
19
- dest.sec, usec)
20
- end
21
- end