Method: OPDS::Feed#links

Defined in:
lib/opds/feed.rb

Returns Set with atom feed level links.

Returns:



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/opds/feed.rb', line 116

def links
  if !@links || @links.size ==0
    @links=OPDS::Support::LinkSet.new @browser
    raw_doc.xpath('/xmlns:feed/xmlns:link',raw_doc.root.namespaces).each do |n|
      text=nil
      text=n.attributes['title'].value unless n.attributes['title'].nil?
      type=n.attributes['type'].value unless n.attributes['type'].nil?
      link=n.attributes['href'].value
      unless n.attributes['rel'].nil?
        n.attributes['rel'].value.split.each do |rel|
          if rel=='http://opds-spec.org/facet'
            group=n.attribute_with_ns('facetGroup','http://opds-spec.org/2010/catalog')
            group=group.value unless group.nil?
            active=n.attribute_with_ns('activeFacet','http://opds-spec.org/2010/catalog')
            active=active.value unless active.nil?
            count=n.attribute_with_ns('count','http://purl.org/syndication/thread/1.0')
            count=count.value unless count.nil?

          @links.push_facet(link,text,type,group,active,count)
          else
          @links.push(rel,link,text,type)
          end
        end
      else
        @links.push(nil,link,text,type)
      end
    end

  end
  @links
end