Arrogance
What Arrogance does
Arrogance provides an easy way to work with RSS/Atom feeds.
How to use it
All you have to do is pass is a list of urls to following method:
Arrogance::Lasso.read([list, of, urls])
Arguments: A list of urls. This param can take one of two forms:
1: Hash structured as follows:
{:term => [Array, of, urls],
:barack_obamas_second_term => [Another, array, of, urls]
:etc … }
2: Array:
[Array, of, urls, that, can, be, as, long, as, you, want]
Returns: In either case, the return will be of the same structure. However, any array(s) of urls passed in will be replaced (non-destructive) with array(s) of BlogObjects:
{:term => [BlogObject<#*@&#>, BlogObject<@&^#^@>, BlogObject<rubbish_chars>]}
OR
[BlogObject<#*@&#>, BlogObject<@&^#^@>, BlogObject<rubbish_chars>]
The returned BlogObject(s) can be manipulated as follows
my_blog_object.most_recent
=> {:title => 'Blogger stating opinions!', :date => '2011-11-11...', :etc => '...'} #<-- Thats a hash, treat it like one
my_blog_object.most_recent[:title]
=> 'Blogger stating opinions!'
You can retrive individual posts by stating their position in reverse chronological order (newest first)
my_blog_object.first
=> {:title => 'Blogger stating opinions!', :date => '2011-11-11 12:34:25', :etc => '...'}
my_blog_object.first_and_seventh
=> [{:title => 'Blogger stating opinions', :yada => 'yada'}, {:title => 'Look at ma kittehs!!1!one', ...}]
Feel free to get rediculous. Doing
my_blog_object.first_and_second_and_fourth_and_ninth
works just fine. You call up to #tenth
Additionally, you can retrive the feed title, site link and feed_image (if they exist) by calling feed_title, #site_link and #feed_image methods of the BlogObject
The guts of a BlogObject are really just an array of hashes. If you just want to deal with that yourself and not take advantage of all the cool methods I made for you, thats fine. Just call
my_blog_object.guts
and you can get that array of hashes to play with.
Contributing
Add whatever you think is needed and send a pull request or contact me (details below) with ideas.
Contact
Email: [email protected]
License
Arrogance and all associated files are licensed under GPLv3
Copyright © Gideon J. Providence