Stack2RSS 1.0
A simple web application that creates an RSS feed given an API route.
Public Member Functions | Private Member Functions

Stack2RSS Class Reference

Fetches, parses, and processes API requests. More...

List of all members.

Public Member Functions

 ProcessFeed ()
 Processes the feed.

Private Member Functions

 CreateFeedData ($items_data, $feed_url)
 Creates the actual RSS feed data.
 FetchData ($url)
 Fetches the raw JSON data from the API for the given URL.
 GenerateURLFromParameters ()
 Gathers information from parameters and generates a URL.
 OutputError ($error_str, $status_line='404 Not Found')
 Returns an error to the client and exits.
 RunConversion ($json_data)
 Determines the correct conversion class to instantiate and uses it.

Detailed Description

Fetches, parses, and processes API requests.

Stack2RSS is responsible for parsing the parameters it is passed, fetching the API requests, and finally processing them by creating an instance of the appropriate conversion class and passing along the data.

Definition at line 85 of file feed.php.


Member Function Documentation

Stack2RSS::CreateFeedData ( items_data,
feed_url 
) [private]

Creates the actual RSS feed data.

This function returns the XML for the RSS feed including all of the metadata for the feed.

Parameters:
[in]$items_dataan array that contians the data (title, HTML) for each item
[in]$feed_urlthe URL for the API request
Returns:
the actual feed data itself

Definition at line 300 of file feed.php.

Stack2RSS::FetchData ( url) [private]

Fetches the raw JSON data from the API for the given URL.

Note: this method uses PHP's cURL methods.

Parameters:
[in]$urlthe URL of the API method to query
Returns:
an array object with the JSON-decoded data

Definition at line 111 of file feed.php.

Stack2RSS::GenerateURLFromParameters ( ) [private]

Gathers information from parameters and generates a URL.

This method is responsible for finding all of the parameters that have been passed to the script including the site and constructing the URL that will be passed to FetchData().

Returns:
the generated URL

Definition at line 143 of file feed.php.

Stack2RSS::OutputError ( error_str,
status_line = '404 Not Found' 
) [private]

Returns an error to the client and exits.

Parameters:
[in]$error_stra string representation of the error

Definition at line 91 of file feed.php.

Stack2RSS::ProcessFeed ( )

Processes the feed.

Note: this is the only public function in this class - it basically just wraps the other private functions, tying them all together.

Definition at line 282 of file feed.php.

Stack2RSS::RunConversion ( json_data) [private]

Determines the correct conversion class to instantiate and uses it.

Parameters:
[in]$json_datathe JSON-encoded data returned by the API
Returns:
an array of items with HTML for title, description, etc.

Definition at line 198 of file feed.php.


The documentation for this class was generated from the following file:
 All Classes Files Functions Enumerations