Class Feedzirra::Feed
In: lib/feedzirra/feed.rb
Parent: Object

Methods

Constants

USER_AGENT = "feedzirra http://github.com/pauldix/feedzirra/tree/master"

Public Class methods

Makes all entry types look for the passed in element to parse. This is actually just a call to element (a SAXMachine call) in the class

Parameters

[element_tag<String>]

options<Hash>
Valid keys are same as with SAXMachine

Adds a new feed parsing class that will be used for parsing.

Parameters

klass<Constant>
The class/constant that you want to register.

Returns

A updated array of feed parser class names.

An abstraction for adding a feed by a Feed object to the passed Curb::multi stack.

Parameters

multi<Curl::Multi>
The Curl::Multi object that the request should be added too.
feed<Feed>
A feed object that you would like to be fetched.
url_queue<Array>
An array of feed objects that are queued for request.
responses<Hash>
Existing responses that you want the response from the request added to.
feeds<String>
or <Array> A single feed object, or an array of feed objects.
options<Hash>
Valid keys for this argument as as followed:
  • :user_agent - String that overrides the default user agent.
  • :on_success - Block that gets executed after a successful request.
  • :on_failure - Block that gets executed after a failed request.

Returns

The updated Curl::Multi object with the request details added to it‘s stack.

An abstraction for adding a feed by URL to the passed Curb::multi stack.

Parameters

multi<Curl::Multi>
The Curl::Multi object that the request should be added too.
url<String>
The URL of the feed that you would like to be fetched.
url_queue<Array>
An array of URLs that are queued for request.
responses<Hash>
Existing responses that you want the response from the request added to.
feeds<String> or <Array>
A single feed object, or an array of feed objects.
options<Hash>
Valid keys for this argument as as followed:
  • :user_agent - String that overrides the default user agent.
  • :on_success - Block that gets executed after a successful request.
  • :on_failure - Block that gets executed after a failed request.

Returns

The updated Curl::Multi object with the request details added to it‘s stack.

Decodes the XML document if it was compressed.

Parameters

curl_request<Curl::Easy>
The Curl::Easy response object from the request.

Returns

A decoded string of XML.

Determines the correct parser class to use for parsing the feed.

Parameters

xml<String>
The XML that you would like determine the parser for.

Returns

The class name of the parser that can handle the XML.

Determines the etag from the request headers.

Parameters

header<String>
Raw request header returned from the request

Returns

A string of the etag or nil if it cannot be found in the headers.

Provides a list of registered feed parsing classes.

Returns

A array of class names.

Fetches and returns the parsed XML for each URL provided.

Parameters

urls<String> or <Array>
A single feed URL, or an array of feed URLs.
options<Hash>
Valid keys for this argument as as followed:
  • :user_agent - String that overrides the default user agent.
  • :if_modified_since - Time object representing when the feed was last updated.
  • :if_none_match - String, an etag for the request that was stored previously.
  • :on_success - Block that gets executed after a successful request.
  • :on_failure - Block that gets executed after a failed request.

Returns

A Feed object if a single URL is passed.

A Hash if multiple URL‘s are passed. The key will be the URL, and the value the Feed object.

Fetches and returns the raw XML for each URL provided.

Parameters

urls<String> or <Array>
A single feed URL, or an array of feed URLs.
options<Hash>
Valid keys for this argument as as followed: :user_agent - String that overrides the default user agent. :if_modified_since - Time object representing when the feed was last updated. :if_none_match - String that‘s normally an etag for the request that was stored previously. :on_success - Block that gets executed after a successful request. :on_failure - Block that gets executed after a failed request.

Returns

A String of XML if a single URL is passed.

A Hash if multiple URL‘s are passed. The key will be the URL, and the value the XML.

Determines the last modified date from the request headers.

Parameters

header<String>
Raw request header returned from the request

Returns

A Time object of the last modified date or nil if it cannot be found in the headers.

Takes a raw XML feed and attempts to parse it. If no parser is available a Feedzirra::NoParserAvailable exception is raised.

Parameters

xml<String>
The XML that you would like parsed.

Returns

An instance of the determined feed type. By default a Feedzirra::Atom, Feedzirra::AtomFeedBurner, Feedzirra::RDF, or Feedzirra::RSS object.

Raises

Feedzirra::NoParserAvailable : If no valid parser classes could be found for the feed.

Updates each feed for each Feed object provided.

Parameters

feeds<Feed> or <Array>
A single feed object, or an array of feed objects.
options<Hash>
Valid keys for this argument as as followed:
  • :user_agent - String that overrides the default user agent.
  • :on_success - Block that gets executed after a successful request.
  • :on_failure - Block that gets executed after a failed request.

Returns

A updated Feed object if a single URL is passed.

A Hash if multiple Feeds are passed. The key will be the URL, and the value the updated Feed object.

[Validate]