pauldix-feedzirra 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/lib/feedzirra.rb CHANGED
@@ -30,5 +30,5 @@ require 'feedzirra/parser/atom'
30
30
  require 'feedzirra/parser/atom_feed_burner'
31
31
 
32
32
  module Feedzirra
33
- VERSION = "0.0.14"
33
+ VERSION = "0.0.15"
34
34
  end
@@ -15,11 +15,20 @@ module Feedzirra
15
15
  element :title
16
16
  element :link, :as => :url, :value => :href, :with => {:type => "text/html"}
17
17
  element :link, :as => :feed_url, :value => :href, :with => {:type => "application/atom+xml"}
18
+ elements :link, :as => :links, :value => :href
18
19
  elements :entry, :as => :entries, :class => AtomEntry
19
20
 
20
21
  def self.able_to_parse?(xml) #:nodoc:
21
22
  xml =~ /(Atom)|(#{Regexp.escape("http://purl.org/atom")})/
22
23
  end
24
+
25
+ def url
26
+ @url || links.last
27
+ end
28
+
29
+ def feed_url
30
+ @feed_url || links.first
31
+ end
23
32
  end
24
33
  end
25
34
 
@@ -24,6 +24,14 @@ describe Feedzirra::Parser::Atom do
24
24
  @feed.url.should == "http://aws.typepad.com/aws/"
25
25
  end
26
26
 
27
+ it "should parse the url even when it doesn't have the type='text/html' attribute" do
28
+ Feedzirra::Parser::Atom.parse(load_sample("atom_with_link_tag_for_url_unmarked.xml")).url.should == "http://www.innoq.com/planet/"
29
+ end
30
+
31
+ it "should parse the feed_url even when it doesn't have the type='application/atom+xml' attribute" do
32
+ Feedzirra::Parser::Atom.parse(load_sample("atom_with_link_tag_for_url_unmarked.xml")).feed_url.should == "http://www.innoq.com/planet/atom.xml"
33
+ end
34
+
27
35
  it "should parse the feed_url" do
28
36
  @feed.feed_url.should == "http://aws.typepad.com/aws/atom.xml"
29
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pauldix-feedzirra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dix